diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index bbab996df5..4a0552ab28 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1522,6 +1522,18 @@ importers: specifier: ~5.2.2 version: 5.2.2 + ../../packages/website-astro: + dependencies: + '@astrojs/starlight': + specifier: ^0.11.0 + version: 0.11.0(astro@3.2.3) + astro: + specifier: ^3.2.3 + version: 3.2.3 + sharp: + specifier: ^0.32.5 + version: 0.32.6 + packages: /@aashutoshrathi/word-wrap@1.2.6: @@ -1673,6 +1685,118 @@ packages: '@jridgewell/gen-mapping': 0.3.3 '@jridgewell/trace-mapping': 0.3.19 + /@astrojs/compiler@2.2.0: + resolution: {integrity: sha512-JvmckEJgg8uXUw8Rs6VZDvN7LcweCHOdcxsCXpC+4KMDC9FaB5t9EH/NooSE+hu/rnACEhsXA3FKmf9wnhb7hA==} + dev: false + + /@astrojs/internal-helpers@0.2.1: + resolution: {integrity: sha512-06DD2ZnItMwUnH81LBLco3tWjcZ1lGU9rLCCBaeUCGYe9cI0wKyY2W3kDyoW1I6GmcWgt1fu+D1CTvz+FIKf8A==} + dev: false + + /@astrojs/markdown-remark@3.2.1(astro@3.2.3): + resolution: {integrity: sha512-Z4YNMRtgFZeHhB29uCZl0B9MbMZddW9ZKCNucapoysbvygbDFF1gGtqpVnf+Lyv3rUBHwM/J5qWB2MSZuTuz1g==} + peerDependencies: + astro: ^3.2.3 + dependencies: + '@astrojs/prism': 3.0.0 + astro: 3.2.3 + github-slugger: 2.0.0 + import-meta-resolve: 3.0.0 + mdast-util-definitions: 6.0.0 + rehype-raw: 6.1.1 + rehype-stringify: 9.0.4 + remark-gfm: 3.0.1 + remark-parse: 10.0.2 + remark-rehype: 10.1.0 + remark-smartypants: 2.0.0 + shiki: 0.14.4 + unified: 10.1.2 + unist-util-visit: 4.1.2 + vfile: 5.3.7 + transitivePeerDependencies: + - supports-color + dev: false + + /@astrojs/mdx@1.1.1(astro@3.2.3): + resolution: {integrity: sha512-3dfL12ZqI6NCjx0iVOYVSyljlVgsxds5mOhe78xoCVjyqSpZZsxzz4Dt5WfGxDon2nc2bD6XGiZ2PIy8fmX6NQ==} + engines: {node: '>=18.14.1'} + peerDependencies: + astro: ^3.2.3 + dependencies: + '@astrojs/markdown-remark': 3.2.1(astro@3.2.3) + '@mdx-js/mdx': 2.3.0 + acorn: 8.10.0 + astro: 3.2.3 + es-module-lexer: 1.3.1 + estree-util-visit: 1.2.1 + github-slugger: 2.0.0 + gray-matter: 4.0.3 + hast-util-to-html: 8.0.4 + kleur: 4.1.5 + rehype-raw: 6.1.1 + remark-gfm: 3.0.1 + remark-smartypants: 2.0.0 + source-map: 0.7.4 + unist-util-visit: 4.1.2 + vfile: 5.3.7 + transitivePeerDependencies: + - supports-color + dev: false + + /@astrojs/prism@3.0.0: + resolution: {integrity: sha512-g61lZupWq1bYbcBnYZqdjndShr/J3l/oFobBKPA3+qMat146zce3nz2kdO4giGbhYDt4gYdhmoBz0vZJ4sIurQ==} + engines: {node: '>=18.14.1'} + dependencies: + prismjs: 1.29.0 + dev: false + + /@astrojs/sitemap@3.0.1: + resolution: {integrity: sha512-ErCthOQF0Yt6KkvaS+v/7CM6TxztOPHJjla4cbM3fBAFsDQbCS3tvoWSMqPJtmTFiy7veQ1eC5gH58FhPe85zg==} + dependencies: + sitemap: 7.1.1 + zod: 3.21.1 + dev: false + + /@astrojs/starlight@0.11.0(astro@3.2.3): + resolution: {integrity: sha512-ZnYB1AHetRujy25fSW4uvJTn2ry8nFspMCySWkeB1VT7QzTTgol9y19o1HTWVessViJhlavayHAjd42Pru1rww==} + peerDependencies: + astro: ^3.2.0 + dependencies: + '@astrojs/mdx': 1.1.1(astro@3.2.3) + '@astrojs/sitemap': 3.0.1 + '@pagefind/default-ui': 1.0.3 + '@types/mdast': 3.0.12 + astro: 3.2.3 + bcp-47: 2.1.0 + execa: 7.2.0 + hast-util-select: 5.0.5 + hastscript: 7.2.0 + pagefind: 1.0.3 + rehype: 12.0.1 + remark-directive: 2.0.1 + unified: 10.1.2 + unist-util-remove: 3.1.1 + unist-util-visit: 4.1.2 + vfile: 5.3.7 + transitivePeerDependencies: + - supports-color + dev: false + + /@astrojs/telemetry@3.0.3: + resolution: {integrity: sha512-j19Cf5mfyLt9hxgJ9W/FMdAA5Lovfp7/CINNB/7V71GqvygnL7KXhRC3TzfB+PsVQcBtgWZzCXhUWRbmJ64Raw==} + engines: {node: '>=18.14.1'} + dependencies: + ci-info: 3.8.0 + debug: 4.3.4(supports-color@8.1.1) + dlv: 1.1.3 + dset: 3.1.2 + is-docker: 3.0.0 + is-wsl: 3.1.0 + which-pm-runs: 1.1.0 + transitivePeerDependencies: + - supports-color + dev: false + /@babel/code-frame@7.12.11: resolution: {integrity: sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==} dependencies: @@ -4333,7 +4457,15 @@ packages: cpu: [arm64] os: [android] requiresBuild: true - dev: true + optional: true + + /@esbuild/android-arm64@0.19.4: + resolution: {integrity: sha512-mRsi2vJsk4Bx/AFsNBqOH2fqedxn5L/moT58xgg51DjX1la64Z3Npicut2VbhvDFO26qjWtPMsVxCd80YTFVeg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: false optional: true /@esbuild/android-arm@0.18.20: @@ -4342,7 +4474,15 @@ packages: cpu: [arm] os: [android] requiresBuild: true - dev: true + optional: true + + /@esbuild/android-arm@0.19.4: + resolution: {integrity: sha512-uBIbiYMeSsy2U0XQoOGVVcpIktjLMEKa7ryz2RLr7L/vTnANNEsPVAh4xOv7ondGz6ac1zVb0F8Jx20rQikffQ==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: false optional: true /@esbuild/android-x64@0.18.20: @@ -4351,7 +4491,15 @@ packages: cpu: [x64] os: [android] requiresBuild: true - dev: true + optional: true + + /@esbuild/android-x64@0.19.4: + resolution: {integrity: sha512-4iPufZ1TMOD3oBlGFqHXBpa3KFT46aLl6Vy7gwed0ZSYgHaZ/mihbYb4t7Z9etjkC9Al3ZYIoOaHrU60gcMy7g==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: false optional: true /@esbuild/darwin-arm64@0.18.20: @@ -4360,7 +4508,15 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true + optional: true + + /@esbuild/darwin-arm64@0.19.4: + resolution: {integrity: sha512-Lviw8EzxsVQKpbS+rSt6/6zjn9ashUZ7Tbuvc2YENgRl0yZTktGlachZ9KMJUsVjZEGFVu336kl5lBgDN6PmpA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: false optional: true /@esbuild/darwin-x64@0.18.20: @@ -4369,7 +4525,15 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true + optional: true + + /@esbuild/darwin-x64@0.19.4: + resolution: {integrity: sha512-YHbSFlLgDwglFn0lAO3Zsdrife9jcQXQhgRp77YiTDja23FrC2uwnhXMNkAucthsf+Psr7sTwYEryxz6FPAVqw==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: false optional: true /@esbuild/freebsd-arm64@0.18.20: @@ -4378,7 +4542,15 @@ packages: cpu: [arm64] os: [freebsd] requiresBuild: true - dev: true + optional: true + + /@esbuild/freebsd-arm64@0.19.4: + resolution: {integrity: sha512-vz59ijyrTG22Hshaj620e5yhs2dU1WJy723ofc+KUgxVCM6zxQESmWdMuVmUzxtGqtj5heHyB44PjV/HKsEmuQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: false optional: true /@esbuild/freebsd-x64@0.18.20: @@ -4387,7 +4559,15 @@ packages: cpu: [x64] os: [freebsd] requiresBuild: true - dev: true + optional: true + + /@esbuild/freebsd-x64@0.19.4: + resolution: {integrity: sha512-3sRbQ6W5kAiVQRBWREGJNd1YE7OgzS0AmOGjDmX/qZZecq8NFlQsQH0IfXjjmD0XtUYqr64e0EKNFjMUlPL3Cw==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: false optional: true /@esbuild/linux-arm64@0.18.20: @@ -4396,7 +4576,15 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true + optional: true + + /@esbuild/linux-arm64@0.19.4: + resolution: {integrity: sha512-ZWmWORaPbsPwmyu7eIEATFlaqm0QGt+joRE9sKcnVUG3oBbr/KYdNE2TnkzdQwX6EDRdg/x8Q4EZQTXoClUqqA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false optional: true /@esbuild/linux-arm@0.18.20: @@ -4405,7 +4593,15 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true + optional: true + + /@esbuild/linux-arm@0.19.4: + resolution: {integrity: sha512-z/4ArqOo9EImzTi4b6Vq+pthLnepFzJ92BnofU1jgNlcVb+UqynVFdoXMCFreTK7FdhqAzH0vmdwW5373Hm9pg==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: false optional: true /@esbuild/linux-ia32@0.18.20: @@ -4414,7 +4610,15 @@ packages: cpu: [ia32] os: [linux] requiresBuild: true - dev: true + optional: true + + /@esbuild/linux-ia32@0.19.4: + resolution: {integrity: sha512-EGc4vYM7i1GRUIMqRZNCTzJh25MHePYsnQfKDexD8uPTCm9mK56NIL04LUfX2aaJ+C9vyEp2fJ7jbqFEYgO9lQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: false optional: true /@esbuild/linux-loong64@0.18.20: @@ -4423,7 +4627,15 @@ packages: cpu: [loong64] os: [linux] requiresBuild: true - dev: true + optional: true + + /@esbuild/linux-loong64@0.19.4: + resolution: {integrity: sha512-WVhIKO26kmm8lPmNrUikxSpXcgd6HDog0cx12BUfA2PkmURHSgx9G6vA19lrlQOMw+UjMZ+l3PpbtzffCxFDRg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: false optional: true /@esbuild/linux-mips64el@0.18.20: @@ -4432,7 +4644,15 @@ packages: cpu: [mips64el] os: [linux] requiresBuild: true - dev: true + optional: true + + /@esbuild/linux-mips64el@0.19.4: + resolution: {integrity: sha512-keYY+Hlj5w86hNp5JJPuZNbvW4jql7c1eXdBUHIJGTeN/+0QFutU3GrS+c27L+NTmzi73yhtojHk+lr2+502Mw==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: false optional: true /@esbuild/linux-ppc64@0.18.20: @@ -4441,7 +4661,15 @@ packages: cpu: [ppc64] os: [linux] requiresBuild: true - dev: true + optional: true + + /@esbuild/linux-ppc64@0.19.4: + resolution: {integrity: sha512-tQ92n0WMXyEsCH4m32S21fND8VxNiVazUbU4IUGVXQpWiaAxOBvtOtbEt3cXIV3GEBydYsY8pyeRMJx9kn3rvw==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: false optional: true /@esbuild/linux-riscv64@0.18.20: @@ -4450,7 +4678,15 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true - dev: true + optional: true + + /@esbuild/linux-riscv64@0.19.4: + resolution: {integrity: sha512-tRRBey6fG9tqGH6V75xH3lFPpj9E8BH+N+zjSUCnFOX93kEzqS0WdyJHkta/mmJHn7MBaa++9P4ARiU4ykjhig==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: false optional: true /@esbuild/linux-s390x@0.18.20: @@ -4459,7 +4695,15 @@ packages: cpu: [s390x] os: [linux] requiresBuild: true - dev: true + optional: true + + /@esbuild/linux-s390x@0.19.4: + resolution: {integrity: sha512-152aLpQqKZYhThiJ+uAM4PcuLCAOxDsCekIbnGzPKVBRUDlgaaAfaUl5NYkB1hgY6WN4sPkejxKlANgVcGl9Qg==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: false optional: true /@esbuild/linux-x64@0.18.20: @@ -4468,7 +4712,15 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true + optional: true + + /@esbuild/linux-x64@0.19.4: + resolution: {integrity: sha512-Mi4aNA3rz1BNFtB7aGadMD0MavmzuuXNTaYL6/uiYIs08U7YMPETpgNn5oue3ICr+inKwItOwSsJDYkrE9ekVg==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false optional: true /@esbuild/netbsd-x64@0.18.20: @@ -4477,7 +4729,15 @@ packages: cpu: [x64] os: [netbsd] requiresBuild: true - dev: true + optional: true + + /@esbuild/netbsd-x64@0.19.4: + resolution: {integrity: sha512-9+Wxx1i5N/CYo505CTT7T+ix4lVzEdz0uCoYGxM5JDVlP2YdDC1Bdz+Khv6IbqmisT0Si928eAxbmGkcbiuM/A==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: false optional: true /@esbuild/openbsd-x64@0.18.20: @@ -4486,7 +4746,15 @@ packages: cpu: [x64] os: [openbsd] requiresBuild: true - dev: true + optional: true + + /@esbuild/openbsd-x64@0.19.4: + resolution: {integrity: sha512-MFsHleM5/rWRW9EivFssop+OulYVUoVcqkyOkjiynKBCGBj9Lihl7kh9IzrreDyXa4sNkquei5/DTP4uCk25xw==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: false optional: true /@esbuild/sunos-x64@0.18.20: @@ -4495,7 +4763,15 @@ packages: cpu: [x64] os: [sunos] requiresBuild: true - dev: true + optional: true + + /@esbuild/sunos-x64@0.19.4: + resolution: {integrity: sha512-6Xq8SpK46yLvrGxjp6HftkDwPP49puU4OF0hEL4dTxqCbfx09LyrbUj/D7tmIRMj5D5FCUPksBbxyQhp8tmHzw==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: false optional: true /@esbuild/win32-arm64@0.18.20: @@ -4504,7 +4780,15 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true + optional: true + + /@esbuild/win32-arm64@0.19.4: + resolution: {integrity: sha512-PkIl7Jq4mP6ke7QKwyg4fD4Xvn8PXisagV/+HntWoDEdmerB2LTukRZg728Yd1Fj+LuEX75t/hKXE2Ppk8Hh1w==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: false optional: true /@esbuild/win32-ia32@0.18.20: @@ -4513,7 +4797,15 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true + optional: true + + /@esbuild/win32-ia32@0.19.4: + resolution: {integrity: sha512-ga676Hnvw7/ycdKB53qPusvsKdwrWzEyJ+AtItHGoARszIqvjffTwaaW3b2L6l90i7MO9i+dlAW415INuRhSGg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: false optional: true /@esbuild/win32-x64@0.18.20: @@ -4522,7 +4814,15 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true + optional: true + + /@esbuild/win32-x64@0.19.4: + resolution: {integrity: sha512-HP0GDNla1T3ZL8Ko/SHAS2GgtjOg+VmWnnYLhuTksr++EnduYB0f3Y2LzHsUwb2iQ13JGoY6G3R8h6Du/WG6uA==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: false optional: true /@esfx/async-canceltoken@1.0.0: @@ -5948,6 +6248,30 @@ packages: - supports-color dev: false + /@mdx-js/mdx@2.3.0: + resolution: {integrity: sha512-jLuwRlz8DQfQNiUCJR50Y09CGPq3fLtmtUQfVrj79E0JWu3dvsVcxVIcfhR5h0iXu+/z++zDrYeiJqifRynJkA==} + dependencies: + '@types/estree-jsx': 1.0.0 + '@types/mdx': 2.0.8 + estree-util-build-jsx: 2.2.2 + estree-util-is-identifier-name: 2.1.0 + estree-util-to-js: 1.2.0 + estree-walker: 3.0.3 + hast-util-to-estree: 2.3.3 + markdown-extensions: 1.1.1 + periscopic: 3.1.0 + remark-mdx: 2.3.0 + remark-parse: 10.0.2 + remark-rehype: 10.1.0 + unified: 10.1.2 + unist-util-position-from-estree: 1.1.2 + unist-util-stringify-position: 3.0.3 + unist-util-visit: 4.1.2 + vfile: 5.3.7 + transitivePeerDependencies: + - supports-color + dev: false + /@mdx-js/react@1.6.22(react@17.0.2): resolution: {integrity: sha512-TDoPum4SHdfPiGSAaRBw7ECyI8VaHpK8GJugbJIJuqyh6kzw9ZLJZW3HGL3NNrJGxcAixUvqROm+YuQOo5eXtg==} peerDependencies: @@ -5978,18 +6302,62 @@ packages: '@nodelib/fs.scandir': 2.1.5 fastq: 1.15.0 - /@pkgjs/parseargs@0.11.0: - resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} - engines: {node: '>=14'} + /@pagefind/darwin-arm64@1.0.3: + resolution: {integrity: sha512-vsHDtvao3W4iFCxVc4S0BVhpj3E2MAoIVM7RmuQfGp1Ng22nGLRaMP6FguLO8TMabRJdvp4SVr227hL4WGKOHA==} + cpu: [arm64] + os: [darwin] requiresBuild: true - dev: true + dev: false optional: true - /@pkgr/utils@2.4.2: - resolution: {integrity: sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==} - engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - dependencies: - cross-spawn: 7.0.3 + /@pagefind/darwin-x64@1.0.3: + resolution: {integrity: sha512-NhEXHHYmB/hT6lx5rCcmnVTxH+uIkMAd43bzEqMwHQosqTZEIQfwihmV39H+m8yo7jFvz3zRbJNzhAh7G4PiwA==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@pagefind/default-ui@1.0.3: + resolution: {integrity: sha512-WieFJXvezyvjZh49I8j7a7Kz3LsXYY2Uep3IWvG5NG05mmiurURXjXc+KyrpIp/iAycSnjrC1TDJ8CdES/ee3A==} + dev: false + + /@pagefind/linux-arm64@1.0.3: + resolution: {integrity: sha512-RGsMt4AmGT8WxCSeP09arU7Za6Vf/We4TWHVSbY7vDMuwWql9Ngoib/q1cP9dIAIMdkXh9ePG/S3mGnJYsdzuQ==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@pagefind/linux-x64@1.0.3: + resolution: {integrity: sha512-o+VCKaqImL42scSH1n5gUfppYSNyu3BuGTvtKKgWHmycbL+A3fkFH+ZOFbaLeN7LVTvJqJIOYbk4j2yaq9784Q==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@pagefind/windows-x64@1.0.3: + resolution: {integrity: sha512-S+Yq4FyvXJm4F+iN/wRiLvEEF8Xs9lTKGtQGaRHXJslQyl65dytDDPIULXJXIadrDbnMrnTt4C2YHmEUIyUIHg==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: false + optional: true + + /@pkgjs/parseargs@0.11.0: + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + requiresBuild: true + dev: true + optional: true + + /@pkgr/utils@2.4.2: + resolution: {integrity: sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + dependencies: + cross-spawn: 7.0.3 fast-glob: 3.3.1 is-glob: 4.0.3 open: 9.1.0 @@ -6818,13 +7186,40 @@ packages: requiresBuild: true dependencies: '@types/estree': 1.0.1 - dev: true - optional: true /@types/babel__code-frame@7.0.4: resolution: {integrity: sha512-WBxINLlATjvmpCgBbb9tOPrKtcPfu4A/Yz2iRzmdaodfvjAS/Z0WZJClV9/EXvoC9viI3lgUs7B9Uo7G/RmMGg==} dev: true + /@types/babel__core@7.20.2: + resolution: {integrity: sha512-pNpr1T1xLUc2l3xJKuPtsEky3ybxN3m4fJkknfIpTCTfIZCDW57oAg+EfCgIIp2rvCe0Wn++/FfodDS4YXxBwA==} + dependencies: + '@babel/parser': 7.22.16 + '@babel/types': 7.22.19 + '@types/babel__generator': 7.6.5 + '@types/babel__template': 7.4.2 + '@types/babel__traverse': 7.20.2 + dev: false + + /@types/babel__generator@7.6.5: + resolution: {integrity: sha512-h9yIuWbJKdOPLJTbmSpPzkF67e659PbQDba7ifWm5BJ8xTv+sDmS7rFmywkWOvXedGTivCdeGSIIX8WLcRTz8w==} + dependencies: + '@babel/types': 7.22.19 + dev: false + + /@types/babel__template@7.4.2: + resolution: {integrity: sha512-/AVzPICMhMOMYoSx9MoKpGDKdBRsIXMNByh1PXSZoa+v6ZoLa8xxtsT/uLQ/NJm0XVAWl/BvId4MlDeXJaeIZQ==} + dependencies: + '@babel/parser': 7.22.16 + '@babel/types': 7.22.19 + dev: false + + /@types/babel__traverse@7.20.2: + resolution: {integrity: sha512-ojlGK1Hsfce93J0+kn3H5R73elidKUaZonirN33GSmgTUMpzI/MIFfSpF3haANe3G1bEBS9/9/QEqwTzwqFsKw==} + dependencies: + '@babel/types': 7.22.19 + dev: false + /@types/body-parser@1.19.3: resolution: {integrity: sha512-oyl4jvAfTGX9Bt6Or4H9ni1Z447/tQuxnZsytsCaExKlmJiU8sFgnIBRzJUpKwB5eWn9HuBYlUlVA74q/yN0eQ==} dependencies: @@ -6878,7 +7273,6 @@ packages: requiresBuild: true dependencies: '@types/ms': 0.7.31 - dev: true /@types/eslint-scope@3.7.4: resolution: {integrity: sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==} @@ -6897,8 +7291,6 @@ packages: requiresBuild: true dependencies: '@types/estree': 1.0.1 - dev: true - optional: true /@types/estree@1.0.1: resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} @@ -6972,11 +7364,25 @@ packages: /@types/json-schema@7.0.13: resolution: {integrity: sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==} + /@types/json5@0.0.30: + resolution: {integrity: sha512-sqm9g7mHlPY/43fcSNrCYfOeX9zkTTK+euO5E6+CVijSMm5tTjkVdwdqRkY3ljjIAf8679vps5jKUoJBCLsMDA==} + dev: false + /@types/mdast@3.0.12: resolution: {integrity: sha512-DT+iNIRNX884cx0/Q1ja7NyUPpZuv0KPyL5rGNxm1WC1OtHstl7n4Jb7nk+xacNShQMbczJjt8uFzznpp6kYBg==} dependencies: '@types/unist': 2.0.8 + /@types/mdast@4.0.1: + resolution: {integrity: sha512-IlKct1rUTJ1T81d8OHzyop15kGv9A/ff7Gz7IJgrk6jDb4Udw77pCJ+vq8oxZf4Ghpm+616+i1s/LNg/Vh7d+g==} + dependencies: + '@types/unist': 3.0.0 + dev: false + + /@types/mdx@2.0.8: + resolution: {integrity: sha512-r7/zWe+f9x+zjXqGxf821qz++ld8tp6Z4jUS6qmPZUXH6tfh4riXOhAqb12tWGWAevCFtMt1goLWkQMqIJKpsA==} + dev: false + /@types/micromatch@4.0.2: resolution: {integrity: sha512-oqXqVb0ci19GtH0vOA/U2TmHTcRY9kuZl4mqUxe0QmJAlIW13kzhuK5pi1i9+ngav8FjpSb9FVS/GE00GLX1VA==} dependencies: @@ -6998,12 +7404,17 @@ packages: /@types/ms@0.7.31: resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==} requiresBuild: true - dev: true /@types/mustache@4.2.2: resolution: {integrity: sha512-MUSpfpW0yZbTgjekDbH0shMYBUD+X/uJJJMm9LXN1d5yjl5lCY1vN/eWKD6D1tOtjA6206K0zcIPnUaFMurdNA==} dev: true + /@types/nlcst@1.0.2: + resolution: {integrity: sha512-ykxL/GDDUhqikjU0LIywZvEwb1NTYXTEWf+XgMSS2o6IXIakafPccxZmxgZcvJPZ3yFl2kdL1gJZz3U3iZF3QA==} + dependencies: + '@types/unist': 2.0.8 + dev: false + /@types/node@17.0.45: resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} dev: false @@ -7023,6 +7434,10 @@ packages: resolution: {integrity: sha512-kUNnecmtkunAoQ3CnjmMkzNU/gtxG8guhi+Fk2U/kOpIKjIMKnXGp4IJCgQJrXSgMsWYimYG4TGjz/UzbGEBTw==} dev: false + /@types/parse5@6.0.3: + resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} + dev: false + /@types/plist@3.0.2: resolution: {integrity: sha512-ULqvZNGMv0zRFvqn8/4LSPtnmN4MfhlPNtJCTpKuIIxGVGZ2rYWzFXrvEBoh9CVyqSE7D6YFRJ1hydLHI6kbWw==} dependencies: @@ -7159,6 +7574,10 @@ packages: /@types/unist@2.0.8: resolution: {integrity: sha512-d0XxK3YTObnWVp6rZuev3c49+j4Lo8g4L1ZRm9z5L0xpoZycUPshHgczK5gsUMaZOstjVYYi09p5gYvUtfChYw==} + /@types/unist@3.0.0: + resolution: {integrity: sha512-MFETx3tbTjE7Uk6vvnWINA/1iJ7LuMdO4fcq8UfF0pRbj01aGLduVvQcRyswuACJdpnHgg8E3rQLhaRdNEJS0w==} + dev: false + /@types/use-sync-external-store@0.0.3: resolution: {integrity: sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA==} dev: false @@ -7770,7 +8189,6 @@ packages: /ansi-sequence-parser@1.1.1: resolution: {integrity: sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==} - dev: true /ansi-styles@3.2.1: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} @@ -7825,6 +8243,10 @@ packages: resolution: {integrity: sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==} dev: false + /array-iterate@2.0.1: + resolution: {integrity: sha512-I1jXZMjAgCMmxT4qxXfPXa6SthSoE8h6gkSI9BGGNv8mP8G/v0blc+qFnZu6K42vTOiuME596QaLO0TP3Lk0xg==} + dev: false + /array-timsort@1.0.3: resolution: {integrity: sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==} dev: false @@ -7841,8 +8263,79 @@ packages: resolution: {integrity: sha512-ISvCdHdlTDlH5IpxQJIex7BWBywFWgjJSVdwst+/iQCoEYnyOaQ95+X1JGshuBjGp6nxKUy1jMgE3zPqN7fQdg==} hasBin: true requiresBuild: true - dev: true - optional: true + + /astro@3.2.3: + resolution: {integrity: sha512-1epnxQhTbfzgdmLP1yu51E8zjIOKYxZyA8hMTD4S2E+F5gMp/D81H4hekPbbq89GDxNJiHDRNZDHtS5vrU5E5w==} + engines: {node: '>=18.14.1', npm: '>=6.14.0'} + hasBin: true + dependencies: + '@astrojs/compiler': 2.2.0 + '@astrojs/internal-helpers': 0.2.1 + '@astrojs/markdown-remark': 3.2.1(astro@3.2.3) + '@astrojs/telemetry': 3.0.3 + '@babel/core': 7.22.20 + '@babel/generator': 7.22.15 + '@babel/parser': 7.22.16 + '@babel/plugin-transform-react-jsx': 7.22.15(@babel/core@7.22.20) + '@babel/traverse': 7.22.20 + '@babel/types': 7.22.19 + '@types/babel__core': 7.20.2 + acorn: 8.10.0 + boxen: 7.1.1 + chokidar: 3.5.3 + ci-info: 3.8.0 + clsx: 2.0.0 + common-ancestor-path: 1.0.1 + cookie: 0.5.0 + debug: 4.3.4(supports-color@8.1.1) + devalue: 4.3.2 + diff: 5.1.0 + es-module-lexer: 1.3.1 + esbuild: 0.19.4 + estree-walker: 3.0.3 + execa: 8.0.1 + fast-glob: 3.3.1 + github-slugger: 2.0.0 + gray-matter: 4.0.3 + html-escaper: 3.0.3 + http-cache-semantics: 4.1.1 + js-yaml: 4.1.0 + kleur: 4.1.5 + magic-string: 0.30.4 + mime: 3.0.0 + ora: 7.0.1 + p-limit: 4.0.0 + path-to-regexp: 6.2.1 + preferred-pm: 3.1.2 + probe-image-size: 7.2.3 + prompts: 2.4.2 + rehype: 12.0.1 + resolve: 1.22.6 + semver: 7.5.4 + server-destroy: 1.0.1 + shiki: 0.14.4 + string-width: 6.1.0 + strip-ansi: 7.1.0 + tsconfig-resolver: 3.0.1 + unist-util-visit: 4.1.2 + vfile: 5.3.7 + vite: 4.4.9(@types/node@18.11.9) + vitefu: 0.2.4(vite@4.4.9) + which-pm: 2.1.1 + yargs-parser: 21.1.1 + zod: 3.21.1 + optionalDependencies: + sharp: 0.32.6 + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: false /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} @@ -7906,6 +8399,10 @@ packages: typed-rest-client: 1.8.11 dev: true + /b4a@1.6.4: + resolution: {integrity: sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==} + dev: false + /babel-loader@8.3.0(@babel/core@7.22.20)(webpack@5.88.2): resolution: {integrity: sha512-H8SvsMF+m9t15HNLMipppzkC+Y2Yq+v3SonZyU70RBL/h1gxPkH08Ot8pEE9Z4Kd+czyWJClmFS8qzIP9OZ04Q==} engines: {node: '>= 8.9'} @@ -7992,6 +8489,10 @@ packages: resolution: {integrity: sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==} dev: false + /bail@2.0.2: + resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==} + dev: false + /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -8006,6 +8507,18 @@ packages: resolution: {integrity: sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==} dev: false + /bcp-47-match@2.0.3: + resolution: {integrity: sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==} + dev: false + + /bcp-47@2.1.0: + resolution: {integrity: sha512-9IIS3UPrvIa1Ej+lVDdDwO7zLehjqsaByECw0bu2RRGP73jALm6FYbzI5gWbgHLvNdkvfXB5YrSbocZdOS0c0w==} + dependencies: + is-alphabetical: 2.0.1 + is-alphanumerical: 2.0.1 + is-decimal: 2.0.1 + dev: false + /big-integer@1.6.51: resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==} engines: {node: '>=0.6'} @@ -8026,7 +8539,14 @@ packages: buffer: 5.7.1 inherits: 2.0.4 readable-stream: 3.6.2 - optional: true + + /bl@5.1.0: + resolution: {integrity: sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==} + dependencies: + buffer: 6.0.3 + inherits: 2.0.4 + readable-stream: 3.6.2 + dev: false /body-parser@1.20.1: resolution: {integrity: sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==} @@ -8141,7 +8661,6 @@ packages: dependencies: base64-js: 1.5.1 ieee754: 1.2.1 - optional: true /buffer@6.0.3: resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} @@ -8273,8 +8792,6 @@ packages: /ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} requiresBuild: true - dev: true - optional: true /chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} @@ -8316,8 +8833,6 @@ packages: /character-entities-html4@2.1.0: resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==} requiresBuild: true - dev: true - optional: true /character-entities-legacy@1.1.4: resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==} @@ -8326,8 +8841,6 @@ packages: /character-entities-legacy@3.0.0: resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==} requiresBuild: true - dev: true - optional: true /character-entities@1.2.4: resolution: {integrity: sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==} @@ -8336,7 +8849,6 @@ packages: /character-entities@2.0.2: resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==} requiresBuild: true - dev: true /character-reference-invalid@1.1.4: resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==} @@ -8345,8 +8857,6 @@ packages: /character-reference-invalid@2.0.1: resolution: {integrity: sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==} requiresBuild: true - dev: true - optional: true /charenc@0.0.2: resolution: {integrity: sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==} @@ -8391,7 +8901,6 @@ packages: /chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} requiresBuild: true - optional: true /chrome-trace-event@1.0.3: resolution: {integrity: sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==} @@ -8438,6 +8947,18 @@ packages: engines: {node: '>=10'} dev: false + /cli-cursor@4.0.0: + resolution: {integrity: sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + restore-cursor: 4.0.0 + dev: false + + /cli-spinners@2.9.1: + resolution: {integrity: sha512-jHgecW0pxkonBJdrKsqxgRX9AcG+u/5k0Q7WPDfi8AogLAdwxEkyYYNWwZ5GvVFoFx2uiY1eNcSK00fh+1+FyQ==} + engines: {node: '>=6'} + dev: false + /cli-table3@0.6.3: resolution: {integrity: sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==} engines: {node: 10.* || >= 12.*} @@ -8475,6 +8996,11 @@ packages: engines: {node: '>=6'} dev: false + /clsx@2.0.0: + resolution: {integrity: sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q==} + engines: {node: '>=6'} + dev: false + /collapse-white-space@1.0.6: resolution: {integrity: sha512-jEovNnrhMuqyCcjfEJA56v0Xq8SkIoPKDyaHahwo3POf4qcSXqMYuwNcOTzp74vTsR9Tn08z4MxWqAhcekogkQ==} dev: false @@ -8496,6 +9022,21 @@ packages: /color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + /color-string@1.9.1: + resolution: {integrity: sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==} + dependencies: + color-name: 1.1.4 + simple-swizzle: 0.2.2 + dev: false + + /color@4.2.3: + resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==} + engines: {node: '>=12.5.0'} + dependencies: + color-convert: 2.0.1 + color-string: 1.9.1 + dev: false + /colord@2.9.3: resolution: {integrity: sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==} dev: false @@ -8522,8 +9063,6 @@ packages: /comma-separated-tokens@2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} requiresBuild: true - dev: true - optional: true /command-line-args@5.2.1: resolution: {integrity: sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==} @@ -8582,6 +9121,10 @@ packages: repeat-string: 1.6.1 dev: false + /common-ancestor-path@1.0.1: + resolution: {integrity: sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==} + dev: false + /commondir@1.0.1: resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} @@ -9027,6 +9570,10 @@ packages: domutils: 3.1.0 nth-check: 2.1.1 + /css-selector-parser@1.4.1: + resolution: {integrity: sha512-HYPSb7y/Z7BNDCOrakL4raGO2zltZkbeXyAd6Tg9obzix6QhzxCotdBl6VT0Dv4vZfJGVz3WL/xaEI9Ly3ul0g==} + dev: false + /css-tree@1.1.3: resolution: {integrity: sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==} engines: {node: '>=8.0.0'} @@ -9452,6 +9999,12 @@ packages: ms: 2.0.0 dev: false + /debug@3.2.7: + resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} + dependencies: + ms: 2.1.3 + dev: false + /debug@4.3.4(supports-color@8.1.1): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -9478,7 +10031,6 @@ packages: requiresBuild: true dependencies: character-entities: 2.0.2 - dev: true /decompress-response@6.0.0: resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} @@ -9596,7 +10148,6 @@ packages: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} requiresBuild: true - dev: true /destroy@1.2.0: resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} @@ -9613,7 +10164,6 @@ packages: resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==} engines: {node: '>=8'} requiresBuild: true - optional: true /detect-node@2.1.0: resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} @@ -9638,6 +10188,10 @@ packages: - supports-color dev: false + /devalue@4.3.2: + resolution: {integrity: sha512-KqFl6pOgOW+Y6wJgu80rHpo2/3H07vr8ntR9rkkFIRETewbf5GaYYcakYfiKz89K+sLsuPkQIZaXDMjUObZwWg==} + dev: false + /devtools-protocol@0.0.1045489: resolution: {integrity: sha512-D+PTmWulkuQW4D1NTiCRCFxF7pQPn0hgp4YyX4wAQ6xYXKOadSWPR3ENGDQ47MW/Ewc9v2rpC/UEEGahgBYpSQ==} requiresBuild: true @@ -9652,7 +10206,6 @@ packages: /diff@5.1.0: resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==} engines: {node: '>=0.3.1'} - dev: true /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} @@ -9660,6 +10213,15 @@ packages: dependencies: path-type: 4.0.0 + /direction@2.0.1: + resolution: {integrity: sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA==} + hasBin: true + dev: false + + /dlv@1.1.3: + resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} + dev: false + /dns-equal@1.0.0: resolution: {integrity: sha512-z+paD6YUQsk+AbGCEM4PrOXSss5gd66QfcVBFTKR/HpFL9jCqikS94HYwKww6fQyO7IxrIIyUu+g0Ka9tUS2Cg==} dev: false @@ -9781,6 +10343,11 @@ packages: engines: {node: '>=4'} dev: false + /dset@3.1.2: + resolution: {integrity: sha512-g/M9sqy3oHe477Ar4voQxWtaPIFw1jTdKZuomOjhCcBx9nHUNn0pu6NopuFFrTh/TRZIKEj+76vLWFu9BNKk+Q==} + engines: {node: '>=4'} + dev: false + /duplexer@0.1.2: resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} dev: false @@ -9831,6 +10398,10 @@ packages: /elkjs@0.8.2: resolution: {integrity: sha512-L6uRgvZTH+4OF5NE/MBbzQx/WYpru1xCBE9respNj6qznEewGUIfhzmm7horWWxbNO2M0WckQypGctR8lH79xQ==} + /emoji-regex@10.2.1: + resolution: {integrity: sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==} + dev: false + /emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -9856,7 +10427,6 @@ packages: requiresBuild: true dependencies: once: 1.4.0 - optional: true /enhanced-resolve@5.15.0: resolution: {integrity: sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==} @@ -9914,7 +10484,36 @@ packages: '@esbuild/win32-arm64': 0.18.20 '@esbuild/win32-ia32': 0.18.20 '@esbuild/win32-x64': 0.18.20 - dev: true + + /esbuild@0.19.4: + resolution: {integrity: sha512-x7jL0tbRRpv4QUyuDMjONtWFciygUxWaUM1kMX2zWxI0X2YWOt7MSA0g4UdeSiHM8fcYVzpQhKYOycZwxTdZkA==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.19.4 + '@esbuild/android-arm64': 0.19.4 + '@esbuild/android-x64': 0.19.4 + '@esbuild/darwin-arm64': 0.19.4 + '@esbuild/darwin-x64': 0.19.4 + '@esbuild/freebsd-arm64': 0.19.4 + '@esbuild/freebsd-x64': 0.19.4 + '@esbuild/linux-arm': 0.19.4 + '@esbuild/linux-arm64': 0.19.4 + '@esbuild/linux-ia32': 0.19.4 + '@esbuild/linux-loong64': 0.19.4 + '@esbuild/linux-mips64el': 0.19.4 + '@esbuild/linux-ppc64': 0.19.4 + '@esbuild/linux-riscv64': 0.19.4 + '@esbuild/linux-s390x': 0.19.4 + '@esbuild/linux-x64': 0.19.4 + '@esbuild/netbsd-x64': 0.19.4 + '@esbuild/openbsd-x64': 0.19.4 + '@esbuild/sunos-x64': 0.19.4 + '@esbuild/win32-arm64': 0.19.4 + '@esbuild/win32-ia32': 0.19.4 + '@esbuild/win32-x64': 0.19.4 + dev: false /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} @@ -9936,6 +10535,11 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} + /escape-string-regexp@5.0.0: + resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} + engines: {node: '>=12'} + dev: false + /escodegen@2.1.0: resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==} engines: {node: '>=6.0'} @@ -10153,14 +10757,18 @@ packages: requiresBuild: true dependencies: '@types/estree': 1.0.1 - dev: true - optional: true + + /estree-util-build-jsx@2.2.2: + resolution: {integrity: sha512-m56vOXcOBuaF+Igpb9OPAy7f9w9OIkb5yhjsZuaPm7HoGi4oTOQi0h2+yZ+AtKklYFZ+rPC4n0wYCJCEU1ONqg==} + dependencies: + '@types/estree-jsx': 1.0.0 + estree-util-is-identifier-name: 2.1.0 + estree-walker: 3.0.3 + dev: false /estree-util-is-identifier-name@2.1.0: resolution: {integrity: sha512-bEN9VHRyXAUOjkKVQVvArFym08BTWB0aJPppZZr0UNyAqWsLaVfAqP7hbaTJjzHifmB5ebnR8Wm7r7yGN/HonQ==} requiresBuild: true - dev: true - optional: true /estree-util-to-js@1.2.0: resolution: {integrity: sha512-IzU74r1PK5IMMGZXUVZbmiu4A1uhiPgW5hm1GjcOfr4ZzHaMPpLNJjR7HjXiIOzi25nZDrgFTobHTkV5Q6ITjA==} @@ -10169,8 +10777,6 @@ packages: '@types/estree-jsx': 1.0.0 astring: 1.8.6 source-map: 0.7.4 - dev: true - optional: true /estree-util-visit@1.2.1: resolution: {integrity: sha512-xbgqcrkIVbIG+lI/gzbvd9SGTJL4zqJKBFttUl5pP27KhAjtMKbX/mQXJ7qgyXpMgVy/zvpm0xoQQaGL8OloOw==} @@ -10178,12 +10784,16 @@ packages: dependencies: '@types/estree-jsx': 1.0.0 '@types/unist': 2.0.8 - dev: true - optional: true /estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + /estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + dependencies: + '@types/estree': 1.0.1 + dev: false + /esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} @@ -10249,11 +10859,25 @@ packages: strip-final-newline: 3.0.0 dev: false + /execa@8.0.1: + resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} + engines: {node: '>=16.17'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 8.0.1 + human-signals: 5.0.0 + is-stream: 3.0.0 + merge-stream: 2.0.0 + npm-run-path: 5.1.0 + onetime: 6.0.0 + signal-exit: 4.1.0 + strip-final-newline: 3.0.0 + dev: false + /expand-template@2.0.3: resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==} engines: {node: '>=6'} requiresBuild: true - optional: true /express@4.18.2: resolution: {integrity: sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==} @@ -10330,6 +10954,10 @@ packages: resolution: {integrity: sha512-G3BSX9cfKttjr+2o1O22tYMLq0DPluZnYtq1rXumE1SpL/F/SLIfHx08WYQoWSIpeMYf8sRbJ8++71+v6Pnxfg==} dev: false + /fast-fifo@1.3.2: + resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==} + dev: false + /fast-glob@3.3.1: resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} engines: {node: '>=8.6.0'} @@ -10504,6 +11132,13 @@ packages: locate-path: 6.0.0 path-exists: 4.0.0 + /find-yarn-workspace-root2@1.2.16: + resolution: {integrity: sha512-hr6hb1w8ePMpPVUK39S4RlwJzi+xPLuVuG8XlwXU3KD5Yn3qgBWVfy3AzNlDhWvE1EORCE65/Qm26rFQt3VLVA==} + dependencies: + micromatch: 4.0.5 + pkg-dir: 4.2.0 + dev: false + /find-yarn-workspace-root@2.0.0: resolution: {integrity: sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==} dependencies: @@ -10638,7 +11273,6 @@ packages: /fs-constants@1.0.0: resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} requiresBuild: true - optional: true /fs-extra@10.1.0: resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} @@ -10728,15 +11362,23 @@ packages: engines: {node: '>=10'} dev: false + /get-stream@8.0.1: + resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} + engines: {node: '>=16'} + dev: false + /github-from-package@0.0.0: resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} requiresBuild: true - optional: true /github-slugger@1.5.0: resolution: {integrity: sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==} dev: false + /github-slugger@2.0.0: + resolution: {integrity: sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==} + dev: false + /glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -11015,8 +11657,10 @@ packages: vfile: 5.3.7 vfile-location: 4.1.0 web-namespaces: 2.0.1 - dev: true - optional: true + + /hast-util-has-property@2.0.1: + resolution: {integrity: sha512-X2+RwZIMTMKpXUzlotatPzWj8bspCymtXH3cfG3iQKV+wPF53Vgaqxi/eLqGck0wKq1kS9nvoB1wchbCPEL8sg==} + dev: false /hast-util-parse-selector@2.2.5: resolution: {integrity: sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ==} @@ -11027,8 +11671,6 @@ packages: requiresBuild: true dependencies: '@types/hast': 2.3.6 - dev: true - optional: true /hast-util-raw@6.0.1: resolution: {integrity: sha512-ZMuiYA+UF7BXBtsTBNcLBF5HzXzkyE6MLzJnL605LKE8GJylNjGc4jjxazAHUtcwT5/CEt6afRKViYB4X66dig==} @@ -11045,12 +11687,48 @@ packages: zwitch: 1.0.5 dev: false - /hast-util-to-estree@2.3.3: - resolution: {integrity: sha512-ihhPIUPxN0v0w6M5+IiAZZrn0LH2uZomeWwhn7uP7avZC6TE7lIiEh2yBMPr5+zi1aUCXq6VoYRgs2Bw9xmycQ==} - requiresBuild: true + /hast-util-raw@7.2.3: + resolution: {integrity: sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==} + dependencies: + '@types/hast': 2.3.6 + '@types/parse5': 6.0.3 + hast-util-from-parse5: 7.1.2 + hast-util-to-parse5: 7.1.0 + html-void-elements: 2.0.1 + parse5: 6.0.1 + unist-util-position: 4.0.4 + unist-util-visit: 4.1.2 + vfile: 5.3.7 + web-namespaces: 2.0.1 + zwitch: 2.0.4 + dev: false + + /hast-util-select@5.0.5: + resolution: {integrity: sha512-QQhWMhgTFRhCaQdgTKzZ5g31GLQ9qRb1hZtDPMqQaOhpLBziWcshUS0uCR5IJ0U1jrK/mxg35fmcq+Dp/Cy2Aw==} dependencies: - '@types/estree': 1.0.1 - '@types/estree-jsx': 1.0.0 + '@types/hast': 2.3.6 + '@types/unist': 2.0.8 + bcp-47-match: 2.0.3 + comma-separated-tokens: 2.0.3 + css-selector-parser: 1.4.1 + direction: 2.0.1 + hast-util-has-property: 2.0.1 + hast-util-to-string: 2.0.0 + hast-util-whitespace: 2.0.1 + not: 0.1.0 + nth-check: 2.1.1 + property-information: 6.3.0 + space-separated-tokens: 2.0.2 + unist-util-visit: 4.1.2 + zwitch: 2.0.4 + dev: false + + /hast-util-to-estree@2.3.3: + resolution: {integrity: sha512-ihhPIUPxN0v0w6M5+IiAZZrn0LH2uZomeWwhn7uP7avZC6TE7lIiEh2yBMPr5+zi1aUCXq6VoYRgs2Bw9xmycQ==} + requiresBuild: true + dependencies: + '@types/estree': 1.0.1 + '@types/estree-jsx': 1.0.0 '@types/hast': 2.3.6 '@types/unist': 2.0.8 comma-separated-tokens: 2.0.3 @@ -11066,8 +11744,22 @@ packages: zwitch: 2.0.4 transitivePeerDependencies: - supports-color - dev: true - optional: true + + /hast-util-to-html@8.0.4: + resolution: {integrity: sha512-4tpQTUOr9BMjtYyNlt0P50mH7xj0Ks2xpo8M943Vykljf99HW6EzulIoJP1N3eKOSScEHzyzi9dm7/cn0RfGwA==} + dependencies: + '@types/hast': 2.3.6 + '@types/unist': 2.0.8 + ccount: 2.0.1 + comma-separated-tokens: 2.0.3 + hast-util-raw: 7.2.3 + hast-util-whitespace: 2.0.1 + html-void-elements: 2.0.1 + property-information: 6.3.0 + space-separated-tokens: 2.0.2 + stringify-entities: 4.0.3 + zwitch: 2.0.4 + dev: false /hast-util-to-parse5@6.0.0: resolution: {integrity: sha512-Lu5m6Lgm/fWuz8eWnrKezHtVY83JeRGaNQ2kn9aJgqaxvVkFCZQBEhgodZUDUvoodgyROHDb3r5IxAEdl6suJQ==} @@ -11079,11 +11771,26 @@ packages: zwitch: 1.0.5 dev: false + /hast-util-to-parse5@7.1.0: + resolution: {integrity: sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==} + dependencies: + '@types/hast': 2.3.6 + comma-separated-tokens: 2.0.3 + property-information: 6.3.0 + space-separated-tokens: 2.0.2 + web-namespaces: 2.0.1 + zwitch: 2.0.4 + dev: false + + /hast-util-to-string@2.0.0: + resolution: {integrity: sha512-02AQ3vLhuH3FisaMM+i/9sm4OXGSq1UhOOCpTLLQtHdL3tZt7qil69r8M8iDkZYyC0HCFylcYoP+8IO7ddta1A==} + dependencies: + '@types/hast': 2.3.6 + dev: false + /hast-util-whitespace@2.0.1: resolution: {integrity: sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng==} requiresBuild: true - dev: true - optional: true /hastscript@6.0.0: resolution: {integrity: sha512-nDM6bvd7lIqDUiYEiu5Sl/+6ReP0BMk/2f4U/Rooccxkj0P5nm+acM5PrGJ/t5I8qPGiqZSE6hVAwZEdZIvP4w==} @@ -11104,8 +11811,6 @@ packages: hast-util-parse-selector: 3.1.1 property-information: 6.3.0 space-separated-tokens: 2.0.2 - dev: true - optional: true /he@1.2.0: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} @@ -11186,6 +11891,10 @@ packages: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} dev: true + /html-escaper@3.0.3: + resolution: {integrity: sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==} + dev: false + /html-minifier-terser@6.1.0: resolution: {integrity: sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw==} engines: {node: '>=12'} @@ -11209,6 +11918,10 @@ packages: resolution: {integrity: sha512-uE/TxKuyNIcx44cIWnjr/rfIATDH7ZaOMmstu0CwhFG1Dunhlp4OC6/NMbhiwoq5BpW0ubi303qnEk/PZj614w==} dev: false + /html-void-elements@2.0.1: + resolution: {integrity: sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==} + dev: false + /html-webpack-plugin@5.5.3(webpack@5.88.2): resolution: {integrity: sha512-6YrDKTuqaP/TquFH7h4srYWsZx+x6k6+FbsTm0ziCwGHDP78Unr1r9F/H4+sGmMbX08GQcJ+K64x55b+7VM/jg==} engines: {node: '>=10.13.0'} @@ -11342,6 +12055,11 @@ packages: engines: {node: '>=14.18.0'} dev: false + /human-signals@5.0.0: + resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} + engines: {node: '>=16.17.0'} + dev: false + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} @@ -11404,6 +12122,10 @@ packages: resolution: {integrity: sha512-f8KcQ1D80V7RnqVm+/lirO9zkOxjGxhaTC1IPrBGd3MEfNgmNG67tSUO9gTi2F3Blr2Az6g1vocaxzkVnWl9MA==} dev: false + /import-meta-resolve@3.0.0: + resolution: {integrity: sha512-4IwhLhNNA8yy445rPjD/lWh++7hMDOml2eHtd58eG7h+qK3EryMuuRbsHGPikCoAgIkkDnckKfWSk2iDla/ejg==} + dev: false + /imurmurhash@0.1.4: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} @@ -11477,8 +12199,6 @@ packages: /is-alphabetical@2.0.1: resolution: {integrity: sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==} requiresBuild: true - dev: true - optional: true /is-alphanumerical@1.0.4: resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==} @@ -11493,13 +12213,15 @@ packages: dependencies: is-alphabetical: 2.0.1 is-decimal: 2.0.1 - dev: true - optional: true /is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} dev: false + /is-arrayish@0.3.2: + resolution: {integrity: sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==} + dev: false + /is-binary-path@2.1.0: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} @@ -11539,8 +12261,6 @@ packages: /is-decimal@2.0.1: resolution: {integrity: sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==} requiresBuild: true - dev: true - optional: true /is-docker@2.2.1: resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} @@ -11579,8 +12299,6 @@ packages: /is-hexadecimal@2.0.1: resolution: {integrity: sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==} requiresBuild: true - dev: true - optional: true /is-inside-container@1.0.0: resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} @@ -11598,6 +12316,11 @@ packages: is-path-inside: 3.0.3 dev: false + /is-interactive@2.0.0: + resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} + engines: {node: '>=12'} + dev: false + /is-module@1.0.0: resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} @@ -11638,6 +12361,11 @@ packages: engines: {node: '>=10'} dev: false + /is-plain-obj@4.1.0: + resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} + engines: {node: '>=12'} + dev: false + /is-plain-object@2.0.4: resolution: {integrity: sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==} engines: {node: '>=0.10.0'} @@ -11658,6 +12386,12 @@ packages: dependencies: '@types/estree': 1.0.1 + /is-reference@3.0.2: + resolution: {integrity: sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==} + dependencies: + '@types/estree': 1.0.1 + dev: false + /is-regexp@1.0.0: resolution: {integrity: sha512-7zjFAPO4/gwyQAAgRRmqeEeyIICSdmCqa3tsVHMdBzaXXRiqopZL4Cyghg/XulGWrtABTpbnYYzzIRffLkP4oA==} engines: {node: '>=0.10.0'} @@ -11687,6 +12421,11 @@ packages: engines: {node: '>=10'} dev: true + /is-unicode-supported@1.3.0: + resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} + engines: {node: '>=12'} + dev: false + /is-whitespace-character@1.0.4: resolution: {integrity: sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==} dev: false @@ -11701,6 +12440,13 @@ packages: dependencies: is-docker: 2.2.1 + /is-wsl@3.1.0: + resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==} + engines: {node: '>=16'} + dependencies: + is-inside-container: 1.0.0 + dev: false + /is-yarn-global@0.4.1: resolution: {integrity: sha512-/kppl+R+LO5VmhYSEWARUFjodS25D68gvj8W7z0I7OWhUla5xWu8KL6CtB2V0R6yqhnRgbcaREMr4EEM6htLPQ==} engines: {node: '>=12'} @@ -11901,7 +12647,6 @@ packages: /jsonc-parser@3.2.0: resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} - dev: true /jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} @@ -11958,7 +12703,6 @@ packages: resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} engines: {node: '>=6'} requiresBuild: true - dev: true /latest-version@7.0.0: resolution: {integrity: sha512-KvNT4XqAMzdcL6ka6Tl3i2lYeFDgXNCuIX+xNx6ZMVR1dFq+idXd9FLKNMOIx0t9mJ9/HudyX4oZWXZQ0UJHeg==} @@ -12006,6 +12750,16 @@ packages: uc.micro: 1.0.6 dev: true + /load-yaml-file@0.2.0: + resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==} + engines: {node: '>=6'} + dependencies: + graceful-fs: 4.2.11 + js-yaml: 3.14.1 + pify: 4.0.1 + strip-bom: 3.0.0 + dev: false + /loader-runner@4.3.0: resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} engines: {node: '>=6.11.5'} @@ -12110,11 +12864,17 @@ packages: is-unicode-supported: 0.1.0 dev: true + /log-symbols@5.1.0: + resolution: {integrity: sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==} + engines: {node: '>=12'} + dependencies: + chalk: 5.3.0 + is-unicode-supported: 1.3.0 + dev: false + /longest-streak@3.1.0: resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==} requiresBuild: true - dev: true - optional: true /loose-envify@1.4.0: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} @@ -12172,6 +12932,13 @@ packages: dependencies: '@jridgewell/sourcemap-codec': 1.4.15 + /magic-string@0.30.4: + resolution: {integrity: sha512-Q/TKtsC5BPm0kGqgBIF9oXAs/xEf2vRKiIB4wCRQTJOQIByZ1d+NnUOotvJOvNpi5RNIgVOMC3pOuaP1ZTDlVg==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + dev: false + /make-dir@3.1.0: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} engines: {node: '>=8'} @@ -12190,6 +12957,11 @@ packages: resolution: {integrity: sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==} dev: false + /markdown-extensions@1.1.1: + resolution: {integrity: sha512-WWC0ZuMzCyDHYCasEGs4IPvLyTGftYwh6wIEOULOF0HXcqZlhwRzrK0w2VUlxWA98xnvb/jszw4ZSkJ6ADpM6Q==} + engines: {node: '>=0.10.0'} + dev: false + /markdown-it@12.3.2: resolution: {integrity: sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==} hasBin: true @@ -12201,6 +12973,10 @@ packages: uc.micro: 1.0.6 dev: true + /markdown-table@3.0.3: + resolution: {integrity: sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==} + dev: false + /marked@4.3.0: resolution: {integrity: sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==} engines: {node: '>= 12'} @@ -12235,6 +13011,45 @@ packages: unist-util-visit: 2.0.3 dev: false + /mdast-util-definitions@5.1.2: + resolution: {integrity: sha512-8SVPMuHqlPME/z3gqVwWY4zVXn8lqKv/pAhC57FuJ40ImXyBpmO5ukh98zB2v7Blql2FiHjHv9LVztSIqjY+MA==} + dependencies: + '@types/mdast': 3.0.12 + '@types/unist': 2.0.8 + unist-util-visit: 4.1.2 + dev: false + + /mdast-util-definitions@6.0.0: + resolution: {integrity: sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ==} + dependencies: + '@types/mdast': 4.0.1 + '@types/unist': 3.0.0 + unist-util-visit: 5.0.0 + dev: false + + /mdast-util-directive@2.2.4: + resolution: {integrity: sha512-sK3ojFP+jpj1n7Zo5ZKvoxP1MvLyzVG63+gm40Z/qI00avzdPCYxt7RBMgofwAva9gBjbDBWVRB/i+UD+fUCzQ==} + dependencies: + '@types/mdast': 3.0.12 + '@types/unist': 2.0.8 + mdast-util-from-markdown: 1.3.1 + mdast-util-to-markdown: 1.5.0 + parse-entities: 4.0.1 + stringify-entities: 4.0.3 + unist-util-visit-parents: 5.1.3 + transitivePeerDependencies: + - supports-color + dev: false + + /mdast-util-find-and-replace@2.2.2: + resolution: {integrity: sha512-MTtdFRz/eMDHXzeK6W3dO7mXUlF82Gom4y0oOgvHhh/HXZAGvIQDUvQ0SuUx+j2tv44b8xTHOm8K/9OoRFnXKw==} + dependencies: + '@types/mdast': 3.0.12 + escape-string-regexp: 5.0.0 + unist-util-is: 5.2.1 + unist-util-visit-parents: 5.1.3 + dev: false + /mdast-util-from-markdown@1.3.1: resolution: {integrity: sha512-4xTO/M8c82qBcnQc1tgpNtubGUW/Y1tBQ1B0i5CtSoelOLKFYlElIr3bvgREYYO5iRqbMY1YuqZng0GVOI8Qww==} dependencies: @@ -12252,7 +13067,62 @@ packages: uvu: 0.5.6 transitivePeerDependencies: - supports-color - dev: true + + /mdast-util-gfm-autolink-literal@1.0.3: + resolution: {integrity: sha512-My8KJ57FYEy2W2LyNom4n3E7hKTuQk/0SES0u16tjA9Z3oFkF4RrC/hPAPgjlSpezsOvI8ObcXcElo92wn5IGA==} + dependencies: + '@types/mdast': 3.0.12 + ccount: 2.0.1 + mdast-util-find-and-replace: 2.2.2 + micromark-util-character: 1.2.0 + dev: false + + /mdast-util-gfm-footnote@1.0.2: + resolution: {integrity: sha512-56D19KOGbE00uKVj3sgIykpwKL179QsVFwx/DCW0u/0+URsryacI4MAdNJl0dh+u2PSsD9FtxPFbHCzJ78qJFQ==} + dependencies: + '@types/mdast': 3.0.12 + mdast-util-to-markdown: 1.5.0 + micromark-util-normalize-identifier: 1.1.0 + dev: false + + /mdast-util-gfm-strikethrough@1.0.3: + resolution: {integrity: sha512-DAPhYzTYrRcXdMjUtUjKvW9z/FNAMTdU0ORyMcbmkwYNbKocDpdk+PX1L1dQgOID/+vVs1uBQ7ElrBQfZ0cuiQ==} + dependencies: + '@types/mdast': 3.0.12 + mdast-util-to-markdown: 1.5.0 + dev: false + + /mdast-util-gfm-table@1.0.7: + resolution: {integrity: sha512-jjcpmNnQvrmN5Vx7y7lEc2iIOEytYv7rTvu+MeyAsSHTASGCCRA79Igg2uKssgOs1i1po8s3plW0sTu1wkkLGg==} + dependencies: + '@types/mdast': 3.0.12 + markdown-table: 3.0.3 + mdast-util-from-markdown: 1.3.1 + mdast-util-to-markdown: 1.5.0 + transitivePeerDependencies: + - supports-color + dev: false + + /mdast-util-gfm-task-list-item@1.0.2: + resolution: {integrity: sha512-PFTA1gzfp1B1UaiJVyhJZA1rm0+Tzn690frc/L8vNX1Jop4STZgOE6bxUhnzdVSB+vm2GU1tIsuQcA9bxTQpMQ==} + dependencies: + '@types/mdast': 3.0.12 + mdast-util-to-markdown: 1.5.0 + dev: false + + /mdast-util-gfm@2.0.2: + resolution: {integrity: sha512-qvZ608nBppZ4icQlhQQIAdc6S3Ffj9RGmzwUKUWuEICFnd1LVkN3EktF7ZHAgfcEdvZB5owU9tQgt99e2TlLjg==} + dependencies: + mdast-util-from-markdown: 1.3.1 + mdast-util-gfm-autolink-literal: 1.0.3 + mdast-util-gfm-footnote: 1.0.2 + mdast-util-gfm-strikethrough: 1.0.3 + mdast-util-gfm-table: 1.0.7 + mdast-util-gfm-task-list-item: 1.0.2 + mdast-util-to-markdown: 1.5.0 + transitivePeerDependencies: + - supports-color + dev: false /mdast-util-mdx-expression@1.3.2: resolution: {integrity: sha512-xIPmR5ReJDu/DHH1OoIT1HkuybIfRGYRywC+gJtI7qHjCJp/M9jrmBEJW22O8lskDWm562BX2W8TiAwRTb0rKA==} @@ -12265,8 +13135,6 @@ packages: mdast-util-to-markdown: 1.5.0 transitivePeerDependencies: - supports-color - dev: true - optional: true /mdast-util-mdx-jsx@2.1.4: resolution: {integrity: sha512-DtMn9CmVhVzZx3f+optVDF8yFgQVt7FghCRNdlIaS3X5Bnym3hZwPbg/XW86vdpKjlc1PVj26SpnLGeJBXD3JA==} @@ -12286,8 +13154,6 @@ packages: vfile-message: 3.1.4 transitivePeerDependencies: - supports-color - dev: true - optional: true /mdast-util-mdx@2.0.1: resolution: {integrity: sha512-38w5y+r8nyKlGvNjSEqWrhG0w5PmnRA+wnBvm+ulYCct7nsGYhFVb0lljS9bQav4psDAS1eGkP2LMVcZBi/aqw==} @@ -12300,8 +13166,6 @@ packages: mdast-util-to-markdown: 1.5.0 transitivePeerDependencies: - supports-color - dev: true - optional: true /mdast-util-mdxjs-esm@1.3.1: resolution: {integrity: sha512-SXqglS0HrEvSdUEfoXFtcg7DRl7S2cwOXc7jkuusG472Mmjag34DUDeOJUZtl+BVnyeO1frIgVpHlNRWc2gk/w==} @@ -12314,8 +13178,6 @@ packages: mdast-util-to-markdown: 1.5.0 transitivePeerDependencies: - supports-color - dev: true - optional: true /mdast-util-phrasing@3.0.1: resolution: {integrity: sha512-WmI1gTXUBJo4/ZmSk79Wcb2HcjPJBzM1nlI/OUWA8yk2X9ik3ffNbBGsU+09BFmXaL1IBb9fiuvq6/KMiNycSg==} @@ -12323,8 +13185,6 @@ packages: dependencies: '@types/mdast': 3.0.12 unist-util-is: 5.2.1 - dev: true - optional: true /mdast-util-to-hast@10.0.1: resolution: {integrity: sha512-BW3LM9SEMnjf4HXXVApZMt8gLQWVNXc3jryK0nJu/rOXPOnlkUjmdkDlmxMirpbU9ILncGFIwLH/ubnWBbcdgA==} @@ -12339,6 +13199,19 @@ packages: unist-util-visit: 2.0.3 dev: false + /mdast-util-to-hast@12.3.0: + resolution: {integrity: sha512-pits93r8PhnIoU4Vy9bjW39M2jJ6/tdHyja9rrot9uujkN7UTU9SDnE6WNJz/IGyQk3XHX6yNNtrBH6cQzm8Hw==} + dependencies: + '@types/hast': 2.3.6 + '@types/mdast': 3.0.12 + mdast-util-definitions: 5.1.2 + micromark-util-sanitize-uri: 1.2.0 + trim-lines: 3.0.1 + unist-util-generated: 2.0.1 + unist-util-position: 4.0.4 + unist-util-visit: 4.1.2 + dev: false + /mdast-util-to-markdown@1.5.0: resolution: {integrity: sha512-bbv7TPv/WC49thZPg3jXuqzuvI45IL2EVAr/KxF0BSdHsU0ceFHOmwQn6evxAh1GaoK/6GQ1wp4R4oW2+LFL/A==} requiresBuild: true @@ -12351,8 +13224,6 @@ packages: micromark-util-decode-string: 1.1.0 unist-util-visit: 4.1.2 zwitch: 2.0.4 - dev: true - optional: true /mdast-util-to-string@2.0.0: resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} @@ -12363,7 +13234,6 @@ packages: requiresBuild: true dependencies: '@types/mdast': 3.0.12 - dev: true /mdn-data@2.0.14: resolution: {integrity: sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==} @@ -12494,7 +13364,90 @@ packages: micromark-util-symbol: 1.1.0 micromark-util-types: 1.1.0 uvu: 0.5.6 - dev: true + + /micromark-extension-directive@2.2.1: + resolution: {integrity: sha512-ZFKZkNaEqAP86IghX1X7sE8NNnx6kFNq9mSBRvEHjArutTCJZ3LYg6VH151lXVb1JHpmIcW/7rX25oMoIHuSug==} + dependencies: + micromark-factory-space: 1.1.0 + micromark-factory-whitespace: 1.1.0 + micromark-util-character: 1.2.0 + micromark-util-symbol: 1.1.0 + micromark-util-types: 1.1.0 + parse-entities: 4.0.1 + uvu: 0.5.6 + dev: false + + /micromark-extension-gfm-autolink-literal@1.0.5: + resolution: {integrity: sha512-z3wJSLrDf8kRDOh2qBtoTRD53vJ+CWIyo7uyZuxf/JAbNJjiHsOpG1y5wxk8drtv3ETAHutCu6N3thkOOgueWg==} + dependencies: + micromark-util-character: 1.2.0 + micromark-util-sanitize-uri: 1.2.0 + micromark-util-symbol: 1.1.0 + micromark-util-types: 1.1.0 + dev: false + + /micromark-extension-gfm-footnote@1.1.2: + resolution: {integrity: sha512-Yxn7z7SxgyGWRNa4wzf8AhYYWNrwl5q1Z8ii+CSTTIqVkmGZF1CElX2JI8g5yGoM3GAman9/PVCUFUSJ0kB/8Q==} + dependencies: + micromark-core-commonmark: 1.1.0 + micromark-factory-space: 1.1.0 + micromark-util-character: 1.2.0 + micromark-util-normalize-identifier: 1.1.0 + micromark-util-sanitize-uri: 1.2.0 + micromark-util-symbol: 1.1.0 + micromark-util-types: 1.1.0 + uvu: 0.5.6 + dev: false + + /micromark-extension-gfm-strikethrough@1.0.7: + resolution: {integrity: sha512-sX0FawVE1o3abGk3vRjOH50L5TTLr3b5XMqnP9YDRb34M0v5OoZhG+OHFz1OffZ9dlwgpTBKaT4XW/AsUVnSDw==} + dependencies: + micromark-util-chunked: 1.1.0 + micromark-util-classify-character: 1.1.0 + micromark-util-resolve-all: 1.1.0 + micromark-util-symbol: 1.1.0 + micromark-util-types: 1.1.0 + uvu: 0.5.6 + dev: false + + /micromark-extension-gfm-table@1.0.7: + resolution: {integrity: sha512-3ZORTHtcSnMQEKtAOsBQ9/oHp9096pI/UvdPtN7ehKvrmZZ2+bbWhi0ln+I9drmwXMt5boocn6OlwQzNXeVeqw==} + dependencies: + micromark-factory-space: 1.1.0 + micromark-util-character: 1.2.0 + micromark-util-symbol: 1.1.0 + micromark-util-types: 1.1.0 + uvu: 0.5.6 + dev: false + + /micromark-extension-gfm-tagfilter@1.0.2: + resolution: {integrity: sha512-5XWB9GbAUSHTn8VPU8/1DBXMuKYT5uOgEjJb8gN3mW0PNW5OPHpSdojoqf+iq1xo7vWzw/P8bAHY0n6ijpXF7g==} + dependencies: + micromark-util-types: 1.1.0 + dev: false + + /micromark-extension-gfm-task-list-item@1.0.5: + resolution: {integrity: sha512-RMFXl2uQ0pNQy6Lun2YBYT9g9INXtWJULgbt01D/x8/6yJ2qpKyzdZD3pi6UIkzF++Da49xAelVKUeUMqd5eIQ==} + dependencies: + micromark-factory-space: 1.1.0 + micromark-util-character: 1.2.0 + micromark-util-symbol: 1.1.0 + micromark-util-types: 1.1.0 + uvu: 0.5.6 + dev: false + + /micromark-extension-gfm@2.0.3: + resolution: {integrity: sha512-vb9OoHqrhCmbRidQv/2+Bc6pkP0FrtlhurxZofvOEy5o8RtuuvTq+RQ1Vw5ZDNrVraQZu3HixESqbG+0iKk/MQ==} + dependencies: + micromark-extension-gfm-autolink-literal: 1.0.5 + micromark-extension-gfm-footnote: 1.1.2 + micromark-extension-gfm-strikethrough: 1.0.7 + micromark-extension-gfm-table: 1.0.7 + micromark-extension-gfm-tagfilter: 1.0.2 + micromark-extension-gfm-task-list-item: 1.0.5 + micromark-util-combine-extensions: 1.1.0 + micromark-util-types: 1.1.0 + dev: false /micromark-extension-mdx-expression@1.0.8: resolution: {integrity: sha512-zZpeQtc5wfWKdzDsHRBY003H2Smg+PUi2REhqgIhdzAa5xonhP03FcXxqFSerFiNUr5AWmHpaNPQTBVOS4lrXw==} @@ -12508,8 +13461,6 @@ packages: micromark-util-symbol: 1.1.0 micromark-util-types: 1.1.0 uvu: 0.5.6 - dev: true - optional: true /micromark-extension-mdx-jsx@1.0.5: resolution: {integrity: sha512-gPH+9ZdmDflbu19Xkb8+gheqEDqkSpdCEubQyxuz/Hn8DOXiXvrXeikOoBA71+e8Pfi0/UYmU3wW3H58kr7akA==} @@ -12525,16 +13476,12 @@ packages: micromark-util-types: 1.1.0 uvu: 0.5.6 vfile-message: 3.1.4 - dev: true - optional: true /micromark-extension-mdx-md@1.0.1: resolution: {integrity: sha512-7MSuj2S7xjOQXAjjkbjBsHkMtb+mDGVW6uI2dBL9snOBCbZmoNgDAeZ0nSn9j3T42UE/g2xVNMn18PJxZvkBEA==} requiresBuild: true dependencies: micromark-util-types: 1.1.0 - dev: true - optional: true /micromark-extension-mdxjs-esm@1.0.5: resolution: {integrity: sha512-xNRBw4aoURcyz/S69B19WnZAkWJMxHMT5hE36GtDAyhoyn/8TuAeqjFJQlwk+MKQsUD7b3l7kFX+vlfVWgcX1w==} @@ -12549,8 +13496,6 @@ packages: unist-util-position-from-estree: 1.1.2 uvu: 0.5.6 vfile-message: 3.1.4 - dev: true - optional: true /micromark-extension-mdxjs@1.0.1: resolution: {integrity: sha512-7YA7hF6i5eKOfFUzZ+0z6avRG52GpWR8DL+kN47y3f2KhxbBZMhmxe7auOeaTBrW2DenbbZTf1ea9tA2hDpC2Q==} @@ -12564,8 +13509,6 @@ packages: micromark-extension-mdxjs-esm: 1.0.5 micromark-util-combine-extensions: 1.1.0 micromark-util-types: 1.1.0 - dev: true - optional: true /micromark-factory-destination@1.1.0: resolution: {integrity: sha512-XaNDROBgx9SgSChd69pjiGKbV+nfHGDPVYFs5dOoDd7ZnMAE+Cuu91BCpsY8RT2NP9vo/B8pds2VQNCLiu0zhg==} @@ -12574,7 +13517,6 @@ packages: micromark-util-character: 1.2.0 micromark-util-symbol: 1.1.0 micromark-util-types: 1.1.0 - dev: true /micromark-factory-label@1.1.0: resolution: {integrity: sha512-OLtyez4vZo/1NjxGhcpDSbHQ+m0IIGnT8BoPamh+7jVlzLJBH98zzuCoUeMxvM6WsNeh8wx8cKvqLiPHEACn0w==} @@ -12584,7 +13526,6 @@ packages: micromark-util-symbol: 1.1.0 micromark-util-types: 1.1.0 uvu: 0.5.6 - dev: true /micromark-factory-mdx-expression@1.0.9: resolution: {integrity: sha512-jGIWzSmNfdnkJq05c7b0+Wv0Kfz3NJ3N4cBjnbO4zjXIlxJr+f8lk+5ZmwFvqdAbUy2q6B5rCY//g0QAAaXDWA==} @@ -12598,8 +13539,6 @@ packages: unist-util-position-from-estree: 1.1.2 uvu: 0.5.6 vfile-message: 3.1.4 - dev: true - optional: true /micromark-factory-space@1.1.0: resolution: {integrity: sha512-cRzEj7c0OL4Mw2v6nwzttyOZe8XY/Z8G0rzmWQZTBi/jjwyw/U4uqKtUORXQrR5bAZZnbTI/feRV/R7hc4jQYQ==} @@ -12607,7 +13546,6 @@ packages: dependencies: micromark-util-character: 1.2.0 micromark-util-types: 1.1.0 - dev: true /micromark-factory-title@1.1.0: resolution: {integrity: sha512-J7n9R3vMmgjDOCY8NPw55jiyaQnH5kBdV2/UXCtZIpnHH3P6nHUKaH7XXEYuWwx/xUJcawa8plLBEjMPU24HzQ==} @@ -12617,7 +13555,6 @@ packages: micromark-util-character: 1.2.0 micromark-util-symbol: 1.1.0 micromark-util-types: 1.1.0 - dev: true /micromark-factory-whitespace@1.1.0: resolution: {integrity: sha512-v2WlmiymVSp5oMg+1Q0N1Lxmt6pMhIHD457whWM7/GUlEks1hI9xj5w3zbc4uuMKXGisksZk8DzP2UyGbGqNsQ==} @@ -12627,7 +13564,6 @@ packages: micromark-util-character: 1.2.0 micromark-util-symbol: 1.1.0 micromark-util-types: 1.1.0 - dev: true /micromark-util-character@1.2.0: resolution: {integrity: sha512-lXraTwcX3yH/vMDaFWCQJP1uIszLVebzUa3ZHdrgxr7KEU/9mL4mVgCpGbyhvNLNlauROiNUq7WN5u7ndbY6xg==} @@ -12635,14 +13571,12 @@ packages: dependencies: micromark-util-symbol: 1.1.0 micromark-util-types: 1.1.0 - dev: true /micromark-util-chunked@1.1.0: resolution: {integrity: sha512-Ye01HXpkZPNcV6FiyoW2fGZDUw4Yc7vT0E9Sad83+bEDiCJ1uXu0S3mr8WLpsz3HaG3x2q0HM6CTuPdcZcluFQ==} requiresBuild: true dependencies: micromark-util-symbol: 1.1.0 - dev: true /micromark-util-classify-character@1.1.0: resolution: {integrity: sha512-SL0wLxtKSnklKSUplok1WQFoGhUdWYKggKUiqhX+Swala+BtptGCu5iPRc+xvzJ4PXE/hwM3FNXsfEVgoZsWbw==} @@ -12651,7 +13585,6 @@ packages: micromark-util-character: 1.2.0 micromark-util-symbol: 1.1.0 micromark-util-types: 1.1.0 - dev: true /micromark-util-combine-extensions@1.1.0: resolution: {integrity: sha512-Q20sp4mfNf9yEqDL50WwuWZHUrCO4fEyeDCnMGmG5Pr0Cz15Uo7KBs6jq+dq0EgX4DPwwrh9m0X+zPV1ypFvUA==} @@ -12659,14 +13592,12 @@ packages: dependencies: micromark-util-chunked: 1.1.0 micromark-util-types: 1.1.0 - dev: true /micromark-util-decode-numeric-character-reference@1.1.0: resolution: {integrity: sha512-m9V0ExGv0jB1OT21mrWcuf4QhP46pH1KkfWy9ZEezqHKAxkj4mPCy3nIH1rkbdMlChLHX531eOrymlwyZIf2iw==} requiresBuild: true dependencies: micromark-util-symbol: 1.1.0 - dev: true /micromark-util-decode-string@1.1.0: resolution: {integrity: sha512-YphLGCK8gM1tG1bd54azwyrQRjCFcmgj2S2GoJDNnh4vYtnL38JS8M4gpxzOPNyHdNEpheyWXCTnnTDY3N+NVQ==} @@ -12676,12 +13607,10 @@ packages: micromark-util-character: 1.2.0 micromark-util-decode-numeric-character-reference: 1.1.0 micromark-util-symbol: 1.1.0 - dev: true /micromark-util-encode@1.1.0: resolution: {integrity: sha512-EuEzTWSTAj9PA5GOAs992GzNh2dGQO52UvAbtSOMvXTxv3Criqb6IOzJUBCmEqrrXSblJIJBbFFv6zPxpreiJw==} requiresBuild: true - dev: true /micromark-util-events-to-acorn@1.2.3: resolution: {integrity: sha512-ij4X7Wuc4fED6UoLWkmo0xJQhsktfNh1J0m8g4PbIMPlx+ek/4YdW5mvbye8z/aZvAPUoxgXHrwVlXAPKMRp1w==} @@ -12695,27 +13624,22 @@ packages: micromark-util-types: 1.1.0 uvu: 0.5.6 vfile-message: 3.1.4 - dev: true - optional: true /micromark-util-html-tag-name@1.2.0: resolution: {integrity: sha512-VTQzcuQgFUD7yYztuQFKXT49KghjtETQ+Wv/zUjGSGBioZnkA4P1XXZPT1FHeJA6RwRXSF47yvJ1tsJdoxwO+Q==} requiresBuild: true - dev: true /micromark-util-normalize-identifier@1.1.0: resolution: {integrity: sha512-N+w5vhqrBihhjdpM8+5Xsxy71QWqGn7HYNUvch71iV2PM7+E3uWGox1Qp90loa1ephtCxG2ftRV/Conitc6P2Q==} requiresBuild: true dependencies: micromark-util-symbol: 1.1.0 - dev: true /micromark-util-resolve-all@1.1.0: resolution: {integrity: sha512-b/G6BTMSg+bX+xVCshPTPyAu2tmA0E4X98NSR7eIbeC6ycCqCeE7wjfDIgzEbkzdEVJXRtOG4FbEm/uGbCRouA==} requiresBuild: true dependencies: micromark-util-types: 1.1.0 - dev: true /micromark-util-sanitize-uri@1.2.0: resolution: {integrity: sha512-QO4GXv0XZfWey4pYFndLUKEAktKkG5kZTdUNaTAkzbuJxn2tNBOr+QtxR2XpWaMhbImT2dPzyLrPXLlPhph34A==} @@ -12724,7 +13648,6 @@ packages: micromark-util-character: 1.2.0 micromark-util-encode: 1.1.0 micromark-util-symbol: 1.1.0 - dev: true /micromark-util-subtokenize@1.1.0: resolution: {integrity: sha512-kUQHyzRoxvZO2PuLzMt2P/dwVsTiivCK8icYTeR+3WgbuPqfHgPPy7nFKbeqRivBvn/3N3GBiNC+JRTMSxEC7A==} @@ -12734,17 +13657,14 @@ packages: micromark-util-symbol: 1.1.0 micromark-util-types: 1.1.0 uvu: 0.5.6 - dev: true /micromark-util-symbol@1.1.0: resolution: {integrity: sha512-uEjpEYY6KMs1g7QfJ2eX1SQEV+ZT4rUD3UcF6l57acZvLNK7PBZL+ty82Z1qhK1/yXIY4bdx04FKMgR0g4IAag==} requiresBuild: true - dev: true /micromark-util-types@1.1.0: resolution: {integrity: sha512-ukRBgie8TIAcacscVHSiddHjO4k/q3pnedmzMQ4iwDcK0FtFCohKOlFbaOL/mPgfnPsL3C1ZyxJa4sbWrBl3jg==} requiresBuild: true - dev: true /micromark@3.2.0: resolution: {integrity: sha512-uD66tJj54JLYq0De10AhWycZWGQNUvDI55xPgk2sQM5kn1JYlhbCMTtEeT27+vAhW2FBQxLlOmS3pmA7/2z4aA==} @@ -12769,7 +13689,6 @@ packages: uvu: 0.5.6 transitivePeerDependencies: - supports-color - dev: true /micromatch@4.0.5: resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} @@ -12805,6 +13724,12 @@ packages: engines: {node: '>=4'} hasBin: true + /mime@3.0.0: + resolution: {integrity: sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==} + engines: {node: '>=10.0.0'} + hasBin: true + dev: false + /mimic-fn@2.1.0: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} @@ -12894,7 +13819,6 @@ packages: /mkdirp-classic@0.5.3: resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} requiresBuild: true - optional: true /mkdirp@1.0.4: resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} @@ -12972,7 +13896,6 @@ packages: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} requiresBuild: true - dev: true /mrmime@1.0.1: resolution: {integrity: sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==} @@ -13026,7 +13949,6 @@ packages: /napi-build-utils@1.0.2: resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==} requiresBuild: true - optional: true /natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} @@ -13035,6 +13957,16 @@ packages: /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + /needle@2.9.1: + resolution: {integrity: sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ==} + engines: {node: '>= 4.4.x'} + hasBin: true + dependencies: + debug: 3.2.7 + iconv-lite: 0.4.24 + sax: 1.2.4 + dev: false + /negotiator@0.6.3: resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} engines: {node: '>= 0.6'} @@ -13053,6 +13985,12 @@ packages: path-to-regexp: 1.8.0 dev: true + /nlcst-to-string@3.1.1: + resolution: {integrity: sha512-63mVyqaqt0cmn2VcI2aH6kxe1rLAmSROqHMA0i4qqg1tidkfExgpb0FGMikMCn86mw5dFtBtEANfmSSK7TjNHw==} + dependencies: + '@types/nlcst': 1.0.2 + dev: false + /no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} dependencies: @@ -13066,7 +14004,6 @@ packages: requiresBuild: true dependencies: semver: 7.5.4 - optional: true /node-abort-controller@3.1.1: resolution: {integrity: sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==} @@ -13078,6 +14015,10 @@ packages: dev: true optional: true + /node-addon-api@6.1.0: + resolution: {integrity: sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==} + dev: false + /node-domexception@1.0.0: resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} engines: {node: '>=10.5.0'} @@ -13176,6 +14117,10 @@ packages: engines: {node: '>=14.16'} dev: false + /not@0.1.0: + resolution: {integrity: sha512-5PDmaAsVfnWUgTUbJ3ERwn7u79Z0dYxN9ErxCpVJJqe2RK0PJ3z+iFUxuqjwtlDDegXvtWoxD/3Fzxox7tFGWA==} + dev: false + /npm-run-path@4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -13308,6 +14253,21 @@ packages: prelude-ls: 1.2.1 type-check: 0.4.0 + /ora@7.0.1: + resolution: {integrity: sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==} + engines: {node: '>=16'} + dependencies: + chalk: 5.3.0 + cli-cursor: 4.0.0 + cli-spinners: 2.9.1 + is-interactive: 2.0.0 + is-unicode-supported: 1.3.0 + log-symbols: 5.1.0 + stdin-discarder: 0.1.0 + string-width: 6.1.0 + strip-ansi: 7.1.0 + dev: false + /os-tmpdir@1.0.2: resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} engines: {node: '>=0.10.0'} @@ -13331,6 +14291,13 @@ packages: dependencies: yocto-queue: 0.1.0 + /p-limit@4.0.0: + resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + yocto-queue: 1.0.0 + dev: false + /p-locate@3.0.0: resolution: {integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==} engines: {node: '>=6'} @@ -13381,6 +14348,17 @@ packages: semver: 7.5.4 dev: false + /pagefind@1.0.3: + resolution: {integrity: sha512-ws7kmMxW6OuxzsOjj3YAx6TYq/54MiE3wfyBM3J5CInbZyBBvM2Z8c8IYvnMkBcb5v2EoB9DewXEekOEiDRu5g==} + hasBin: true + optionalDependencies: + '@pagefind/darwin-arm64': 1.0.3 + '@pagefind/darwin-x64': 1.0.3 + '@pagefind/linux-arm64': 1.0.3 + '@pagefind/linux-x64': 1.0.3 + '@pagefind/windows-x64': 1.0.3 + dev: false + /param-case@3.0.4: resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==} dependencies: @@ -13424,8 +14402,6 @@ packages: is-alphanumerical: 2.0.1 is-decimal: 2.0.1 is-hexadecimal: 2.0.1 - dev: true - optional: true /parse-json@5.2.0: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} @@ -13437,6 +14413,14 @@ packages: lines-and-columns: 1.2.4 dev: false + /parse-latin@5.0.1: + resolution: {integrity: sha512-b/K8ExXaWC9t34kKeDV8kGXBkXZ1HCSAZRYE7HR14eA1GlXX5L8iWhs8USJNhQU9q5ci413jCKF0gOyovvyRBg==} + dependencies: + nlcst-to-string: 3.1.1 + unist-util-modify-children: 3.1.1 + unist-util-visit-children: 2.0.2 + dev: false + /parse-numeric-range@1.3.0: resolution: {integrity: sha512-twN+njEipszzlMJd4ONUYgSfZPDxgHhT9Ahed5uTigpQn90FggW4SA/AIPq/6a149fTbE9qBEcSwE3FAEp6wQQ==} dev: false @@ -13552,6 +14536,10 @@ packages: resolution: {integrity: sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==} dev: false + /path-to-regexp@6.2.1: + resolution: {integrity: sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==} + dev: false + /path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} @@ -13560,6 +14548,14 @@ packages: resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} dev: true + /periscopic@3.1.0: + resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} + dependencies: + '@types/estree': 1.0.1 + estree-walker: 3.0.3 + is-reference: 3.0.2 + dev: false + /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} @@ -13567,6 +14563,11 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + /pify@4.0.1: + resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} + engines: {node: '>=6'} + dev: false + /pkg-dir@4.2.0: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} @@ -14037,7 +15038,16 @@ packages: simple-get: 4.0.1 tar-fs: 2.1.1 tunnel-agent: 0.6.0 - optional: true + + /preferred-pm@3.1.2: + resolution: {integrity: sha512-nk7dKrcW8hfCZ4H6klWcdRknBOXWzNQByJ0oJyX97BOupsYD+FzLS4hflgEu/uPUEHZCuRfMxzCBsuWd7OzT8Q==} + engines: {node: '>=10'} + dependencies: + find-up: 5.0.0 + find-yarn-workspace-root2: 1.2.16 + path-exists: 4.0.0 + which-pm: 2.0.0 + dev: false /prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} @@ -14142,6 +15152,14 @@ packages: engines: {node: '>=6'} dev: false + /probe-image-size@7.2.3: + resolution: {integrity: sha512-HubhG4Rb2UH8YtV4ba0Vp5bQ7L78RTONYu/ujmCu5nBI8wGv24s4E9xSKBi0N1MowRpxk76pFCpJtW0KPzOK0w==} + dependencies: + lodash.merge: 4.6.2 + needle: 2.9.1 + stream-parser: 0.3.1 + dev: false + /process-nextick-args@2.0.1: resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} dev: false @@ -14192,8 +15210,6 @@ packages: /property-information@6.3.0: resolution: {integrity: sha512-gVNZ74nqhRMiIUYWGQdosYetaKc83x8oT41a0LlV3AAFCAZwCpg4vmGkq8t34+cUhp3cnM4XDiU/7xlgK7HGrg==} requiresBuild: true - dev: true - optional: true /proto-list@1.2.4: resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==} @@ -14221,7 +15237,6 @@ packages: dependencies: end-of-stream: 1.4.4 once: 1.4.0 - optional: true /punycode@1.4.1: resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==} @@ -14302,6 +15317,10 @@ packages: /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + /queue-tick@1.0.1: + resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} + dev: false + /queue@6.0.2: resolution: {integrity: sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==} dependencies: @@ -14856,11 +15875,56 @@ packages: jsesc: 0.5.0 dev: false + /rehype-parse@8.0.5: + resolution: {integrity: sha512-Ds3RglaY/+clEX2U2mHflt7NlMA72KspZ0JLUJgBBLpRddBcEw3H8uYZQliQriku22NZpYMfjDdSgHcjxue24A==} + dependencies: + '@types/hast': 2.3.6 + hast-util-from-parse5: 7.1.2 + parse5: 6.0.1 + unified: 10.1.2 + dev: false + + /rehype-raw@6.1.1: + resolution: {integrity: sha512-d6AKtisSRtDRX4aSPsJGTfnzrX2ZkHQLE5kiUuGOeEoLpbEulFF4hj0mLPbsa+7vmguDKOVVEQdHKDSwoaIDsQ==} + dependencies: + '@types/hast': 2.3.6 + hast-util-raw: 7.2.3 + unified: 10.1.2 + dev: false + + /rehype-stringify@9.0.4: + resolution: {integrity: sha512-Uk5xu1YKdqobe5XpSskwPvo1XeHUUucWEQSl8hTrXt5selvca1e8K1EZ37E6YoZ4BT8BCqCdVfQW7OfHfthtVQ==} + dependencies: + '@types/hast': 2.3.6 + hast-util-to-html: 8.0.4 + unified: 10.1.2 + dev: false + + /rehype@12.0.1: + resolution: {integrity: sha512-ey6kAqwLM3X6QnMDILJthGvG1m1ULROS9NT4uG9IDCuv08SFyLlreSuvOa//DgEvbXx62DS6elGVqusWhRUbgw==} + dependencies: + '@types/hast': 2.3.6 + rehype-parse: 8.0.5 + rehype-stringify: 9.0.4 + unified: 10.1.2 + dev: false + /relateurl@0.2.7: resolution: {integrity: sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==} engines: {node: '>= 0.10'} dev: false + /remark-directive@2.0.1: + resolution: {integrity: sha512-oosbsUAkU/qmUE78anLaJePnPis4ihsE7Agp0T/oqTzvTea8pOiaYEtfInU/+xMOVTS9PN5AhGOiaIVe4GD8gw==} + dependencies: + '@types/mdast': 3.0.12 + mdast-util-directive: 2.2.4 + micromark-extension-directive: 2.2.1 + unified: 10.1.2 + transitivePeerDependencies: + - supports-color + dev: false + /remark-emoji@2.2.0: resolution: {integrity: sha512-P3cj9s5ggsUvWw5fS2uzCHJMGuXYRb0NnZqYlNecewXt8QBU9n5vW3DUUKOhepS8F9CwdMx9B8a3i7pqFWAI5w==} dependencies: @@ -14873,6 +15937,17 @@ packages: resolution: {integrity: sha512-3Clt8ZMH75Ayjp9q4CorNeyjwIxHFcTkaektplKGl2A1jNGEUey8cKL0ZC5vJwfcD5GFGsNLImLG/NGzWIzoMQ==} dev: false + /remark-gfm@3.0.1: + resolution: {integrity: sha512-lEFDoi2PICJyNrACFOfDD3JlLkuSbOa5Wd8EPt06HUdptv8Gn0bxYTdbU/XXQ3swAPkEaGxxPN9cbnMHvVu1Ig==} + dependencies: + '@types/mdast': 3.0.12 + mdast-util-gfm: 2.0.2 + micromark-extension-gfm: 2.0.3 + unified: 10.1.2 + transitivePeerDependencies: + - supports-color + dev: false + /remark-mdx@1.6.22: resolution: {integrity: sha512-phMHBJgeV76uyFkH4rvzCftLfKCr2RZuF+/gmVcaKrpsihyzmhXjA0BEMDaPTXG5y8qZOKPVo83NAOX01LPnOQ==} dependencies: @@ -14888,6 +15963,25 @@ packages: - supports-color dev: false + /remark-mdx@2.3.0: + resolution: {integrity: sha512-g53hMkpM0I98MU266IzDFMrTD980gNF3BJnkyFcmN+dD873mQeD5rdMO3Y2X+x8umQfbSE0PcoEDl7ledSA+2g==} + dependencies: + mdast-util-mdx: 2.0.1 + micromark-extension-mdxjs: 1.0.1 + transitivePeerDependencies: + - supports-color + dev: false + + /remark-parse@10.0.2: + resolution: {integrity: sha512-3ydxgHa/ZQzG8LvC7jTXccARYDcRld3VfcgIIFs7bI6vbRSxJJmzgLEIIoYKyrfhaY+ujuWaf/PJiMZXoiCXgw==} + dependencies: + '@types/mdast': 3.0.12 + mdast-util-from-markdown: 1.3.1 + unified: 10.1.2 + transitivePeerDependencies: + - supports-color + dev: false + /remark-parse@8.0.3: resolution: {integrity: sha512-E1K9+QLGgggHxCQtLt++uXltxEprmWzNfg+MxpfHsZlrddKzZ/hZyWHDbK3/Ap8HJQqYJRXP+jHczdL6q6i85Q==} dependencies: @@ -14909,6 +16003,24 @@ packages: xtend: 4.0.2 dev: false + /remark-rehype@10.1.0: + resolution: {integrity: sha512-EFmR5zppdBp0WQeDVZ/b66CWJipB2q2VLNFMabzDSGR66Z2fQii83G5gTBbgGEnEEA0QRussvrFHxk1HWGJskw==} + dependencies: + '@types/hast': 2.3.6 + '@types/mdast': 3.0.12 + mdast-util-to-hast: 12.3.0 + unified: 10.1.2 + dev: false + + /remark-smartypants@2.0.0: + resolution: {integrity: sha512-Rc0VDmr/yhnMQIz8n2ACYXlfw/P/XZev884QU1I5u+5DgJls32o97Vc1RbK3pfumLsJomS2yy8eT4Fxj/2MDVA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + retext: 8.1.0 + retext-smartypants: 5.2.0 + unist-util-visit: 4.1.2 + dev: false + /remark-squeeze-paragraphs@4.0.0: resolution: {integrity: sha512-8qRqmL9F4nuLPIgl92XUuxI3pFxize+F1H0e/W3llTk0UsjJaj01+RrirkMw7P21RKe4X6goQhYRSvNWX+70Rw==} dependencies: @@ -14997,11 +16109,54 @@ packages: lowercase-keys: 3.0.0 dev: false + /restore-cursor@4.0.0: + resolution: {integrity: sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + onetime: 5.1.2 + signal-exit: 3.0.7 + dev: false + /ret@0.2.2: resolution: {integrity: sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==} engines: {node: '>=4'} dev: false + /retext-latin@3.1.0: + resolution: {integrity: sha512-5MrD1tuebzO8ppsja5eEu+ZbBeUNCjoEarn70tkXOS7Bdsdf6tNahsv2bY0Z8VooFF6cw7/6S+d3yI/TMlMVVQ==} + dependencies: + '@types/nlcst': 1.0.2 + parse-latin: 5.0.1 + unherit: 3.0.1 + unified: 10.1.2 + dev: false + + /retext-smartypants@5.2.0: + resolution: {integrity: sha512-Do8oM+SsjrbzT2UNIKgheP0hgUQTDDQYyZaIY3kfq0pdFzoPk+ZClYJ+OERNXveog4xf1pZL4PfRxNoVL7a/jw==} + dependencies: + '@types/nlcst': 1.0.2 + nlcst-to-string: 3.1.1 + unified: 10.1.2 + unist-util-visit: 4.1.2 + dev: false + + /retext-stringify@3.1.0: + resolution: {integrity: sha512-767TLOaoXFXyOnjx/EggXlb37ZD2u4P1n0GJqVdpipqACsQP+20W+BNpMYrlJkq7hxffnFk+jc6mAK9qrbuB8w==} + dependencies: + '@types/nlcst': 1.0.2 + nlcst-to-string: 3.1.1 + unified: 10.1.2 + dev: false + + /retext@8.1.0: + resolution: {integrity: sha512-N9/Kq7YTn6ZpzfiGW45WfEGJqFf1IM1q8OsRa1CGzIebCJBNCANDRmOrholiDRGKo/We7ofKR4SEvcGAWEMD3Q==} + dependencies: + '@types/nlcst': 1.0.2 + retext-latin: 3.1.0 + retext-stringify: 3.1.0 + unified: 10.1.2 + dev: false + /retry@0.13.1: resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==} engines: {node: '>= 4'} @@ -15105,7 +16260,6 @@ packages: requiresBuild: true dependencies: mri: 1.2.0 - dev: true /safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} @@ -15307,6 +16461,10 @@ packages: send: 0.18.0 dev: false + /server-destroy@1.0.1: + resolution: {integrity: sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ==} + dev: false + /setimmediate@1.0.5: resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==} dev: false @@ -15336,6 +16494,21 @@ packages: /shallowequal@1.1.0: resolution: {integrity: sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==} + /sharp@0.32.6: + resolution: {integrity: sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w==} + engines: {node: '>=14.15.0'} + requiresBuild: true + dependencies: + color: 4.2.3 + detect-libc: 2.0.2 + node-addon-api: 6.1.0 + prebuild-install: 7.1.1 + semver: 7.5.4 + simple-get: 4.0.1 + tar-fs: 3.0.4 + tunnel-agent: 0.6.0 + dev: false + /shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -15367,7 +16540,6 @@ packages: jsonc-parser: 3.2.0 vscode-oniguruma: 1.7.0 vscode-textmate: 8.0.0 - dev: true /short-unique-id@5.0.3: resolution: {integrity: sha512-yhniEILouC0s4lpH0h7rJsfylZdca10W9mDJRAFh3EpcSUanCHGb0R7kcFOIUCZYSAPo0PUD5ZxWQdW0T4xaug==} @@ -15387,12 +16559,10 @@ packages: /signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - dev: true /simple-concat@1.0.1: resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} requiresBuild: true - optional: true /simple-get@4.0.1: resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==} @@ -15401,7 +16571,12 @@ packages: decompress-response: 6.0.0 once: 1.4.0 simple-concat: 1.0.1 - optional: true + + /simple-swizzle@0.2.2: + resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==} + dependencies: + is-arrayish: 0.3.2 + dev: false /sinon@16.0.0: resolution: {integrity: sha512-B8AaZZm9CT5pqe4l4uWJztfD/mOTa7dL8Qo0W4+s+t74xECOgSZDDQCBjNgIK3+n4kyxQrSTv2V5ul8K25qkiQ==} @@ -15494,7 +16669,6 @@ packages: /source-map@0.7.4: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} engines: {node: '>= 8'} - dev: true /space-separated-tokens@1.1.5: resolution: {integrity: sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA==} @@ -15503,8 +16677,6 @@ packages: /space-separated-tokens@2.0.2: resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==} requiresBuild: true - dev: true - optional: true /spdx-correct@3.2.0: resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} @@ -15584,11 +16756,31 @@ packages: resolution: {integrity: sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==} dev: false + /stdin-discarder@0.1.0: + resolution: {integrity: sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + bl: 5.1.0 + dev: false + + /stream-parser@0.3.1: + resolution: {integrity: sha512-bJ/HgKq41nlKvlhccD5kaCr/P+Hu0wPNKPJOH7en+YrJu/9EgqUF+88w5Jb6KNcjOFMhfX4B2asfeAtIGuHObQ==} + dependencies: + debug: 2.6.9 + dev: false + /streamsearch@1.1.0: resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} engines: {node: '>=10.0.0'} dev: false + /streamx@2.15.1: + resolution: {integrity: sha512-fQMzy2O/Q47rgwErk/eGeLu/roaFWV0jVsogDmrszM9uIw8L5OA+t+V93MgYlufNptfjmYR1tOMWhei/Eh7TQA==} + dependencies: + fast-fifo: 1.3.2 + queue-tick: 1.0.1 + dev: false + /string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -15605,6 +16797,15 @@ packages: emoji-regex: 9.2.2 strip-ansi: 7.1.0 + /string-width@6.1.0: + resolution: {integrity: sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==} + engines: {node: '>=16'} + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 10.2.1 + strip-ansi: 7.1.0 + dev: false + /string_decoder@1.1.1: resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} dependencies: @@ -15622,8 +16823,6 @@ packages: dependencies: character-entities-html4: 2.1.0 character-entities-legacy: 3.0.0 - dev: true - optional: true /stringify-object@3.3.0: resolution: {integrity: sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==} @@ -15651,6 +16850,16 @@ packages: engines: {node: '>=0.10.0'} dev: false + /strip-bom@3.0.0: + resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} + engines: {node: '>=4'} + dev: false + + /strip-bom@4.0.0: + resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} + engines: {node: '>=8'} + dev: false + /strip-final-newline@2.0.0: resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} engines: {node: '>=6'} @@ -15693,8 +16902,6 @@ packages: requiresBuild: true dependencies: inline-style-parser: 0.1.1 - dev: true - optional: true /stylehacks@5.1.1(postcss@8.4.30): resolution: {integrity: sha512-sBpcd5Hx7G6seo7b1LkpttvTz7ikD0LlH5RmdcBNb6fFR0Fl7LQwHDFr300q4cwUqi+IYrFGmsIHieMBfnN/Bw==} @@ -15881,7 +17088,14 @@ packages: mkdirp-classic: 0.5.3 pump: 3.0.0 tar-stream: 2.2.0 - optional: true + + /tar-fs@3.0.4: + resolution: {integrity: sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==} + dependencies: + mkdirp-classic: 0.5.3 + pump: 3.0.0 + tar-stream: 3.1.6 + dev: false /tar-stream@2.2.0: resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==} @@ -15893,7 +17107,14 @@ packages: fs-constants: 1.0.0 inherits: 2.0.4 readable-stream: 3.6.2 - optional: true + + /tar-stream@3.1.6: + resolution: {integrity: sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==} + dependencies: + b4a: 1.6.4 + fast-fifo: 1.3.2 + streamx: 2.15.1 + dev: false /terser-webpack-plugin@5.3.9(@swc/core@1.3.62)(webpack@5.88.2): resolution: {integrity: sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==} @@ -16051,6 +17272,10 @@ packages: dev: false optional: true + /trim-lines@3.0.1: + resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} + dev: false + /trim-trailing-lines@1.1.4: resolution: {integrity: sha512-rjUWSqnfTNrjbB9NQWfPMH/xRK1deHeGsHoVfpxJ++XeYXE0d6B1En37AHfw3jtfTU7dzMzZL2jjpe8Qb5gLIQ==} dev: false @@ -16064,6 +17289,10 @@ packages: resolution: {integrity: sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==} dev: false + /trough@2.1.0: + resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==} + dev: false + /ts-api-utils@1.0.3(typescript@5.2.2): resolution: {integrity: sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==} engines: {node: '>=16.13.0'} @@ -16080,6 +17309,17 @@ packages: resolution: {integrity: sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==} dev: false + /tsconfig-resolver@3.0.1: + resolution: {integrity: sha512-ZHqlstlQF449v8glscGRXzL6l2dZvASPCdXJRWG4gHEZlUVx2Jtmr+a2zeVG4LCsKhDXKRj5R3h0C/98UcVAQg==} + dependencies: + '@types/json5': 0.0.30 + '@types/resolve': 1.20.2 + json5: 2.2.3 + resolve: 1.22.6 + strip-bom: 4.0.0 + type-fest: 0.13.1 + dev: false + /tslib@1.14.1: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: false @@ -16102,7 +17342,6 @@ packages: requiresBuild: true dependencies: safe-buffer: 5.2.1 - optional: true /tunnel@0.0.6: resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} @@ -16120,6 +17359,11 @@ packages: engines: {node: '>=4'} dev: true + /type-fest@0.13.1: + resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} + engines: {node: '>=10'} + dev: false + /type-fest@0.20.2: resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} engines: {node: '>=10'} @@ -16244,6 +17488,10 @@ packages: xtend: 4.0.2 dev: false + /unherit@3.0.1: + resolution: {integrity: sha512-akOOQ/Yln8a2sgcLj4U0Jmx0R5jpIg2IUyRrWOzmEbjBtGzBdHtSeFKgoEcoH4KYIG/Pb8GQ/BwtYm0GCq1Sqg==} + dev: false + /unicode-canonical-property-names-ecmascript@2.0.0: resolution: {integrity: sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==} engines: {node: '>=4'} @@ -16267,6 +17515,18 @@ packages: engines: {node: '>=4'} dev: false + /unified@10.1.2: + resolution: {integrity: sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==} + dependencies: + '@types/unist': 2.0.8 + bail: 2.0.2 + extend: 3.0.2 + is-buffer: 2.0.5 + is-plain-obj: 4.1.0 + trough: 2.1.0 + vfile: 5.3.7 + dev: false + /unified@9.2.0: resolution: {integrity: sha512-vx2Z0vY+a3YoTj8+pttM3tiJHCwY5UFbYdiWrwBEbHmK8pvsPj2rtAX2BFfgXen8T39CJWblWRDT4L5WGXtDdg==} dependencies: @@ -16311,6 +17571,10 @@ packages: resolution: {integrity: sha512-cln2Mm1/CZzN5ttGK7vkoGw+RZ8VcUH6BtGbq98DDtRGquAAOXig1mrBQYelOwMXYS8rK+vZDyyojSjp7JX+Lg==} dev: false + /unist-util-generated@2.0.1: + resolution: {integrity: sha512-qF72kLmPxAw0oN2fwpWIqbXAVyEqUzDHMsbtPvOudIlUzXYFIeQIuxXQCRCFh22B7cixvU0MG7m3MW8FTq/S+A==} + dev: false + /unist-util-is@4.1.0: resolution: {integrity: sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==} dev: false @@ -16320,15 +17584,25 @@ packages: requiresBuild: true dependencies: '@types/unist': 2.0.8 - dev: true + + /unist-util-is@6.0.0: + resolution: {integrity: sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==} + dependencies: + '@types/unist': 3.0.0 + dev: false + + /unist-util-modify-children@3.1.1: + resolution: {integrity: sha512-yXi4Lm+TG5VG+qvokP6tpnk+r1EPwyYL04JWDxLvgvPV40jANh7nm3udk65OOWquvbMDe+PL9+LmkxDpTv/7BA==} + dependencies: + '@types/unist': 2.0.8 + array-iterate: 2.0.1 + dev: false /unist-util-position-from-estree@1.1.2: resolution: {integrity: sha512-poZa0eXpS+/XpoQwGwl79UUdea4ol2ZuCYguVaJS4qzIOMDzbqz8a3erUCOmubSZkaOuGamb3tX790iwOIROww==} requiresBuild: true dependencies: '@types/unist': 2.0.8 - dev: true - optional: true /unist-util-position@3.1.0: resolution: {integrity: sha512-w+PkwCbYSFw8vpgWD0v7zRCl1FpY3fjDSQ3/N/wNd9Ffa4gPi8+4keqt99N3XW6F99t/mUzp2xAhNmfKWp95QA==} @@ -16339,8 +17613,6 @@ packages: requiresBuild: true dependencies: '@types/unist': 2.0.8 - dev: true - optional: true /unist-util-remove-position@2.0.1: resolution: {integrity: sha512-fDZsLYIe2uT+oGFnuZmy73K6ZxOPG/Qcm+w7jbEjaFcJgbQ6cqjs/eSPzXhsmGpAsWPkqZM9pYjww5QTn3LHMA==} @@ -16354,8 +17626,6 @@ packages: dependencies: '@types/unist': 2.0.8 unist-util-visit: 4.1.2 - dev: true - optional: true /unist-util-remove@2.1.0: resolution: {integrity: sha512-J8NYPyBm4baYLdCbjmf1bhPu45Cr1MWTm77qd9istEkzWpnN6O9tMsEbB2JhNnBCqGENRqEWomQ+He6au0B27Q==} @@ -16363,6 +17633,14 @@ packages: unist-util-is: 4.1.0 dev: false + /unist-util-remove@3.1.1: + resolution: {integrity: sha512-kfCqZK5YVY5yEa89tvpl7KnBBHu2c6CzMkqHUrlOqaRgGOMp0sMvwWOVrbAtj03KhovQB7i96Gda72v/EFE0vw==} + dependencies: + '@types/unist': 2.0.8 + unist-util-is: 5.2.1 + unist-util-visit-parents: 5.1.3 + dev: false + /unist-util-stringify-position@2.0.3: resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==} dependencies: @@ -16374,7 +17652,12 @@ packages: requiresBuild: true dependencies: '@types/unist': 2.0.8 - dev: true + + /unist-util-visit-children@2.0.2: + resolution: {integrity: sha512-+LWpMFqyUwLGpsQxpumsQ9o9DG2VGLFrpz+rpVXYIEdPy57GSy5HioC0g3bg/8WP9oCLlapQtklOzQ8uLS496Q==} + dependencies: + '@types/unist': 2.0.8 + dev: false /unist-util-visit-parents@3.1.1: resolution: {integrity: sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==} @@ -16389,7 +17672,13 @@ packages: dependencies: '@types/unist': 2.0.8 unist-util-is: 5.2.1 - dev: true + + /unist-util-visit-parents@6.0.1: + resolution: {integrity: sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==} + dependencies: + '@types/unist': 3.0.0 + unist-util-is: 6.0.0 + dev: false /unist-util-visit@2.0.3: resolution: {integrity: sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==} @@ -16405,7 +17694,14 @@ packages: '@types/unist': 2.0.8 unist-util-is: 5.2.1 unist-util-visit-parents: 5.1.3 - dev: true + + /unist-util-visit@5.0.0: + resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==} + dependencies: + '@types/unist': 3.0.0 + unist-util-is: 6.0.0 + unist-util-visit-parents: 6.0.1 + dev: false /universalify@0.2.0: resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} @@ -16603,7 +17899,6 @@ packages: diff: 5.1.0 kleur: 4.1.5 sade: 1.8.1 - dev: true /v8-to-istanbul@9.1.0: resolution: {integrity: sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==} @@ -16640,8 +17935,6 @@ packages: dependencies: '@types/unist': 2.0.8 vfile: 5.3.7 - dev: true - optional: true /vfile-message@2.0.4: resolution: {integrity: sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==} @@ -16656,8 +17949,6 @@ packages: dependencies: '@types/unist': 2.0.8 unist-util-stringify-position: 3.0.3 - dev: true - optional: true /vfile@4.2.1: resolution: {integrity: sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==} @@ -16676,8 +17967,6 @@ packages: is-buffer: 2.0.5 unist-util-stringify-position: 3.0.3 vfile-message: 3.1.4 - dev: true - optional: true /vite@4.4.9(@types/node@18.11.9): resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==} @@ -16713,7 +18002,17 @@ packages: rollup: 3.29.2 optionalDependencies: fsevents: 2.3.3 - dev: true + + /vitefu@0.2.4(vite@4.4.9): + resolution: {integrity: sha512-fanAXjSaf9xXtOOeno8wZXIhgia+CZury481LsDaV++lSvcU2R9Ch2bPh3PYFyoHW+w9LqAeYRISVQjUIew14g==} + peerDependencies: + vite: ^3.0.0 || ^4.0.0 + peerDependenciesMeta: + vite: + optional: true + dependencies: + vite: 4.4.9(@types/node@18.11.9) + dev: false /vscode-jsonrpc@6.0.0: resolution: {integrity: sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==} @@ -16796,7 +18095,6 @@ packages: /vscode-oniguruma@1.7.0: resolution: {integrity: sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==} - dev: true /vscode-oniguruma@2.0.1: resolution: {integrity: sha512-poJU8iHIWnC3vgphJnrLZyI3YdqRlR27xzqDmpPXYzA93R4Gk8z7T6oqDzDoHjoikA2aS82crdXFkjELCdJsjQ==} @@ -16804,7 +18102,6 @@ packages: /vscode-textmate@8.0.0: resolution: {integrity: sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==} - dev: true /vscode-textmate@9.0.0: resolution: {integrity: sha512-Cl65diFGxz7gpwbav10HqiY/eVYTO1sjQpmRmV991Bj7wAoOAjGQ97PpQcXorDE2Uc4hnGWLY17xme+5t6MlSg==} @@ -16862,8 +18159,6 @@ packages: /web-namespaces@2.0.1: resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} requiresBuild: true - dev: true - optional: true /web-streams-polyfill@3.2.1: resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==} @@ -17090,6 +18385,27 @@ packages: tr46: 0.0.3 webidl-conversions: 3.0.1 + /which-pm-runs@1.1.0: + resolution: {integrity: sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==} + engines: {node: '>=4'} + dev: false + + /which-pm@2.0.0: + resolution: {integrity: sha512-Lhs9Pmyph0p5n5Z3mVnN0yWcbQYUAD7rbQUiMsQxOJ3T57k7RFe35SUwWMf7dsbDZks1uOmw4AecB/JMDj3v/w==} + engines: {node: '>=8.15'} + dependencies: + load-yaml-file: 0.2.0 + path-exists: 4.0.0 + dev: false + + /which-pm@2.1.1: + resolution: {integrity: sha512-xzzxNw2wMaoCWXiGE8IJ9wuPMU+EYhFksjHxrRT8kMT5SnocBPRg69YAMtyV4D12fP582RA+k3P8H9J5EMdIxQ==} + engines: {node: '>=8.15'} + dependencies: + load-yaml-file: 0.2.0 + path-exists: 4.0.0 + dev: false + /which@1.3.1: resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} hasBin: true @@ -17358,10 +18674,19 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + /yocto-queue@1.0.0: + resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} + engines: {node: '>=12.20'} + dev: false + /zenscroll@4.0.2: resolution: {integrity: sha512-jEA1znR7b4C/NnaycInCU6h/d15ZzCd1jmsruqOKnZP6WXQSMH3W2GL+OXbkruslU4h+Tzuos0HdswzRUk/Vgg==} dev: false + /zod@3.21.1: + resolution: {integrity: sha512-+dTu2m6gmCbO9Ahm4ZBDapx2O6ZY9QSPXst2WXjcznPMwf2YNpn3RevLx4KkZp1OPW/ouFcoBtBzFz/LeY69oA==} + dev: false + /zwitch@1.0.5: resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==} dev: false @@ -17369,5 +18694,3 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} requiresBuild: true - dev: true - optional: true diff --git a/cspell.yaml b/cspell.yaml index eaed9b9312..5b6a389615 100644 --- a/cspell.yaml +++ b/cspell.yaml @@ -5,6 +5,8 @@ dictionaries: - node - typescript words: + - astro + - astrojs - autorest - azsdkengsys - azurecr @@ -55,6 +57,7 @@ words: - safeint - segmentof - sfixed + - shiki - sint - ssvs - strs diff --git a/packages/compiler/src/server/tmlanguage.ts b/packages/compiler/src/server/tmlanguage.ts index 0f5620a7c7..6c3e6cbd61 100644 --- a/packages/compiler/src/server/tmlanguage.ts +++ b/packages/compiler/src/server/tmlanguage.ts @@ -889,4 +889,8 @@ export async function main() { }); await mkdir("./dist", { recursive: true }); await writeFile("./dist/typespec.tmLanguage", plist); + const json = await tm.emitJSON(grammar, { + errorSourceFilePath: resolve("./src/tmlanguage.ts"), + }); + await writeFile("./dist/typespec.tmLanguage.json", json); } diff --git a/packages/website-astro/.gitignore b/packages/website-astro/.gitignore new file mode 100644 index 0000000000..6240da8b10 --- /dev/null +++ b/packages/website-astro/.gitignore @@ -0,0 +1,21 @@ +# build output +dist/ +# generated types +.astro/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store diff --git a/packages/website-astro/.vscode/extensions.json b/packages/website-astro/.vscode/extensions.json new file mode 100644 index 0000000000..22a15055d6 --- /dev/null +++ b/packages/website-astro/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/packages/website-astro/.vscode/launch.json b/packages/website-astro/.vscode/launch.json new file mode 100644 index 0000000000..d642209762 --- /dev/null +++ b/packages/website-astro/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/packages/website-astro/README.md b/packages/website-astro/README.md new file mode 100644 index 0000000000..f95661b59b --- /dev/null +++ b/packages/website-astro/README.md @@ -0,0 +1,53 @@ +# Starlight Starter Kit: Basics + +[![Built with Starlight](https://astro.badg.es/v2/built-with-starlight/tiny.svg)](https://starlight.astro.build) + +``` +npm create astro@latest -- --template starlight +``` + +[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/starlight/tree/main/examples/basics) +[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/starlight/tree/main/examples/basics) + +> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun! + +## 🚀 Project Structure + +Inside of your Astro + Starlight project, you'll see the following folders and files: + +``` +. +├── public/ +├── src/ +│ ├── assets/ +│ ├── content/ +│ │ ├── docs/ +│ │ └── config.ts +│ └── env.d.ts +├── astro.config.mjs +├── package.json +└── tsconfig.json +``` + +Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name. + +Images can be added to `src/assets/` and embedded in Markdown with a relative link. + +Static assets, like favicons, can be placed in the `public/` directory. + +## 🧞 Commands + +All commands are run from the root of the project, from a terminal: + +| Command | Action | +| :------------------------ | :----------------------------------------------- | +| `npm install` | Installs dependencies | +| `npm run dev` | Starts local dev server at `localhost:4321` | +| `npm run build` | Build your production site to `./dist/` | +| `npm run preview` | Preview your build locally, before deploying | +| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | +| `npm run astro -- --help` | Get help using the Astro CLI | + +## 👀 Want to learn more? + +Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat). diff --git a/packages/website-astro/astro.config.mjs b/packages/website-astro/astro.config.mjs new file mode 100644 index 0000000000..c4455ca8c9 --- /dev/null +++ b/packages/website-astro/astro.config.mjs @@ -0,0 +1,47 @@ +// @ts-check +import starlight from "@astrojs/starlight"; +import { defineConfig } from "astro/config"; +import { readFileSync } from "fs"; +import { dirname, resolve } from "path"; +import { fileURLToPath } from "url"; + +const websiteRoot = dirname(fileURLToPath(import.meta.url)); + +const grammarPath = resolve(websiteRoot, "../compiler/dist/typespec.tmLanguage.json"); +const tspGrammar = JSON.parse(readFileSync(grammarPath).toString()); + +const myLanguage = { + id: "typespec", + scopeName: "source.tsp", + path: grammarPath, + grammar: tspGrammar, + aliases: ["typespec", "tsp"], +}; + +// https://astro.build/config +export default defineConfig({ + integrations: [ + starlight({ + title: "My Docs", + social: { + github: "https://github.com/withastro/starlight", + }, + sidebar: [ + { + label: `Next 🚧`, + autogenerate: { directory: "current" }, + }, + { + label: `Latest 🚀`, + autogenerate: { directory: "current" }, + }, + ], + }), + ], + markdown: { + shikiConfig: { + theme: "one-dark-pro", + langs: [myLanguage], + }, + }, +}); diff --git a/packages/website-astro/package.json b/packages/website-astro/package.json new file mode 100644 index 0000000000..aee7c4c3ae --- /dev/null +++ b/packages/website-astro/package.json @@ -0,0 +1,18 @@ +{ + "name": "@typespec/website-astro", + "type": "module", + "version": "0.0.1", + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro", + "copy-docs": "cp -r ../../docs/ ./src/content/docs/current/" + }, + "dependencies": { + "@astrojs/starlight": "^0.11.0", + "astro": "^3.2.3", + "sharp": "^0.32.5" + } +} diff --git a/packages/website-astro/public/favicon.svg b/packages/website-astro/public/favicon.svg new file mode 100644 index 0000000000..cba5ac140a --- /dev/null +++ b/packages/website-astro/public/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/website-astro/src/assets/houston.webp b/packages/website-astro/src/assets/houston.webp new file mode 100644 index 0000000000..930c164974 Binary files /dev/null and b/packages/website-astro/src/assets/houston.webp differ diff --git a/packages/website-astro/src/content/config.ts b/packages/website-astro/src/content/config.ts new file mode 100644 index 0000000000..9df91b6044 --- /dev/null +++ b/packages/website-astro/src/content/config.ts @@ -0,0 +1,7 @@ +import { defineCollection } from 'astro:content'; +import { docsSchema, i18nSchema } from '@astrojs/starlight/schema'; + +export const collections = { + docs: defineCollection({ schema: docsSchema() }), + i18n: defineCollection({ type: 'data', schema: i18nSchema() }), +}; diff --git a/packages/website-astro/src/content/docs/current/extending-typespec/basics.md b/packages/website-astro/src/content/docs/current/extending-typespec/basics.md new file mode 100644 index 0000000000..da9bfd2a5b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/extending-typespec/basics.md @@ -0,0 +1,314 @@ +--- +id: basics +title: Creating a TypeSpec Library +--- + +# Creating a TypeSpec library + +TypeSpec libraries are packages that contain TypeSpec types, decorators, emitters, linters, and other bits of reusable code. TypeSpec libraries are [npm packages](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry) with some additional typespec-specific metadata and conventions. The following will show how to establish a new TypeSpec library, add some types to it, and distribute it on the public npm registry. Later sections will cover more details on how to write [decorators](create-decorators.md), [emitters](./emitters-basics.md) and [linters](./linters.md). + +This document assumes you will be using [TypeScript](https://typescriptlang.org) to develop your library, but you should feel free to skip the TypeScript steps if you want to use plain JavaScript. + +## Prerequisites + +You will need both node and npm installed. Additionally, if you intend to develop multiple libraries together, you will likely want to establish a monorepo as this will make developing the libraries in tandem much easier. TypeSpec itself uses [rush.js](https://rushjs.io/). + +## Canonical package structure + +The following is a high level overview of the contents of a TypeSpec package. These files are explained in more detail in the subsequent sections. + +- **dist/index.js** - the main file for your node library +- **lib/main.tsp** - the main file for your TypeSpec types (optional) +- **src/index.ts** - the main file for your node library in TypeScript +- **src/lib.ts** - the TypeSpec library definition file +- **package.json** - metadata about your TypeSpec package + +## Initial setup + +### 1. Initialize your package directory & package.json + +Run the following commands: + +```bash +> mkdir myLibrary +> cd myLibrary +> npm init +``` + +After filling out the wizard, you will have a package.json file that defines your typespec library. + +Unlike node libraries which support CommonJS (cjs), TypeSpec libraries must be Ecmascript Modules. So open your `package.json` and add the following top-level configuration key: + +```json + "type": "module" +``` + +### 2. Install TypeSpec dependencies + +Run the following command: + +```bash +npm install --save-peer @typespec/compiler +``` + +You may have need of other dependencies in the TypeSpec standard library depending on what you are doing. E.g. if you want to use the metadata found in `@typespec/openapi` you will need to install that as well. + +See [dependency section](#defining-dependencies) for information on how to define your dependencies. + +### 2. Define your main files + +Your package.json needs to refer to two main files: your node module main file, and your TypeSpec main. The node module main file is the `"main"` key in your package.json file, and defines the entrypoint for your library when consumed as a node library, and must reference a js file. The TypeSpec main defines the entrypoint for your library when consumed from a TypeSpec program, and may reference either a js file (when your library doesn't contain any typespec types) or a TypeSpec file. + +```json + "main": "dist/index.js", + "tspMain": "lib/main.tsp" +``` + +### 3. Install and initialize TypeScript + +Run the following commands: + +```bash +npm install -D typescript +npx tsc --init --strict +``` + +This will create `tsconfig.json`. But we need to make a couple changes to this. Open `tsconfig.json` and set the following settings: + +```json + "module": "Node16", // This and next setting tells TypeScript to use the new ESM import system to resolve types. + "moduleResolution": "Node16", + "target": "es2019", + "rootDir": "./src", + "outDir": "./dist", +``` + +### 4. Create `lib.ts` + +Open `./src/lib.ts` and create your library definition that registers your library with the TypeSpec compiler and defines any diagnostics your library will emit. Make sure to export the library definition as `$lib`. + +:::warn +If `$lib` is not accessible from your library package (`import {$lib} from "my-library";`) some functionality will be unavailable like validation of emitter options, linter rules, etc. +::: + +The following shows an example: + +```typescript +import { createTypeSpecLibrary } from "@typespec/compiler"; + +export const $lib = createTypeSpecLibrary({ + name: "myLibrary", + diagnostics: {}, +} as const); + +// Optional but convenient, those are meant to be used locally in your library. +export const { reportDiagnostic, createDiagnostic, createStateSymbol } = myLibrary; +``` + +Diagnostics are used for linters and decorators which are covered in subsequent topics. + +### 5. Create `index.ts` + +Open `./src/index.ts` and import your library definition: + +```typescript +// Re-export $lib to the compiler can get access to it and register your library correctly. +export { $lib } from "./lib.js"; +``` + +### 6. Build TypeScript + +TypeSpec can only import JavaScript files, so any time changes are made to TypeScript sources, they need to be compiled before they are visible to TypeSpec. To do so, run `npx tsc -p .` in your library's root directory. You can also run `npx tsc -p --watch` if you would like to re-run the TypeScript compiler whenever files are changed. + +### 7. Add your main TypeSpec file + +Open `./lib/main.tsp` and import your JS entrypoint. This ensures that when typespec imports your library, the code to define the library is run. In later topics when we add decorators, this import will ensure those get exposed as well. + +```typespec +import "../dist/index.js"; +``` + +## Adding TypeSpec types to your library + +Open `./lib/main.tsp` and add any types you want to be available when users import this library. It is also strongly recommended you put these types in a namespace that corresponds with the library name. For example, your `./lib/main.tsp` file might look like: + +```typespec +import "../dist/index.js"; + +namespace MyLibrary; +model Person { + name: string; + age: uint8; +} +``` + +## Defining Dependencies + +Defining dependencies in a TypeSpec library should be following these rules: + +- use `peerDependencies` for all TypeSpec libraries(+ compiler) that you use in your own library/emitter +- use `devDependencies` for the other typespec libraries used only in tests +- use `dependencies`/`devDependencies` for any other packages depending if using in library code or in test/dev scripts + +TypeSpec libraries are defined using `peerDependencies` so we don't end-up with multiple versions of the compiler/library running at the same time. + +**Example** + +```jsonc +{ + "dependencies": { + "yaml": "~2.3.1" // This is a regular package this library/emitter will use + }, + "peerDependencies": { + // Those are all TypeSpec libraries this library/emitter depend on + "@typespec/compiler": "~0.43.0", + "@typespec/http": "~0.43.1", + "@typespec/openapi": "~0.43.0" + }, + "devDependencies": { + // This TypeSpec library is only used in the tests but is not required to use this library. + "@typespec/versioning": "~0.43.0", + // Typescript is only used during development + "typescript": "~5.0.2" + } +} +``` + +## Publishing your TypeSpec library + +To publish to the public npm registry, follow [their documentation](https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages). + +## Importing your TypeSpec library + +Once your TypeSpec library is published, your users can install and use it just like any of the TypeSpec standard libraries. First, they have to install it: + +```bash +npm install $packageName +``` + +Next, they import it into their TypeSpec program and use the namespace (if desired): + +```typespec +import "MyLibrary"; +using MyLibrary; + +model Employee extends Person { + job: string; +} +``` + +## Next steps + +TypeSpec libraries can contain more than just types. Read the subsequent topics for more details on how to write [decorators](./create-decorators.md), [emitters](./emitters-basics.md) and [linters](./linters.md). + +## Testing + +TypeSpec provides a testing framework to help testing libraries. Examples here are shown using `mocha` but any other JS test framework can be used. + +### Define the testing library + +First step is to define how your library can be loaded from the test framework. This will let your library to be reused by other library test. + +1. Create a new file `./src/testing/index.ts` with the following content + +```ts +export const MyTestLibrary = createTestLibrary({ + name: "", + // Set this to the absolute path to the root of the package. (e.g. in this case this file would be compiled to ./dist/src/testing/index.js) + packageRoot: resolvePath(fileURLToPath(import.meta.url), "../../../../"), +}); +``` + +2. Add an `exports` for the `testing` endpoint to `package.json` (update with correct paths) + +```json +{ + // ... + "main": "dist/src/index.js", + "exports": { + ".": "./dist/src/index.js", + "./testing": "./dist/src/testing/index.js" + }, + "typesVersions": { + "*": { + "*": ["./dist/src/index.d.ts"], + "testing": ["./dist/src/testing/index.d.ts"] + } + } +} +``` + +### Define the test host and test runner for your library + +Define some of the test framework base pieces that will be used in the tests. There is 2 functions: + +- `createTestHost`: This is a lower level api that provide a virtual file system. +- `createTestRunner`: This is a wrapper on top of the test host that will automatically add a `main.tsp` file and automatically import libraries. + +Create a new file `test/test-host.js` (change `test` to be your test folder) + +```ts +import { createTestHost, createTestWrapper } from "@typespec/compiler/testing"; +import { RestTestLibrary } from "@typespec/rest/testing"; +import { MyTestLibrary } from "../src/testing/index.js"; + +export async function createMyTestHost() { + return createTestHost({ + libraries: [RestTestLibrary, MyTestLibrary], // Add other libraries you depend on in your tests + }); +} +export async function createMyTestRunner() { + const host = await createOpenAPITestHost(); + return createTestWrapper(host, { autoUsings: ["My"] }); +} +``` + +### Write tests + +After setting up that infrastructure you can start writing tests. + +```ts +import { createMyTestRunner } from "./test-host.js"; + +describe("my library", () => { + let runner: BasicTestRunner; + + beforeEach(async () => { + runner = await createMyTestRunner(); + }); + + // Check everything works fine + it("does this", () => { + const { Foo } = runner.compile(` + @test model Foo {} + `); + strictEqual(Foo.kind, "Model"); + }); + + // Check diagnostics are emitted + it("errors", () => { + const diagnostics = runner.diagnose(` + model Bar {} + `); + expectDiagnostics(diagnostics, { code: "...", message: "..." }); + }); +}); +``` + +#### `@test` decorator + +The `@test` decorator is a decorator loaded in the test environment. It can be used to collect any decorable type. +When using the `compile` method it will return a `Record` which is a map of all the types annoted with the `@test` decorator. + +```ts +const { Foo, CustomName } = runner.compile(` + @test model Foo {} + + model Bar { + @test("CustomName") name: string + } +`); + +Foo; // type of: model Foo {} +CustomName; // type of : Bar.name +``` diff --git a/packages/website-astro/src/content/docs/current/extending-typespec/create-decorators.md b/packages/website-astro/src/content/docs/current/extending-typespec/create-decorators.md new file mode 100644 index 0000000000..ac0727e597 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/extending-typespec/create-decorators.md @@ -0,0 +1,209 @@ +--- +id: create-decorators +title: Creating TypeSpec Decorators +--- + +# Creating TypeSpec decorators + +TypeSpec decorator are implemented as JavaScript function. Declarating a decorator can be done in 1 or 2 part: + +1. [(Optional) Declare the decorator signature in typespec](#declaring-a-decorator-signature) +2. [Implement the decorator in Javascript](#implement-the-decorator-in-js) + +## Declaring a decorator signature + +This part is optional but provides great value: + +- Type checking for the parameters +- IDE IntelliSense + +A decorator signature can be declared using the `dec` keyword. As we are implementing the decorator in JS (only choice right now), we must apply the `extern` modifier as well. + +```typespec +extern dec logType(target: unknown, name: string); +``` + +## Decorator target + +The first parameter of the decorator represents the typespec type(s) that the decorator can be applied on. + +You can specify multiple potential target type using an `union expression` + +```typespec +using TypeSpec.Reflection; + +extern dec track(target: Model | Enum); +``` + +### Optional parameters + +A decorator parameter can be marked optional using `?` + +```typespec +extern dec track(target: Model | Enum, name?: valueof string); +``` + +### Rest parameters + +A decorator's last parameter can be prefixed with `...` to collect all the remaining arguments. The type of that parameter must be an `array expression` + +```typespec +extern dec track(target: Model | Enum, ...names: valueof string[]); +``` + +## Ask for a value type + +It is common that decorators parameter will expect a value(e.g. a string or a number). However just using `: string` as the type will also allow a user of the decorator to pass `string` itself or a custom scalar extending string as well as union of strings. +Instead the decorator can use `valueof ` to specify that it is expecting a value of that kind. + +| Example | Description | +| ----------------- | ---------------- | +| `valueof string` | Expect a string | +| `valueof float64` | Expect a float | +| `valueof int32` | Expect a number | +| `valueof boolean` | Expect a boolean | + +```tsp +extern dec tag(target: unknown, value: valueof string); + +// bad +@tag(string) + +// good +@tag("This is the tag name") +``` + +## Implement the decorator in JS + +Decorators can be implemented in JavaScript by prefixing the function name with `$`. A decorator function must have the following parameters: + +- `1`: `context` of type `DecoratorContext` +- `2`: `target` The TypeSpec type target. (`Namespace`, `Interface`, etc.) +- `3+`: Any arguments of the decorators. + +```ts +// model.ts +import type { DecoratorContext, Type } from "@typespec/compiler"; + +export function $logType(context: DecoratorContext, target: Type, name: valueof string) { + console.log(name + ": " + targetType.kind); +} +``` + +or in pure JS + +```ts +// model.js +export function $logType(context, target, name) { + console.log(name + ": " + targetType.kind); +} +``` + +The decorator can then be consumed this way + +```typespec +// main.tsp +import "./model.js"; + +@logType("Dog type") +model Dog { + @logType("Name type") + name: string; +} +``` + +### Decorator parameter marshalling + +For certain TypeSpec types(Literal types) the decorator do not receive the actual type but a marshalled value if the decorator parmaeter type is a `valueof`. This is to simplify the most common cases. + +| TypeSpec Type | Marshalled value in JS | +| ----------------- | ---------------------- | +| `valueof string` | `string` | +| `valueof numeric` | `number` | +| `valueof boolean` | `boolean` | + +for all the other types they are not transformed. + +```ts +export function $tag( + context: DecoratorContext, + target: Type, + stringArg: string, // Here instead of receiving a `StringLiteral` the string value is being sent. + modelArg: Model // Model has no special handling so we receive the Model type +) {} +``` + +### Adding metadata with decorators + +Decorators can be used to register some metadata. For this you can use the `context.program.stateMap` or `context.program.stateSet` to insert data that will be tied to the current execution. + +❌ Do not save the data in a global variable. + +```ts +import type { DecoratorContext, Type } from "@typespec/compiler"; +import type { createStateSymbol } from "./lib.js"; + +// Create a unique key +const key = createStateSymbol("customName"); +export function $customName(context: DecoratorContext, target: Type, name: string) { + // Keep a mapping between the target and a value. + context.program.stateMap(key).set(target, name); + + // Keep an index of a type. + context.program.stateSet(key).add(target); +} +``` + +### Reporting diagnostic on decorator or arguments + +Decorator context provide the `decoratorTarget` and `getArgumentTarget` helpers + +```ts +import type { DecoratorContext, Type } from "@typespec/compiler"; +import type { reportDiagnostic } from "./lib.js"; + +export function $customName(context: DecoratorContext, target: Type, name: string) { + reportDiagnostic({ + code: "custom-name-invalid", + target: context.decoratorTarget, // Get location of @customName decorator in typespec document. + }); + reportDiagnostic({ + code: "bad-name", + target: context.getArgumentTarget(0), // Get location of {name} argument in typespec document. + }); +} +``` + +## Declaration - implementation link + +Decorator signatures are linked to the implementation of the same name in the same namespace + +```typespec +import "./lib.js"; +extern dec customName(target: Type, name: StringLiteral); + +namespace MyLib { + extern dec tableName(target: Type, name: StringLiteral); +} +``` + +is linked the the following in `lib.js` + +```ts +export function $customName(context: DecoratorContext, name: string) {} + +export function $tableName(context: DecoratorContext, name: string) {} +setTypeSpecNamespace("MyLib", $tableName); +``` + +## Troubleshooting + +### Extern declation must have an implementation in JS file + +Potential issues: + +- JS function is not prefixed with `$`. For a decorator called `@decorate` the JS function must be called `$decoratate` +- JS function is not in the same namespace as the the `extern dec` +- Error is only showing in the IDE? Restart the TypeSpec server or the IDE. + +You can use `--trace bind.js.decorator` to log debug information about decorator loading in JS file that should help pinning down which of those is the issue. diff --git a/packages/website-astro/src/content/docs/current/extending-typespec/diagnostics.md b/packages/website-astro/src/content/docs/current/extending-typespec/diagnostics.md new file mode 100644 index 0000000000..ef67bd7aa0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/extending-typespec/diagnostics.md @@ -0,0 +1,127 @@ +--- +title: Diagnostics +--- + +TypeSpec compiler report errors and warnings in the spec using the diagnostic API. + +## Best practices + +- ❌ Do not use `throw` to report errors. Any exception thrown like this will be presented as a bug in your library to the user. +- ✅ Use diagnostic API to report expected errors and warnings. + - ✅ Use `reportDiagnostic` in a decorator, `$onValidate` or `$onEmit` + - ❌ Do not use `reportDiagnostic` in an accessor(A function meant to be consumed in another library or emitter). See [collect diagnostics section](#collect-diagnostics) + +## Diagnostic specification + +- Each diagnostic MUST have a `code`. The full code is the the library name followed by the declared code. (`/`) +- Each diagnostic MUST have a `severity`. It can be `error`, `warning`. Errors cannot be suppressed +- Each diagnostics MUST have at least one message. Using `default` as the `messageId` will allow it to be the default selected. +- Each diagnostics message MAY have parameters to interpolate information into the message + +## Usage + +### Declare the diagnostics you are reporting + +```ts +// in lib.js +export const { reportDiagnostic, createDiagnostic, createStateSymbol } = createTypeSpecLibrary({ + name: "@typespec/my-lib", + diagnostics: { + // Basic diagnostic with a fixed message + "no-array": { + severity: "error", + messages: { + default: `Array is not allowed in my-lib models.`, + }, + }, + + // Parameterized message + "duplicate-route": { + severity: "error", + messages: { + default: paramMessage`Route '${"path"}' is being referenced in 2 different operations.`, + }, + }, + + // Multiple messages + "duplicate-name": { + severity: "warning", + messages: { + default: paramMessage`Duplicate type name: '${"value"}'.`, + parameter: paramMessage`Duplicate parameter key: '${"value"}'.`, + }, + }, + }, +} as const); +``` + +This will represent 3 different diagnostics with full name of + +- `@typespec/my-lib/no-array` +- `@typespec/my-lib/duplicate-route` +- `@typespec/my-lib/duplicate-name` + +### Report diagnostics + +```ts +import { reportDiagnostic } from "./lib.js"; + +// Basic diagnostic with a fixed message +reportDiagnostic(program, { + code: "no-array", + target: diagnosticTarget, +}); + +// Parameterized message +reportDiagnostic(program, { + code: "duplicate-route", + format: {path: "/foo"} + target: diagnosticTarget, +}); + +// Multiple messages +reportDiagnostic(program, { + code: "duplicate-name", + messageId: "parmaeter", + format: {value: "$select"}, + target: diagnosticTarget, +}); +``` + +### Collect diagnostics + +When trying to report diagnostic in an accessor a good pattern is not to report the diagnostic to the program directly but return a tuple to let the user decide what to do. +This prevent duplicate diagnostics emitter if the accessor is called multiple times. + +```ts +import { createDiagnosticCollector, Diagnostic } from "@typespec/compiler"; + +function getRoutes(): [Route, readonly Diagnostic] { + const diagnostics = createDiagnosticCollector(); + diagnostics.add( + createDiagnostic(program, { + code: "no-array", + target: diagnosticTarget, + }) + ); + const result = diagnostic.pipe(getParameters()); // to pipe diagnostics returned by `getParameters` + return diagnostics.wrap(routes); +} +``` + +or manually + +```ts +import { Diagnostic } from "@typespec/compiler"; + +function getRoutes(): [Route, readonly Diagnostic] { + const diagnostics = []; + diagnostics.push( + createDiagnostic(program, { + code: "no-array", + target: diagnosticTarget, + }) + ); + return [routes, diagnostics]; +} +``` diff --git a/packages/website-astro/src/content/docs/current/extending-typespec/emitter-framework.md b/packages/website-astro/src/content/docs/current/extending-typespec/emitter-framework.md new file mode 100644 index 0000000000..3fa78f5ebc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/extending-typespec/emitter-framework.md @@ -0,0 +1,359 @@ +--- +id: emitter-framework +title: Emitter framework +--- + +The emitter framework makes writing emitters from TypeSpec to other assets a fair bit easier than manually consuming the type graph. The framework gives you an easy way to handle all the types TypeSpec might throw at you and know when you're "feature complete". It also handles a lot of hard problems for you, such as how to construct references between types, how to handle circular references, or how to propagate the context of the types you're emitting based on their containers or where they're referenced from. Lastly, it provides a class-based inheritance model that makes it fairly painless to extend and customize existing emitters. + +## Getting Started + +Make sure to read the getting started section under the [emitter basics](./emitters-basics.md) topic. To use the framework, you will need an emitter library and `$onEmit` function ready to go. + +## Implementing your emitter + +Implementing an emitter using the emitter framework will use a variety of types from the framework. To give you a high level overview, these are: + +- `AssetEmitter`: The asset emitter is the main type you will interact with in your `$onEmit` function. You can pass the asset emitter types to emit, and tell it to write types to disk or give you source files for you to process in other ways. +- `TypeEmitter`: The type emitter is the base class for most of your emit logic. Every TypeSpec type has a corresponding method on TypeEmitter. It also is where you will manage your emit context, making it easy to answer such questions as "is this type inside something I care about" or "was this type referenced from something". +- `CodeTypeEmitter`: A subclass of `TypeEmitter` that makes building source code easier. +- `StringBuilder`, `ObjectBuilder`, `ArrayBuilder`: when implementing your `TypeEmitter` you will likely use these classes to help you build strings and object graphs. These classes take care of handling the placeholders that result from circular references. + +Let's walk through each of these types in turn. + +### `AssetEmitter` + +The asset emitter is responsible for driving the emit process. It has methods for taking TypeSpec types to emit, and maintains the state of your current emit process including the declarations you've accumulated, current emit context, and converting your emitted content into files on disk. + +To create your asset emitter, call `createAssetEmitter` on your emit context in `$onEmit`. It takes the TypeEmitter which is covered in the next section. Once created, you can call `emitProgram()` to emit every type in the TypeSpec graph. Otherwise, you can call `emitType(someType)` to emit specific types instead. + +```typescript +export async function $onEmit(context: EmitContext) { + const assetEmitter = context.createAssetEmitter(MyTypeEmitter); + + // emit my entire typespec program + assetEmitter.emitProgram(); + // or, maybe emit types just in a specific namespace + const ns = context.program.resolveTypeReference("MyNamespace")!; + assetEmitter.emitType(ns); + + // lastly, write your emit output into the output directory + await assetEmitter.writeOutput(); +} +``` + +### `TypeEmitter` + +This is the base class for writing logic to convert TypeSpec types into assets in your target language. Every TypeSpec type has at least one method on this base class, and many have multiple methods. For example, models have both `ModelDeclaration` and `ModelLiteral` methods to handle `model Pet { }` declarations and `{ anonymous: boolean }` literals respectively. + +To support emitting all TypeSpec types, you should expect to implement all of these methods. But if you don't want to support emitting all TypeSpec types, you can either throw or just not implement the method, in which case the type will not be emitted. + +The generic type parameter `T` is the type of emit output you are building. For example, if you're emitting source code, `T` will be `string`. If you're building an object graph like JSON, `T` will be `object`. If your `T` is `string`, i.e. you are building source code, you will probably want to use the `CodeTypeEmitter` subclass which is a bit more convenient, but `TypeEmitter` will also work fine. + +A simple emitter that doesn't do much yet might look like: + +```typescript +class MyCodeEmitter extends CodeTypeEmitter { + modelDeclaration(model: Model, name: string) { + console.log("Emitting a model named", name); + } +} +``` + +Passing this to `createAssetEmitter` and calling `assetEmitter.emitProgram()` will console.log all the models in the program. + +#### EmitterOutput + +Most methods of the `TypeEmitter` must either return `T` or an `EmitterOutput`. There are four kinds of `EmitterOutput`: + +- `Declaration`: A declaration, which has a name and is declared in a scope, and so can be referenced by other emitted types (more on References later). Declarations are created by calling `this.emitter.result.declaration(name, value)` in your emitter methods. Scopes come from your current context, which is covered later in this document. +- `RawCode`: Output that is in some way concatenated into the output but cannot be referenced (e.g. things like type literals). Raw code is created by calling `this.emitter.result.rawCode(value)` in your emitter methods. +- `NoEmit`: The type does not contribute any output. This is created by calling `this.emitter.result.none()` in your emitter methods. +- `CircularEmit`: Indicates that a circular reference was encountered, which is generally handled by the framework with Placeholders (see the next section). You do not need to create this result yourself, the framework will produce this when required. + +When an emitter returns `T` or a `Placeholder`, it behaves as if it returned `RawCode` with that value. + +To create these results, you use the `result.*()` APIs on `AssetEmitter`, which can be accessed via `this.emitter.result` in your methods. + +With this in mind, we can make `MyCodeEmitter` a bit more functional: + +```typescript +class MyCodeEmitter extends CodeTypeEmitter { + // context and scope are covered later in this document + programContext(program: Program): Context { + const sourceFile = this.emitter.createSourceFile("test.txt"); + return { + scope: sourceFile.globalScope, + }; + } + + modelDeclaration(model: Model, name: string) { + const props = this.emitter.emitModelProperties(model); + return this.emitter.result.declaration(name, `declaration of ${name}`); + } +} +``` + +If we have a typespec program that looks like: + +```typespec +model Pet {} +``` + +and we call `assetEmitter.writeOutput()`, we'll find `test.txt` contains the contents `"declaration of Pet"`. + +In order to emit properties of `Pet`, we'll need to concatenate the properties of pets with the declaration we made and leverage builders to make that easy. These topics are covered in the next two sections. + +#### Concatenating results + +It is very rare that you only want to emit a declaration and nothing else. Probably your declaration will have various parts to it, and those parts will depend on the emit output of the parts of the type your emitting. For example, a declaration from a TypeSpec model will likely include members based on the members declared in the TypeSpec. + +This is accomplished by calling `emit` or other `emit*` methods on the asset emitter from inside your `AssetEmitter` methods. For example, to emit the properties of a model declaration, we can call `this.emitter.emitModelProperties(model)`. This will invoke your the corresponding `AssetEmitter` method and return you the `EmitterOutput` result. + +It is unlikely that you want to concatenate this result directly. For declarations and raw code, the `value` property is likely what you're interested in, but there are other complexities as well. So in order to concatenate results together, you probably want to use a builder. + +#### Builders + +Builders are helpers that make it easy to concatenate output into your final emitted asset. They do two things of note: they handle extracting the value from `Declaration` and `rawCode` output, and they handle `Placeholder` values that crop up due to circular references. Three `builders` are provided: + +- Strings: Using the `code` template literal tag, you can concatenate `EmitterOutput`s together into a final string. +- Object: Constructing an `ObjectBuilder` with an object will replace any `EmitterOutput` in the object with its value and handle placeholders as necessary. +- Array: Constructing an `ArrayBuilder` will let you push `EmitterOutput` and pull out the value and placeholders as necessary. + +Now with these tools, we can make `MyCodeEmitter` even more functional: + +```typescript +class MyCodeEmitter extends CodeTypeEmitter { + // context is covered later in this document + programContext(program: Program): Context { + const sourceFile = this.emitter.createSourceFile("test.txt"); + return { + scope: sourceFile.globalScope, + }; + } + + modelDeclaration(model: Model, name: string) { + const props = this.emitter.emitModelProperties(model); + return this.emitter.result.declaration(name, code`declaration of ${name} with ${props}`); + } + + modelPropertyLiteral(property: ModelProperty): EmitterOutput { + return code`a property named ${property.name} and a type of ${this.emitter.emitType( + property.type + )}`; + } + + modelLiteral(model: Model) { + return `an object literal`; + } +} +``` + +Now given a typespec program like: + +```typespec +model Pet { + position: {}; +} +``` + +we will find `test.txt` contains the output + +> declaration of Pet with a property named position and a type of an object literal + +#### References between emitted types + +A common scenario when emitting to most targets is handling how to make references between types. This can get pretty complex, especially when the declarations are emitted into different scopes. The emitter framework does a lot of heavy lifting for you by calculating the scopes between your current context and the declaration you're trying to reference. + +How declarations arrive in different scopes is covered in the Context section later in this document. + +Let's look at the `reference` signature on the TypeEmitter: + +```typescript + reference( + targetDeclaration: Declaration, + pathUp: Scope[], + pathDown: Scope[], + commonScope: Scope | null + ): string | EmitEntity {} +``` + +The `reference` function is called with: + +- `targetDeclaration`: The declaration we're making a reference to. +- `pathUp`: The scopes between our current scope and the common scope. +- `pathDown`: The scopes between the common scope and the declaration we're referencing. +- `commonScope`: The nearest scope shared between our current scope and the target declaration. + +So let's imagine we have declarations under the following scopes: + +``` +source file + namespace A + namespace B + model M1 + namespace C + model M2 +``` + +If M1 references M2, `reference` will be called with the following arguments: + +- `targetDeclaration`: M2 +- `pathUp`: [namespace B, namespace A] +- `pathDown`: [namespace C] +- `commonScope`: source file + +For languages which walk up a scope chain in order to find a reference (e.g. TypeScript, C#, Java, etc.), you generally won't need `pathUp`, you can just join the scopes in the `pathDown` resulting in a reference like `C.M2`. Other times you may need to construct a more path-like reference, in which case you can emit for example a `../` for every item in `pathUp`, resulting in a reference like `../../C/M2`. + +When the declarations don't share any scope, `commonScope` will be null. This happens when the types are contained in different source files. In such cases, your emitter will likely need to import the target declaration's source file in addition to constructing a reference. The source file has an `imports` property that can hold a list of such imports. + +We can update our example emitter to generate references by adding an appropriate `references` method: + +```typescript +class MyCodeEmitter extends CodeTypeEmitter { + // snip out the methods we implemented previously + + // If the model is Person, put it into a special namespace. + // We will return to this in detail in the next section. + modelDeclarationContext(model: Model, name: string): Context { + if (model.name === "Person") { + const parentScope = this.emitter.getContext().scope; + const scope = this.emitter.createScope({}, "Namespace", parentScope); + + return { + scope, + }; + } else { + return {}; + } + } + + reference( + targetDeclaration: Declaration, + pathUp: Scope[], + pathDown: Scope[], + commonScope: Scope | null + ): string | EmitEntity { + const segments = pathDown.map((s) => s.name); + segments.push(targetDeclaration.name); + + return `a reference to ${segments.join(".")}`; + } +} +``` + +Now if we emit the following TypeSpec program: + +```typespec +model Pet { + person: Person; +} + +model Person { + pet: Pet; +} +``` + +We will find that `test.txt` contains the following text: + +> declaration of Pet with a property named person and a type of a reference to Namespace.Person + +#### Placeholders + +Consider the following TypeSpec program: + +```typespec +model Pet { + owner: Person; +} + +model Person { + pet: Pet; +} +``` + +In order to emit `Pet`, we need to emit `Person`, so we go to emit that. But in order to emit `Person`, we need to emit `Pet`, which is what we're already trying to do! We're at an impasse. This is a circular reference. + +The emitter framework handles circular references via `Placeholder`s. When a circular reference is encountered, the `value` of an `EmitterOutput` is set to a placeholder that is filled in when we've finished constructing the thing we referenced. So in the case above, when emitting `Person` and we come across the circular reference to `Pet`, we'll return a `Placeholder`. We'll then come back to `Pet`, finish it and return an `EmitterOutput` for it, and then set any `Placeholder`s waiting for `Pet` to that output. + +If you're using the `Builder`s that come with the framework, you will not need to worry about dealing with `Placeholder` yourself. + +#### Context + +A common need when emitting TypeSpec is to know what context you are emitting the type in. There is one piece of required context: `scope`, which tells the emitter framework where you want to place your declarations. But you might also want to easily answer questions like: am I emitting a model inside a particular namespace? Or am I emitting a model that is referenced from the return type of an operation? The emitter framework makes managing this context fairly trivial. + +Every method that results in an `EmitterOutput` has a corresponding method for setting lexical and reference context. We saw this above when we created `modelDeclarationContext` in order to put some models into a different namespace. + +##### Lexical Context + +Lexical context is available when emitting types that are lexically contained within the emitted entity in the source TypeSpec. For example, if we set `modelDeclarationContext`, that context will be visible when emitting the model's properties and any nested model literals. + +##### Reference Context + +Reference context is passed along when making references and otherwise propagates lexically. For example, if we set `modelDeclarationReferenceContext`, that context will be visible when emitting the model's properties and any nested model literals just like with lexical context. But unlike with lexical context, if the current model references another type, then the reference context will be visible when emitting the referenced model. + +Note that this means that we may emit the same model multiple times. Consider the following TypeSpec program: + +```typespec +model Pet {} +model Person { + pet: Pet; +} +``` + +If, when emitting Person, we set the reference context to `{ refByPerson: true }`, we will call `emitModel` for `Pet` twice, once with no context set, and once again with the context we set when emitting `Person`. This behavior is very handy when you want to emit the same model different ways depending on how it is used, e.g. when your emit differs whether a model is an input type or output type, or when a model's properties differ based on any `@visibility` decorators and the context the model appears in (e.g. for Resources, whether it's being read, updated, created, deleted, etc.). + +#### Scope + +The scope that declarations are created in is set in using context. When emitting all of your TypeSpec program into the same file, and not emitting types into any kind of namespace, it suffices to set scope once in `programContext`. Call `this.emitter.createSourceFile("filePath.txt")` to create a source file, which comes with a scope ready to use. + +To emit into different source files, e.g. if we want to emit using a "one class per file" pattern, move the into a more granular context method. For example, if we instead create source files in `modelDeclarationContext`, then declarations for each model will be in their own file. + +If we want to emit into namespaces under a source file, we can create scopes manually. Call `this.emitter.createScope(objectReference, name, parentScope)`. The `objectReference` is an object with metadata about the scope. You might use this to emit e.g. a namespace declaration in your target language, but often it can just be an empty object (`{}`). Name is the name of the scope, used when constructing references. And parent scope is the scope this is found under. + +Lets return to our previous example: + +```typescript + modelDeclarationContext(model: Model, name: string): Context { + if (model.name === "Person") { + const parentScope = this.emitter.getContext().scope; + const scope = this.emitter.createScope({}, "Namespace", parentScope); + + return { + scope, + }; + } else { + return {}; + } + } +``` + +We can now see how this results in the `Person` model being located in a nested scope - because we set `scope` on the context to a new scope we created via `this.emitter.setScope`. + +### Extending `TypeEmitter` + +TypeEmitters are classes and explicitly support subclassing, so you can customize an existing emitter by extending it and overriding any methods you want to customize in your subclass. In fact, emitters you find out in the ecosystem are likely not to work without creating a subclass, because they only know how to emit types, but you need to provide the scope for any declarations it wants to create. For example, if we have a base `TypeScriptEmitter` that can convert TypeSpec into TypeScript, we might extend it to tell it to put all declarations in the same file: + +```typescript +class MyTsEmitter extends TypeScriptEmitter { + programContext(program: Program): Context { + const sourceFile = this.emitter.createSourceFile("test.txt"); + return { + scope: sourceFile.globalScope, + }; + } +} +``` + +Or, if we want one class or interface per file, we might instead do something like: + +```typescript +class MyTsEmitter extends TypeScriptEmitter { + modelDeclarationContext(program: Program): Context { + const sourceFile = this.emitter.createSourceFile("test.txt"); + return { + scope: sourceFile.globalScope, + }; + } + // and similar for other declarations: Unions, Enums, Interfaces, and Operations. +} +``` diff --git a/packages/website-astro/src/content/docs/current/extending-typespec/emitter-metadata-handling.md b/packages/website-astro/src/content/docs/current/extending-typespec/emitter-metadata-handling.md new file mode 100644 index 0000000000..e06e888323 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/extending-typespec/emitter-metadata-handling.md @@ -0,0 +1,38 @@ +--- +id: emitter-metadata-handling +title: Handling metadata and visibility in emitters for REST API +--- + +# Handling metadata and visibility in emitters for REST API + +It's important that all emitters for REST API handle [automatic visibility](../standard-library/http/operations.md#automatic-visibility) and [metadata](../standard-library/http/operations.md#metadata) consistently. Make sure to read through the TypeSpec-author documentation of these features to understand how they work. This document will cover how to incorporate them correctly into your own emitter. + +The standard `@typespec/rest` library provides JavaScript API for emitters to interpret API written using its decorators. We'll look at the API that are particularly relevant to these features. + +Note that when we say that emitters must handle things consistently, we mean that they must agree on how data is sent and received over the wire. After all, a TypeSpec _specification_ must be able to serve as a source-of-truth on these details. Nevertheless, emitters are still free to _abstract_ things above this level and to make different choices in doing so. For example, the OpenAPI emitter will sometimes split a single TypeSpec model into multiple suffixed schemas with names like `UserCreate` and `UserUpdate` while a client SDK emitter may choose to emit a single `User` class that that can be serialized to a request or deserialized from a response with different fields present in different cases. In fact, these features were designed specifically to allow a TypeSpec specification to be written in terms of logical entities that emitters could then preserve. + +## Getting started + +If you haven't written an emitter before, start with [emitter basics](./emitters-basics.md). + +Then look at the [REST metadata emitter sample](https://github.com/microsoft/typespec/tree/main/packages/samples/rest-metadata-emitter). This emitter sample uses all of the API discussed below to write out a simple textual representation. It deliberately does not split types like the OpenAPI emitter in order to emphasize that this is not required. Instead, it adds contextual remarks to denote how data depends on context. + +However, if your emitter does want to split types as OpenAPI does, then it will still use the same API. Cross-referencing with where the official [OpenAPI emitter] calls these API can also be instructive. + +## Key API + +These are the main API involved in handling these features. See the linked API reference documentation for more details. + +- [`getRequestVisibility(HttpVerb): Visibility`](../standard-library/http/reference/js-api/index.md#getrequestvisibility) - Use this to determine the visibility implied for data in the request parameters or body. Also note that [`Visibility.Read`](../standard-library/http/reference/js-api/enumerations/Visibility.md#item) is always applied for response data and therefore there is no corresponding API for the response. + +- [`MetadataInfo`](../standard-library/http/reference/js-api/interfaces/MetadataInfo.md) - Create this once for each program using [`createMetadataInfo(Program, MetadataInfoOptions)`](../standard-library/http/reference/js-api/index.md#createmetadatainfo) then use it to reason about metadata and visibility implications with the API below. + +- [`MetadataInfo.getEffectivePayloadType(Type, Visibility): Type`](../standard-library/http/reference/js-api/interfaces/MetadataInfo.md#geteffectivepayloadtype) - Use this recursively on every type that is referenced. When given an anonymous model sourced entirely from a single named model after metadata is moved elsewhere or invisible properties are removed, it will recover the named model. This handles the commonly discussed case of seeing that `op something(...Thing)` receives a `Thing` in its request body, but also many other cases.. + +- [`MetadataInfo.isTransformed(Model, Visibility)`](../standard-library/http/reference/js-api/interfaces/MetadataInfo.md#istransformed) - Use this to check if a type undergoes any changes in shape due to visibility or metadata. If not, this can allow for simplifications in emit. + +- [`MetadataInfo.isPayloadProperty(ModelProperty, Visibility): boolean`](../standard-library/http/reference/js-api/interfaces/MetadataInfo.md#ispayloadproperty) - Use this to check if a property is transmitted as an object property in the payload and is not invisible or metadata sent elsewhere. + +- [`MetadataInfo.isOptional(ModelProperty, Visibility): boolean`](../standard-library/http/reference/js-api/interfaces/MetadataInfo.md#isoptional) - Use this to determine if a property is optional for the given visibility. This will differ from `ModelProperty.isOptional` when the Visibility is Update in which case the property is always considered optional. + +- [`Visibility.Item`](../standard-library/http/reference/js-api/enumerations/Visibility.md#item) - Add this flag when recursing into an array. This moves all metadata into the payload, which can be useful in scenarios like batching API calls. diff --git a/packages/website-astro/src/content/docs/current/extending-typespec/emitters-basics.md b/packages/website-astro/src/content/docs/current/extending-typespec/emitters-basics.md new file mode 100644 index 0000000000..68c629270d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/extending-typespec/emitters-basics.md @@ -0,0 +1,231 @@ +--- +id: emitters +title: Emitters +--- + +# Writing emitters + +TypeSpec emitters are libraries that use various TypeSpec compiler APIs to reflect on the typespec compilation and produce generated artifacts. The typespec standard library includes an emitter for OpenAPI version 3.0, but odds are good you will want to emit TypeSpec to another output format. In fact, one of TypeSpec's main benefits is how easy it is to use TypeSpec as a source of truth for all data shapes, and the ease of writing an emitter is a big part of that story. + +## Getting started + +TypeSpec emitters are a special kind of TypeSpec library and so have the same getting started instructions. Follow [these steps](#todo) to initialize a typespec library. + +## $onEmit + +A TypeSpec emitter exports a function named `$onEmit` from its main entrypoint. It receives two arguments: + +- _context_: The current context including the current progfam being compiled +- _options_: Custom configuration options selected for this emitter + +For example, the following will write a text file to the output directory: + +```typescript +import { EmitContext } from "@typespec/compiler"; +import Path from "path"; + +export async function $onEmit(context: EmitContext) { + const outputDir = Path.join(context.emitterOutputDir, "hello.txt"); + await context.program.host.writeFile(outputDir, "hello world!"); +} +``` + +You can now compile a TypeSpec program passing your library name to --emit, or add it to your `tspconfig.yaml`. + +### Custom configuration options + +To pass your emitter custom options, the options must be registered with the compiler by setting `emitter.options` in your library definition to the JSON schema for the options you want to take. The compiler has a helper to make this easier: + +- _JSONSchemaType_: Takes a TypeScript interface and returns a type that helps you fill in the JSON schema for that type. + +The following example extends the hello world emitter to be configured with a name: + +```typescript +import { JSONSchemaType, createTypeSpecLibrary } from "@typespec/compiler"; +import Path from "path"; + +export interface EmitterOptions { + "target-name": string; +} + +const EmitterOptionsSchema: JSONSchemaType = { + type: "object", + additionalProperties: false, + properties: { + "target-name": { type: "string", nullable: true }, + }, + required: [], +}; + +export const $lib = createTypeSpecLibrary({ + name: "MyEmitter", + diagnostics: {}, + emitter: { + options: EmitterOptionsSchema, + }, +}); + +export async function $onEmit(context: EmitContext) { + const outputDir = Path.join(context.emitterOutputDir, "hello.txt"); + const name = context.options.targetName; + await context.program.host.writeFile(outputDir, `hello ${name}!`); +} +``` + +### Configuration options convention + +- Name options `kebab-case`. So it can be inline with the rest of the cli +- An option called `output-dir` can be created and should override the compiler `output-dir` + +#### Emitter options vs. decorators + +The general guideline is to use a decorator when the customization is intrinsic to the API itself. In other words, when all uses of the TypeSpec program would use the same configuration. This is not the case for `outputFilename` because different users of the API might want to emit the files in different locations depending on how their code generation pipeline is set up. + +## Emitting TypeSpec types to assets on disk + +One of the main tasks of an emitter is finding types to emit. There are three main approaches: + +1. The [emitter framework](./emitter-framework.md), which makes it relatively easy to emit all your TypeSpec types (or a subset, if you wish). +1. The Semantic Walker, which lets you easily run code for every type in the program +1. Custom traversal, which gives you a lot more flexibility than either of the previous approaches at the cost of some complexity. + +### Emitter Framework + +The emitter framework provides handles a lot of hard problems for you while providing an easy-to-use API to convert your TypeSpec into source code or other object graphs. Visit the [emitter framework](./emitter-framework.md) page to learn more. + +### Semantic Walker + +The Semantic Walker will visit every type in the TypeSpec program and call any callbacks you provide for that type. To use, import `navigateProgram` from `@typespec/compiler`. Starting a walk needs two parameters - the program to walk, and an object with callbacks for each type. For example, if we want to do something for every model in the program, we could do the following in our `$onEmit` function: + +```typescript +navigateProgram(program, { + model(m) { + // emit m + }, +}); +``` + +You can provide a callback for every kind of TypeSpec type. The walker will call your callback pre-order, i.e. as soon as it sees a type for the first time it will invoke your callback. You can invoke callback post-order instead by prefixing the type name with `exit`, for example `exitModel(m)`. + +Note that the semantic walker will visit all types in the program including built-in TypeSpec types and typespec types defined by any libraries you're using. Care must be taken to filter out any types you do not intend to emit. Sometimes this is quite difficult, so a custom traversal may be easier. + +### Custom traversal + +Often times you will want to emit specific types, for example types that have a particular decorator or are in a particular namespace. In such cases it is often easier to write a custom traversal to find and emit those types. Once you have a type, you can access its [various fields](#todo) to and emit those types as well if needed. + +For example, let's say we want to emit a text file of model names but only if it has an `@emitThis` decorator. We could filter out such models in the Semantic Walker `model` callback, but it is more efficient to implement `@emitThis` such that it keeps a list of all the types its attached to and iterate that list. We can then traverse into types it references if needed. + +The following example will emit models with the `@emitThis` decorator and also any models referenced by that model. + +[See creating decorator documentation for more details](./create-decorators.md) + +```typescript +import { DecoratorContext, Model, createStateSymbol } from "@typespec/compiler"; + +// Decorator Setup Code + +const emitThisKey = createStateSymbol("emitThis"); + +// @emitThis decorator +export function $emitThis(context: DecoratorContext, target: Model) { + context.program.stateSet(emitThisKey).add(target); +} + +export async function $onEmit(context: EmitContext) { + for (const model of program.stateSet(emitThisKey)) { + emitModel(model); + } +} + +function emitModel(model: Model) { + // emit this model + for (const prop of model.properties.values()) { + // recursively emit models referenced by the parent model + emitModel(prop.type); + } +} +``` + +### Resolving a typespec type + +Sometimes you might want to get access to a known TypeSpec type in the type graph, for example a model that you have defined in your library. + +A helper is provided on the program to do that. + +```ts +program.resolveTypeReference(reference: string): Type | undefined; +``` + +The reference must be a valid typespec reference(Like you would have it in a typespec document) + +**Example** + +```ts +program.resolveTypeReference("TypeSpec.string"); // Resolve typespec string intrinsic type +program.resolveTypeReference("MyOrg.MyLibrary.MyEnum"); // Resolve `MyEnum` defined in `MyOrg.MyLibrary` namespace. +``` + +Error example + +```ts +program.resolveTypeReference("UnknownModel"); // Resolve `[undefined, diagnostics]` where diagnostics is an array of diagnostic explaining why reference is invalid. +program.resolveTypeReference("model Foo {}"); // Resolve `[undefined, diagnostics]` where diagnostics is an array of diagnostic explaining why reference is invalid. +``` + +## Emitting files to disk + +Since an emitter is a node library, you could use standard `fs` APIs to write files. However, this approach has a drawback - your emitter will not work in the browser, and will not work with the test framework that depends on storing emitted files in an in-memory file system. + +Instead, use the compiler [`host` interface](#todo) to access the file system. The API is equivalent to the node API but works in a wider range of scenarios. + +In order to know where to emit files, the emitter context has a `emitterOutputDir` property that is automatically resolved using the `emitter-output-dir` built-in emitter options. This is set to `{cwd}/tsp-output/{emitter-name}` by default, but can be overridden by the user. Do not use the `compilerOptions.outputDir` + +## Handling scalars + +Scalars are types in TypeSpec that most likely have a primitive or built-in datastructure representing those in the target language. + +Recommended logic for emitting scalar is to: + +1. If scalar is a known scalar(e.g. `int32`), emit the known mapping. +2. Otherwise check scalar `baseScalar` and go back to `1.` + 2.1 After resolving which scalar apply any decorators + +:::note +If the scalar is generic and doesn't have a mapping (e.g. integer), we recommend substituting it with the next closest mapping (e.g. integer->int64) and emitting a warning. +::: + +### Examples + +```tsp +@minValue(10) +scalar myInt32 extends int32; + +@minValue(20) +scalar specializedInt32 extends myInt32; +``` + +| Scalar | Expected type | Description | +| ------------------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| `int16` | `int16` | Simple case, emitter can know it is an int16 | +| `myInt32` | `int32` | Emitter doesn't know what myInt32 is. Check baseScalar, sees it is an int32, applies minValue decorator. | +| `specializedInt32` | `int32` | Emitter doesn't know what specializedInt32 is. Check baseScalar, finds myInt32 knows that it is an int32 now and applies minValue override. | +| `float` | `float64` | Emitter knows float but doesn't have a mapping. Emit `float64` and a warning. | + +## Handling Default Values + +Several TypeSpec types have a `default` property that can be used to specify a default value. For example, the following model has a default value of `true` for the `isActive` property: + +```tsp +model User { + isActive?: boolean = true; +} +``` + +These values can be accessed in the emitter using the `default` property on the `ModelProperty` type. + +```ts +const modelProp: ModelProperty = ...; // the isActive ModelProperty type +const defaultValue = modelProp.default; // value: true +``` + +It is important that emitters handle default values in a consistent way. Default values SHOULD NOT be used as client-side default values. Instead, they should be used as a way to specify a default value for the server-side implementation. For example, if a model property has a default value of `true`, the server-side implementation should use that value if the client does not provide a value. Default values SHOULD be expressed in documentation to properly communicate the service-side default. diff --git a/packages/website-astro/src/content/docs/current/extending-typespec/linters.md b/packages/website-astro/src/content/docs/current/extending-typespec/linters.md new file mode 100644 index 0000000000..c60191409b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/extending-typespec/linters.md @@ -0,0 +1,159 @@ +--- +id: linters +title: Linters +--- + +# Linters + +## Linter vs `onValidate` + +TypeSpec library can probide a `$onValidate` hook which can be used to validate the typespec program is valid in the eye of your library. + +A linter on the other hand might be a validation that is optional, the program is correct but there could be some improvements. For example requiring documentation on every type. This is not something that is needed to represent the typespec program but without it the end user experience might suffer. +Linters need to be explicitly enabled. `$onValidate` will be run automatically if that library is imported. + +## Writing a linter + +See examples in `packages/best-practices`. + +### 1. Define a rules + +```ts +import { createLinterRule } from "@typespec/compiler"; +import { reportDiagnostic } from "../lib.js"; + +export const requiredDocRule = createLinterRule({ + name: "no-model-doc", + severity: "warning", + // Short description of what this linter rule does. To be used for generated summary of a linter. + description: "Enforce documentation on models.", + messages: { + default: `Must be documented.`, + // Different messages can be provided + models: `Models must be documented.`, + + // Message can be parameterized + enums: paramMessage`Enum ${"enumName"} must be documented.`, + }, + create(context) { + return { + operation: (op) => { + if (!getDoc(context.program, op)) { + context.reportDiagnostic({ + target: model, + }); + } + }, + model: (model) => { + if (!getDoc(context.program, model)) { + context.reportDiagnostic({ + messageId: "models", + target: model, + }); + } + }, + enums: (type) => { + if (!getDoc(context.program, type)) { + context.reportDiagnostic({ + messageId: "enums", + format: {enumName: type.name} + target: model, + }); + } + }, + }; + }, +}); +``` + +#### Don'ts + +- ❌ Do not call `program.reportDiagnostic` or your library `reportDiagnostic` helper directly in a linter rule + +```ts +// ❌ Bad +program.reportDiagnostic({ + code: "other-code", + target, +}); +// ❌ Bad +reportDiagnostic(program, { + code: "other-code", + target, +}); + +// ✅ Good +context.reportDiagnostic({ + target, +}); +``` + +### Register the rules + + + +When defining your `$lib` with `createTypeSpecLibrary`([See](./basics.md#4-create-libts)) an additional entry for `linter` can be provided + +```ts +// Import the rule defined previously +import { requiredDocRule } from "./rules/required-doc.rule.js"; + +export const $lib = createTypeSpecLibrary({ + name: "@typespec/my-linter", + diagnostics: {}, + linter: { + // Include all the rules your linter is defining here. + rules: [requiredDocRule], + + // Optionally a linter can provide a set of rulesets + ruleSets: { + recommended: { + // (optional) A ruleset takes a map of rules to explicitly enable + enable: { [`@typespec/my-linter/${requiredDocRule.name}`]: true }, + + // (optional) A rule set can extend another rule set + extends: ["@typespec/best-practices/recommended"], + + // (optional) A rule set can disable a rule enabled in a ruleset it extended. + disable: { + "`@typespec/best-practices/no-a": "This doesn't apply in this ruleset.", + }, + }, + }, + }, +}); +``` + +When referencing a rule or ruleset(in `enable`, `extends`, `disable`) the rule or rule set id must be used which in this format: `/` + +## Testing a linter + +To test linter rule an rule tester is provided letting you test a specific rule without enabling the others. + +First you'll want to create an instance of the rule tester using `createLinterRuleTester` passing it the rule that is being tested. +You can then provide different test checking the rule pass or fails. + +```ts +import { RuleTester, createLinterRuleTester, createTestRunner } from "@typespec/compiler/testing"; +import { requiredDocRule } from "./rules/required-doc.rule.js"; + +describe("required-doc rule", () => { + let ruleTester: RuleTester; + + beforeEach(() => { + const runner = createTestRunner(); + ruleTester = createLinterRuleTester(runner, requiredDocRule, "@typespec/my-linter"); + }); + + it("emit diagnostics when using model named foo", async () => { + await ruleTester.expect(`model Foo {}`).toEmitDiagnostics({ + code: "@typespec/my-linter/no-foo-model", + message: "Cannot name a model with 'Foo'", + }); + }); + + it("should be valid to use other names", async () => { + await ruleTester.expect(`model Bar {}`).toBeValid(); + }); +}); +``` diff --git a/packages/website-astro/src/content/docs/current/extending-typespec/writing-scaffolding-template.md b/packages/website-astro/src/content/docs/current/extending-typespec/writing-scaffolding-template.md new file mode 100644 index 0000000000..6821258589 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/extending-typespec/writing-scaffolding-template.md @@ -0,0 +1,122 @@ +--- +title: Scaffolding templates +--- + +# Writting a scaffolding template + +typespec provides scaffolding functionality via the `tsp init` command. + +```bash +tsp init +``` + +## Basic + +A scaffolding template is a `json` document that can be hosted locally or online. +The root of the document is a dictionary allowing multiple templates to be hosted at the same location. + +Each template needs at the minimum: + +- key: Key of the template +- title: Human readable name of the template +- description: Extended description of the template. + +Example: + +```json +{ + "templateKey1": { + "title": "Template #1", + "description": "Create a project representing #1" + }, + "templateKey2": { + "title": "Template #2", + "description": "Create a project representing #2" + } +} +``` + +## Adding libraries + +You can add a list of typespec libraries to include. This will automatically add those libraries to the `package.json` and imported in `main.tsp`. + +```json +{ + "rest": { + "title": "Rest API", + "description": "Create a new project representing a REST API", + "libraries": ["@typespec/rest", "@typespec/openapi3"] + } +} +``` + +## Adding new files + +Additional files.typespec or other types) can be generated by the initializer. The template takes a list of the files to copy and interpolate values. +Each file need the following properties: + +- `path`: Absolute or relative path(to the template file) to the file +- `destination`: Relative path of the file relative to the project root. + +```json +{ + "rest": { + "title": "Rest API", + "description": "Create a new project representing a REST API", + "files": [{ "path": "./models.tsp", "destination": "./models.tsp" }] + } +} +``` + +In models.tsp + +```typespec +model {{parameters.ModelName}} { + +} +``` + +### Interpolating values + +The template can interpolate values in the files. The values available are anything available in the template configuration referenced as it is. +Examples: + +- Reference a parameter `{{parameters.ModelName}}` +- Reference a the template title `{{title}}` + +Additionally the following values and functions are available: + +| Name | Description | +| ------------------------------------- | --------------------------------------------------------------- | +| `directory` | Directory full path where the project should be initialized. | +| `folderName` | Folder name where the project should be initialized. | +| `name` | Name of the project. | +| `libraries` | List of libraries to include | +| `templateUri` | Path where this template was loaded from. | +| Functions | | +| `toLowerCase(value: string)` | Convert string to lower case | +| `normalizePackageName(value: string)` | Normalize package name. It replaces `.` with`-` and toLowerCase | + +## Demanding additional input from the user + +When generating files there might be a need for additional inputs to be retrieved from the user. For example the model name. +The template takes in a map of inputs that will get prompted to the user during initialization. + +```json +{ + "rest": { + "title": "Rest API", + "description": "Create a new project representing a REST API", + "inputs": { + "modelName": { + "type": "text", + "description": "Name of the first model" + } + } + } +} +``` + +Types of input supported: + +- `text`: Ask for a raw text value. diff --git a/packages/website-astro/src/content/docs/current/getting-started/getting-started-http.md b/packages/website-astro/src/content/docs/current/getting-started/getting-started-http.md new file mode 100644 index 0000000000..49bbd1641e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/getting-started/getting-started-http.md @@ -0,0 +1,259 @@ +--- +title: Getting Started with TypeSpec For Http +--- + +Let's create a REST API definition with TypeSpec. TypeSpec has an official HTTP API "binding" called `@typespec/http`. It's a set of TypeSpec declarations and decorators that describe HTTP APIs and can be used by code generators to generate OpenAPI descriptions, implementation code, and the like. +Built on top of the http library there is the rest library `@typespec/rest` which provide some REST concept like resources. + +TypeSpec also has an official OpenAPI emitter called `@typespec/openapi3` that consumes the HTTP API bindings and emits standard [OpenAPI 3.0](https://spec.openapis.org/oas/v3.0.3) descriptions. This can then be fed in to any OpenAPI code generation pipeline. + +References: + +- [Http library](../standard-library/http/reference) +- [Rest library](../standard-library/rest/reference) +- [OpenAPI 3 emitter](../standard-library/openapi3/reference) + +## Setup + +:::note +Make sure to have installed the [editor extension](../introduction/installation.md#install-the-vs-and-vscode-extensions) to get syntax highlighting and intellisense. +::: + +1. Make a new folder somewhere +2. Run `npx --package=@typespec/compiler tsp init` and select the `Generic Rest API` template +3. Run `npm install` to install dependencies +4. Run `npx tsp compile .` to compile the initial file + You can either run `npx tsp compile . --watch` to automatically compile change on save or keep running the command manually after that. + +Resulting file structure: + +``` +main.tsp +tspconfig.yaml +package.json +node_modules/ +tsp-output/ + @typespec/ + openapi3/ + openapi.yaml +``` + +## Service definition and metadata + +A definition for a service is the namespace that contains all the operations for the service and carries top-level metadata like service name and version. TypeSpec offers the following decorators for providing this metadata, and all are optional. + +- `@service` - Mark a namespace as a service namespace. Takes in the following options: + - `title`: Name of the service + - `version`: Version of the service +- `@server` - (In `TypeSpec.Http`) the host of the service. Can accept parameters. + +Here's an example that uses these to define a Pet Store service: + +```typespec +using TypeSpec.Http; +using TypeSpec.Rest; + +/** + * This is a sample server Petstore server. + */ +@service({ + title: "Pet Store Service", + version: "2021-03-25", +}) +@server("https://example.com", "Single server endpoint") +namespace PetStore; +``` + +The `server` keyword can take a third parameter with parameters as necessary: + +```typespec +@server("https://{region}.foo.com", "Regional endpoint", { + /** Region name */ + region?: string = "westus", +}) +``` + +## Resources & routes + +Resource is a general term for anything that can be identified by a URL and manipulated by HTTP methods. +In TypeSpec, the operations for a resource are typically grouped in a namespace. You declare such a namespace by adding the `@route` decorator to provide the path to that resource: + +```typespec +@route("/pets") +namespace Pets { + +} +``` + +Lets add a pet model in the namespace + +```tsp +model Pet { + @minLength(100) + name: string; + + @minValue(0) + @maxValue(100) + age: int32; + + kind: "dog" | "cat" | "fish"; +} +``` + +To define an operation on this resource, you need to provide the HTTP verb for the route using the `@get`, `@head` `@post`, `@put`, `@patch`, or `@delete` decorators. If an HTTP method decorator is not specified then the default is post if there is a body and get otherwise. Lets add an operation to our `Pets` resource: + +```typespec +@route("/pets") +namespace Pets { + op list(): Pet[]; + + // or you could also use + @get op listPets(): Pet[]; +} +``` + +### Automatic route generation + +Instead of manually specifying routes using the `@route` decorator, you automatically generate routes from operation parameters by applying the `@autoRoute` decorator to an operation or interface containing operations. + +For this to work, an operation's path parameters (those marked with `@path`) must also be marked with +the `@segment` decorator to define the preceding path segment. + +This is especially useful when reusing common parameter sets defined as model types. + +For example: + +```typespec +model CommonParameters { + @path + @segment("tenants") + tenantId: string; + + @path + @segment("users") + userName: string; +} + +model User { + name: string; +} +@error +model Error { + message: string; +} + +@autoRoute +interface UserOperations { + @get + getUser(...CommonParameters): User | Error; + + @put + updateUser(...CommonParameters, user: User): User | Error; +} +``` + +This will result in the following route for both operations + +```text +/tenants/{tenantId}/users/{userName} +``` + +## Path and query parameters + +Model properties and parameters which should be passed as path and query parameters use the `@path` and `@query` decorators respectively. Let's modify our list operation to support pagination, and add a read operation to our Pets resource: + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip?: int32, @query top?: int32): Pet[]; + op read(@path petId: int32): Pet; +} +``` + +Path parameters are appended to the URL unless a substitution with that parameter name exists on the resource path. For example, we might define a sub-resource using the following TypeSpec. Note how the path parameter for our sub-resource's list operation corresponds to the substitution in the URL. + +```typespec +@route("/pets/{petId}/toys") +namespace PetToys { + model Toy { + name: string; + } + op list(@path petId: int32): Toy[]; +} +``` + +## Headers + +Model properties and parameters that should be passed in a header use the `@header` decorator. The decorator takes the header name as a parameter. If a header name is not provided, it is inferred from the property or parameter name. Let's add `etag` support to our pet store's read operation. + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): Pet[]; + op read(@path petId: int32, @header ifMatch?: string): { + @header eTag: string; + @body pet: Pet; + }; + @post + op create(@body pet: Pet): {}; +} +``` + +## Request & response bodies + +Request and response bodies can be declared explicitly using the `@body` decorator. Let's add an endpoint to create a pet. Let's also use this decorator for the responses, although this doesn't change anything about the API. + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): { + @body pets: Pet[]; + }; + op read(@path petId: int32): { + @body pet: Pet; + }; + @post + op create(@body pet: Pet): {}; +} +``` + +Note that in the absence of explicit `@body`: + +1. The set of parameters that are not marked @header, @query, or @path form the request body. +2. The set of properties of the return model that are not marked @header, @query, or @path form the response body. +3. If the return type is not a model, then it defines the response body. + +This is how we were able to return Pet and Pet[] bodies without using @body for list and read. We can actually write +create in the same terse style by spreading the Pet object into the parameter list like this: + +```typespec +@route("/pets") +namespace Pets { + @post + op create(...Pet): {}; +} +``` + +## Status codes + +Use the `@statusCode` decorator on a property to declare a status code for a response. Generally, setting this to just `int32` isn't particularly useful. Instead, use number literal types to create a discriminated union of response types. Let's add status codes to our responses, and add a 404 response to our read endpoint. + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): { + @statusCode statusCode: 200; + @body pets: Pet[]; + }; + op read(@path petId: int32, @header ifMatch?: string): { + @statusCode statusCode: 200; + @header eTag: string; + @body pet: Pet; + } | { + @statusCode statusCode: 404; + }; + op create(@body pet: Pet): { + @statusCode statusCode: 204; + }; +} +``` diff --git a/packages/website-astro/src/content/docs/current/getting-started/getting-started.md b/packages/website-astro/src/content/docs/current/getting-started/getting-started.md new file mode 100644 index 0000000000..07c99deaa2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/getting-started/getting-started.md @@ -0,0 +1,8 @@ +--- +id: getting-started +title: Getting Started +--- + +# Getting Started with TypeSpec + +- [Get started with HTTP in TypeSpec](./getting-started-http.md) diff --git a/packages/website-astro/src/content/docs/current/getting-started/typespec-for-openapi-dev.md b/packages/website-astro/src/content/docs/current/getting-started/typespec-for-openapi-dev.md new file mode 100644 index 0000000000..29f8e43858 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/getting-started/typespec-for-openapi-dev.md @@ -0,0 +1,834 @@ +--- +title: TypeSpec For OpenAPI Developer +--- + +# TypeSpec for the OpenAPI developer + +This guide is an introduction to TypeSpec using concepts that will be familiar to developers +that either build or use API definitions in OpenAPI v2 or v3. + +In many cases, this will also describe how the typespec-autorest and openapi3 emitters translate +TypeSpec designs into OpenAPI. + +The document is organized around the features of an OpenAPI v2 or v3 definition. +The idea is that if you know how to describe some API feature in OpenAPI, you can just navigate +to the section of this document for that feature. + +## Data Types + +In OpenAPI [v2](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#data-types)/[v3](https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#data-types), data types are specified using the `type` and `format` fields in a schema. + +The TypeSpec equivalent of OpenAPI data types are the TypeSpec primitive types or [built-in models](https://microsoft.github.io/typespec/docs/language-basics/built-in-types). + +### type and format + +The following table shows how common OpenAPI types map to TypeSpec types: + +| OpenAPI `type`/`format` | TypeSpec type | Notes | +| --------------------------------- | ---------------- | ------------------------------------------------------------------------- | +| `type: integer, format: int32` | `int32` | | +| `type: integer, format: int64` | `int64` | | +| `type: number, format: float` | `float32` | | +| `type: number, format: double` | `float64` | | +| `type: string` | `string` | | +| `type: string, format: byte` | `bytes` | for content-type == 'application/json' or 'text/plain' | +| `type: string, format: binary` | `bytes` | for "binary" content types, e.g. 'application/octet-stream', 'image/jpeg' | +| `type: boolean` | `boolean` | | +| `type: string, format: date` | `plainDate` | | +| `type: string, format: date-time` | `utcDateTime` | RFC 3339 date in coordinated universal time (UTC) | +| `type: string, format: date-time` | `offsetDateTime` | RFC 3339 date with offset | +| `type: string, format: password` | `@secret string` | | + +You can also define a property with no type specified using the TypeSpec `unknown` type. + +```typespec + @doc("This property has no `type` defined.") + noType?: unknown; +``` + +OpenAPI allows any string as a format, and there is a [registry of common formats][Format Registry]. +TypeSpec supports some of these directly. + +[Format Registry]: https://spec.openapis.org/registry/format + +| OpenAPI `type`/`format` | TypeSpec type | Notes | +| ------------------------------- | ------------- | ----- | +| `type: number, format: decimal` | `decimal` | | +| `type: integer, format: int8` | `int8` | | +| `type: integer, format: int16` | `int16` | | +| `type: integer, format: uint8` | `uint8` | | +| `type: string, format: uri` | `url` | | + +For formats that are not supported directly, you can use the built-in `@format` decorator to specify +the format explicitly. + +### JSON Schema assertions + +OpenAPI supports a variety of "assertions" that can be used further restrict the values allowed for a data type. +These are actually borrowed into OpenAPI from JSON Schema. + +For `type: integer` and `type: number` data types: + +| OpenAPI/JSON Schema keyword | TypeSpec construct | Notes | +| --------------------------- | ---------------------------- | ----- | +| `minimum: value` | `@minValue(value)` decorator | | +| `maximum: value` | `@maxValue(value)` decorator | | + +For `type: string` data types: + +| OpenAPI/JSON Schema keyword | TypeSpec construct | Notes | +| --------------------------- | ----------------------------- | ----- | +| `minLength: value` | `@minLength(value)` decorator | | +| `maxLength: value` | `@maxLength(value)` decorator | | +| `pattern: regex` | `@pattern(regex)` decorator | | + +For `type: array` data types: + +| OpenAPI/JSON Schema keyword | TypeSpec construct | Notes | +| --------------------------- | ---------------------------- | ----- | +| `minItems: value` | `@minItems(value)` decorator | | +| `maxItems: value` | `@maxItems(value)` decorator | | + +### enum + +There are two ways to define an `enum` data type. One is with the [TypeSpec `enum` statement](https://microsoft.github.io/typespec/docs/language-basics/enums), e.g.: + + + +```typespec +enum Color { + "red", + "blue", + "green", +} +``` + + +Another is to use the union operation to define the enum values inline, e.g.: + +```typespec +size?: "small" | "medium" | "large" | "x-large"; +``` + +### default + +A model property that specifies a default value using "=" will produce a `default` field in the schema for this property. + +```typespec + answer?: int32 = 42; + color?: string = "purple"; +``` + +produces + +```yaml +answer: + type: integer + format: int32 + default: 42 +color: + type: string + default: purple +``` + +## Host / BasePath / Servers + +In OpenAPI v2, the `host` and `basePath` fields at the top-level of the API definition combine to form the base URL for the API. The paths defined in the `paths` object are appended to this base URL to form the absolute URL for an operation. + +In OpenAPI v3, the top-level `servers` field specifies an array of `server` objects [[v3][v3-server]] with a base URL, which may be parameterized, to which the operation path is appended. + +[v3-server]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#server-object + +In TypeSpec, the `host` in OpenAPI v2 or `servers` in OpenAPI v3 can be specified with the `@server` decorator +on the namespace(From `@typespec/http` library). You can use this decorator multiple times to specify multiple servers. + +## Paths Object + +In OpenAPI, the `paths` object [[v2][v2-paths], [v3][v3-paths]] is the top-level structure for defining the operations of the API, organized with the "path" for the operation. + +[v2-paths]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#paths-object +[v3-paths]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#paths-object + +In TypeSpec, you can specify the path for a namespace, interface, or operation using the `@route` decorator. + +When the value of the `@route` decorator contains path parameters, operations within the scope of the decorator +must declare parameters with the same name and type. If an operation declares a path parameter that is not present +in the route, this defines a new path that is the value from the `@route` decorator with the path parameter appended. + +```typespec +@route("/pets") +namespace Pets { + op create(@body pet: Pet): Pet; // uses path "/pets" + op read(@path petId: int32): Pet; // uses path "/pets/{petId}" +} +``` + +When the `@route` decorator is used within a namespace or interface that also has a `@route` decorator, the path is +obtained by concatenating the routes. + +```typespec +@route("/widgets") +namespace Widgets { + // widgets operations + + @route("/{id}/parts") + namespace Parts { + op list(@path id: string): Part[] | Error; // uses path "/widgets/{id}/parts" + } +} +``` + +## Path Item Object + +In OpenAPI, a path item object [[v2][v2-pathitem], [v3][v3-pathitem]] describes the operations available on a single path. A path may have at most one `get`, `put`, `post`, `patch`, `delete`, or `head` operation. + +[v2-pathitem]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#path-item-object +[v3-pathitem]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#path-item-object + +In TypeSpec, operations are defined within a namespace or interface with a syntax similar to typescript functions. +The HTTP method for an operation can be specified explicitly using a decorator: `@get`, `@put`, `@post`, `@patch`, `@delete`, or `@head`. +If an HTTP method decorator is not specified then the default is `post` if there is a body and `get` otherwise. + +```typespec +@tag("Gadgets") +@route("/gadgets") +namespace Gadgets { + op create(@body gadget: Gadget): Gadget | Error; // uses "post" method + op read(@path id: string): Gadget | Error; // uses "get" method +} +``` + +Other path item fields: + +| OpenAPI `pathItem` field | TypeSpec construct | Notes | +| ------------------------ | ------------------ | ------------------------ | +| `summary` | | Not currently supported. | +| `description` | | Not currently supported. | +| `parameters` | | Not currently supported. | + +## Operation Object + +In OpenAPI, an operation object [[v2][v2-operation], [v3][v3-operation]] describes an operation. + +[v2-operation]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#operation-object +[v3-operation]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#operation-object + +The fields in an OpenAPI operation object are specified with the following TypeSpec constructs: + +| OpenAPI `operation` field | TypeSpec construct | Notes | +| ------------------------- | ------------------------------------------ | ---------------------------------------------------- | +| `tags` | `@tag` decorator | | +| `summary` | `@summary` decorator | | +| `description` | `@doc` decorator or doc comment | | +| `externalDocs` | `@externalDocs` decorator | | +| `operationId` | operation name or `@operationId` decorator | | +| `parameters` | `op` parameter list | see [Parameter Object](#parameter-object) | +| `requestBody` | parameter with `@body` decorator | see [Request Body Object](#request-body-object-oas3) | +| `responses` | `op` return type(s) | see [Responses Object](#responses-object) | +| `callbacks` | | Not currently supported. | +| `deprecated` | `@deprecated` decorator | | +| `security` | | Not currently supported. | +| `servers` | | Not currently supported. | + +### Tags + +Tags can be specified using the `@tag` decorator on an operation. +The `@tag` decorator can also be used on a namespace or interface to specify tags for all operations within the namespace or interface. +Tags are additive, so tags specified on an operation are added to the tags specified on the namespace or interface. +The `@tag` decorator can be used multiple times to specify multiple tags on an operation, namespace, or interface. + +### Description + +Use the `@doc` decorator to specify the description for an operation. The value of the `@doc` decorator can be a multi-line string +and can contain markdown formatting. + +```typespec +@doc(""" +Get status info for the service. +The status includes the current version of the service. +The status value may be one of: +- `ok`: the service is operating normally +- `degraded`: the service is operating in a degraded state +- `down`: the service is not operating +""") +@tag("Status") +@route("/status") +@get +op status(): string; +``` + +You can also use a "doc comment" to specify the description for an operation. A doc comment is a comment that begins with `/**`. +Doc comments may be spread across multiple lines and may contain markdown formatting. + +```typespec +/** + * Get health info for the service. + * The health includes the current version of the service. + * The health value may be one of: + * - `ok`: the service is operating normally + * - `degraded`: the service is operating in a degraded state + * - `down`: the service is not operating + */ +@tag("Health") +@route("/health") +@get +op health(): string; +``` + +### operationId + +You can specify the operationId for an operation using the `@operationId` decorator. +When the `@operationId` decorator is not specified, the operationId is generated from the operation name. +For an operation defined in the top-level namespace, the operationId is the just operation name. +If the operation is defined within a inner namespace or interface, then the operationId is +prefixed with the name of the innermost namespace or interface name. + +Note: this approach will generally produce unique operationIds, as required by OpenAPI, +but it is possible to create duplicate operationIds. + +## Parameter Object + +In OpenAPI, a parameter object [[v2][v2-parameter], [v3][v3-parameter]] describes a single operation parameter. + +[v2-parameter]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameter-object +[v3-parameter]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#parameter-object + +The following fields of a parameter object are common to both OpenAPI v2 and v3: + + +| OpenAPI `parameter` field | TypeSpec construct | Notes | +| ------------------------- | -------------------- | ------------------------------------- | +| `name` | parameter name | | +| `in` | decorator | `@query`, `@path`, `@header`, `@body` | +| `description` | `@doc` decorator | | +| `required` | from parameter "optionality" | a "?" following the parameter name indicates it is optional (`required: false`), otherwise it is required (`required: true`) | +| `allowEmptyValue` | | Not currently supported. | + + +### OpenAPI v2 + +The following fields of a parameter object are specific to OpenAPI v2: + +| OpenAPI v2 `parameter` field | TypeSpec construct | Notes | +| ---------------------------- | ------------------------------------------- | ----------------------------- | +| `type` | parameter type | see [Data Types](#data-types) | +| `collectionFormat` | `format` parameter on `@query` or `@header` | | + +#### Collection Formats + +In OpenAPI v2, the `collectionFormat` field of a query or header parameter object specifies how multiple values are delimited. +You can use the `format` field of the `@query` or `@header` decorator to specify the collection format. + +```typespec + @get read( + @path id: string, + @query({format: "csv"}) csv?: string[], // has collectionFormat: "csv" + @query({format: "multi"}) multi?: string[], // has collectionFormat: "multi" + ): Widget | Error; +``` + +### OpenAPI v3 + +The following fields of a parameter object are specific to OpenAPI v3: + +| OpenAPI v3 `parameter` field | TypeSpec construct | Notes | +| ---------------------------- | ------------------------------------------- | ----------------------------------- | +| `style` | `format` parameter on `@query` or `@header` | | +| `explode` | `format` parameter on `@query` or `@header` | | +| `schema` | parameter schema | see [Schema Object](#schema-object) | +| `deprecated` | | Not currently supported. | +| `example` | | Not currently supported. | +| `examples` | | Not currently supported. | +| `content` | | Not currently supported. | + +## Request Body Object (OAS3) + +In OpenAPI v3, the operation request body is defined with a [Request Body object] rather than as a parameter. + +[Request Body object]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#request-body-object + +An OpenAPI v3 Request Body object corresponds to a TypeSpec `op` parameter with the `@body` decorator. + + +| OpenAPI `requestBody` field | TypeSpec construct | Notes | +| --------------------------- | ----------------------- | ------------ | +| `description` | `@doc` decorator | | +| `required` | parameter "optionality" | a "?" following the parameter name indicates it is optional (`required: false`), otherwise it is required (`required: true`) | +| `content` | `@body` parameter type | | + + +The media type of the request body is specified with a `content-type` header. If `content-type` has multiple values +then `content` will have one entry for each value. + +```typespec +@put op uploadImage(@header contentType: "image/png", @body image: bytes): void; +@post op analyze( + @header contentType: "application/octet-stream" | "application/pdf" | "image/jpeg", + @body image: bytes, +): string | Error; +``` + +To get multiple `content` entries with different schemas (say one structured and one binary), +you need to define two separate operations that share the same path and method. +You do with with the `@sharedRoute` decorator. + +```typespec +@route(":process") +namespace Process { + @sharedRoute + @post + op process(...Widget): Widget | Error; + + model CsvBody { + @header contentType: "text/csv"; + @body _: string; + } + @sharedRoute + @post + op process2(...CsvBody): Widget | Error; +} +``` + +## Responses Object + +In OpenAPI, the responses object [[v2][v2-responses], [v3][v3-responses]] specifies the possible responses for an operation. +The responses object maps a HTTP response code to the expected response. + +[v2-responses]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#responses-object +[v3-responses]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#responses-object + +In TypeSpec, operation responses are defined by the return types of the `op`. The status code for a response can be specified as a property in the return type with the `@statusCode` decorator. The value of the property with the `@statusCode` decorator should be an HTTP status code or union of status codes. When the value is a union of status codes, a response is generated for each status code in the union. + +If a return type does not contain a `statusCode`, the default is `200` except for `void` which defaults to `204`. + +To get the `default` response, specify the `@error` decorator on the return type model. + +```typespec +@get op read(@path id: string): Widget; // has "200" response +@delete op delete(@path id: string): void; // has "204" response +// has "200" and "201" response +@put op create(@body widget: Widget): { + @statusCode _: "200" | "201"; + @body body: Widget; +}; +// has "200" and "default" response +@post op update(@body widget: Widget): Widget | Error; +``` + +The TypeSpec.Http package also defines several standard response types. + +| HTTP Status Code | TypeSpec construct | +| ---------------- | ---------------------- | +| `200` | `OkResponse` | +| `201` | `CreatedResponse` | +| `202` | `AcceptedResponse` | +| `204` | `NoContentResponse` | +| `301` | `MovedResponse` | +| `304` | `NotModifiedResponse` | +| `401` | `UnauthorizedResponse` | +| `404` | `NotFoundResponse` | +| `409` | `ConflictResponse` | + +You can intersect these standard response types with your own response types. + +```typespec +// has "200", '409', and "default" responses +@post op update(@body widget: Widget): Widget | (ConflictResponse & Error) | Error; +``` + +### Response Object + +In OpenAPI, a response object [[v2][v2-response], [v3][v3-response]] describes a single response for an operation. +The structure of the response object changed significantly from OpenAPI v2 to OpenAPI v3, but there are many +elements common to both. + +[v2-response]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#response-object +[v3-response]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#response-object + +The fields in an OpenAPI response object are specified with the following TypeSpec constructs: + +| OpenAPI `response` field | TypeSpec construct | Notes | +| ------------------------ | -------------------------------------------------- | -------------------------------------------------- | +| `description` | `@doc` decorator | | +| `headers` | fields in the return type with `@header` decorator | required or optional based on optionality of field | +| `schema` (OAS2) | return type or type of `@body`` property | | +| `content` (OAS3) | return type or type of `@body`` property | | +| `examples` (OAS3) | | Not currently supported. | +| `links` (OAS3) | | Not currently supported. | + +```typespec +@get op read(@path id: string): { + @doc("the widget") + @body + widget: Widget; + + @header xRateLimitRemaining: number; + @header xRateLimitReset: number; +}; +``` + +The media type of the request body is specified with a `content-type` header. If `content-type` has multiple values +then `content` will have one entry for each value. + +To get multiple `content` entries with different schemas, use a union type. + +```typespec +@tag("Response Content") +@route("/response-content") +namespace ResponseContent { + @get op read(@path id: string): Widget | { + @header contentType: "text/html"; + @body _: string; + } | { + @header contentType: "image/jpeg"; + @body _: bytes; + }; +} +``` + +## Schema Object + +OpenAPI schemas are represented in TypeSpec by [models](https://microsoft.github.io/typespec/docs/language-basics/models/). +Models have any number of members and can extend and be composed with other models. + +Models can be defined with the `model` statement and then referenced by name, which generally results in a `$ref` to a schema for the model in the `definitions` or `components.schemas` section of the OpenAPI document. + +TypeSpec supports the ["spread" operator](https://microsoft.github.io/typespec/docs/language-basics/models/#spread) (`...`), which copies the members of the source model into the target model. +But TypeSpec processes all spread transformations before emitters are invoked, so this form of reuse is not represented in the emitted OpenAPI. + +The spread operation is useful if you want one or more properties to be present in several different models but in a standard fashion. For example: + +```typespec +model Legs { + @doc("number of legs") legs: int32; +} + +model Dog { + name: string; + ...Legs; +} + +model Cat { + name: string; + ...Legs; +} + +model Snake { + name: string; + // snakes have no legs +} +``` + +### additionalProperties + +You can generate a schema with `additionalProperties` with the TypeSpec `Record` construct. + +```typespec + bar: Record; +``` + +is produced as + +```yaml +bar: + type: object + additionalProperties: {} +``` + +To get a schema having both `properties` and `additionalProperties`, define a model that extends `Record`. + +```typespec +model Bar extends Record { + bar?: string; +} +``` + +produces + +```yaml +Bar: + type: object + properties: + bar: + type: string + additionalProperties: {} +``` + +To define a schema with `additionalProperties` that has a specific type, use the `Record` construct with a type parameter. + +```typespec + bar: Record; +``` + +results in + +```yaml +bar: + type: object + additionalProperties: + type: string +``` + +### allOf and polymorphism using allOf + +TypeSpec also supports single inheritance of models with the `extends` keyword. This construct can be used to produce an `allOf` with a single element (the parent schema) in OpenAPI. For example: + +```typespec +model Pet { + name: string; +} + +model Cat extends Pet { + meow: int32; +} + +model Dog extends Pet { + bark: string; +} +``` + +TypeSpec does not currently provide a means to produce an `allOf` with more than one element -- these are generally treated as "composition" in code generators and thus better represented in TypeSpec with the spread operator. + +Models with a `@discriminator` decorator can be extended to produce polymorphic schemas in either OpenAPI v2 or v3 using `allOf`. +This schema produced for the base model will be defined with a `discriminator` property and schemas for the child models will `allOf` the base schema and add additional properties. + +For example: + +```typespec +@discriminator("kind") +model Pet { + name: string; + weight?: float32; +} +model Cat extends Pet { + kind: "cat"; + meow?: int32; +} +model Dog extends Pet { + kind: "dog"; + bark?: string; +} +``` + +generates: + +```typespec + Cat: + type: object + properties: + kind: + type: string + enum: + - cat + meow: + type: integer + format: int32 + required: + - kind + allOf: + - $ref: '#/components/schemas/Pet' + Dog: + type: object + properties: + kind: + type: string + enum: + - dog + bark: + type: string + required: + - kind + allOf: + - $ref: '#/components/schemas/Pet' + Pet: + type: object + properties: + kind: + type: string + description: Discriminator property for Pet. + name: + type: string + weight: + type: number + format: float + discriminator: + propertyName: kind + mapping: + cat: '#/components/schemas/Cat' + dog: '#/components/schemas/Dog' + required: + - name +``` + +### Polymorphism using anyOf and oneOf (OAS3) + +Polymorphism can also be represented in OpenAPI v3 with `anyOf` or `oneOf` constructs. +These can be represented in TypeSpec with a union type. + +```typespec +union Pet { + cat: Cat, + dog: Dog, +} + +model Cat { + meow?: int32; +} + +model Dog { + bark?: string; +} +``` + +generates a Pet schema with `anyOf`. + +```yml +Pet: + anyOf: + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Dog" +``` + +The openapi emitter uses `anyOf` by default because the schemas may not be mutually exclusive. +But the `@oneOf` decorator of the OpenAPI library can be used to force the use of `oneOf` instead. + +```typespec +import "@typespec/openapi3"; +using OpenAPI; + +@oneOf +union Pet { + cat: Cat, + dog: Dog, +} +``` + +produces: + +```yml +Pet: + oneOf: + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Dog" +``` + +To make Pet a discriminated union, add the `@discriminator` decorator and add the discriminator property +with a string literal value to each of the child schemas. + +```typespec +@discriminator("kind") +@oneOf +union Pet { + cat: Cat, + dog: Dog, +} +model Cat { + kind: "cat"; + meow?: int32; +} +model Dog { + kind: "dog"; + bark?: string; +} +``` + +results in the following schema for Pet: + +```yml +Pet: + oneOf: + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Dog" + discriminator: + propertyName: kind + mapping: + cat: "#/components/schemas/Cat" + dog: "#/components/schemas/Dog" +``` + +## definitions / components + +OpenAPI supports reuse of schemas, parameters, responses, and other elements with the `definitions` (OAS2) or `components` (OAS3) section of an OpenAPI definition. + +Referencing a model by name (not with "spread"), as an `op` parameter or return type or as the type of a property in another model, generally results in a `$ref` to a schema for the model in the `definitions` or `components.schemas` section of the OpenAPI document. + +Reusable parameters can be defined as members of a model and then incorporated into an operation parameter list using the spread operator. For example: + +```typespec +model PetId { + @path petId: int32; +} + +namespace Pets { + op read(...PetId): Pet | Error; +} +``` + +results in a `$ref` to the named parameter `PetId` in either `parameters` or `components.parameters`. + +## Info Object + +In OpenAPI, the `info` object [[v2][v2-info], [v3][v3-info]] contains metadata about the API such as a `title`, `description`, `license`, and `version`. + +[v2-info]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#info-object +[v3-info]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#info-object + +In TypeSpec this information is specified with [decorators on the namespace][typespec-service-metadata]. + +| OpenAPI `info` field | TypeSpec decorator | Notes | +| -------------------- | ---------------------- | --------------------------- | +| `title` | `@service({title: }` | TypeSpec built-in decorator | +| `version` | `@service({version: }` | TypeSpec built-in decorator | +| `description` | `@doc` | TypeSpec built-in decorator | +| `license` | `@info` | | +| `contact` | `@info` | | + +[typespec-service-metadata]: https://microsoft.github.io/typespec/docs/standard-library/http/#service-definition-and-metadata + +```typespec +@doc("The Contoso Widget Service provides access to the Contoso Widget API.") +@service({ + title: "Widget Service", + version: "1.0.0", +}) +@info({ + contact: { + name: "API Support", + email: "contact@contoso.com", + }, + license: { + name: "Apache 2.0", + url: "https://www.apache.org/licenses/LICENSE-2.0.html", + }, +}) +namespace DemoService; +``` + +## Consumes / Produces (OAS2) + +In OpenAPI v2, the top-level `consumes` and `produces` fields specify a list of MIME types an operation can consume / produce +when not overridden by a `consumes` or `produces` on an individual operation. + +The typespec-autorest emitter previously supported `@produces` and `@consumes` decorators on a namespace, but these are deprecated +in favor of explicit `content-type` and `accept` header properties in request and response bodies. + +## securityDefinitions / securitySchemes Object + +Use `@useAuth` decorator from the `@typespec/rest" library + +```typespec +using TypeSpec.Http; +@useAuth(OAuth2Auth<["read", "write"]>) +namespace MyService; +``` + +## Specification Extensions + +You can add arbitrary specification extensions ("x-" properties) to a model or an operation with the `@extension` decorator. +For example: + +```typespec +namespace Pets { + @extension("x-streaming-operation", true) op read(...PetId): Pet | Error; +} +``` diff --git a/packages/website-astro/src/content/docs/current/introduction/configuration/configuration.md b/packages/website-astro/src/content/docs/current/introduction/configuration/configuration.md new file mode 100644 index 0000000000..a06e143a6a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/configuration/configuration.md @@ -0,0 +1,440 @@ +--- +title: Configuration +--- + +# Compiler and Libraries configurations + +TypeSpec compiler and libraries can be configured either via a [configuration file](#configuration-file) or [command line flags](#command-line-flags). + +## Configuration file + +TypeSpec configuration can be provided via the `tspconfig.yaml` configuration file. + +### Discovery + +TypeSpec compiler will look for the closest `tspconfig.yaml` file located in the same directory or closest parent directory from the typespec entrypoint. + +For example if running `tsp compile /dev/foo/bar/main.tsp`, the compiler will lookup the file at the folllowing paths(In this order): + +- `/dev/foo/bar/tspconfig.yaml` +- `/dev/foo/tspconfig.yaml` +- `/dev/tspconfig.yaml` +- `/tspconfig.yaml` + +### Schema + +The file is a `yaml` document with the following structure. See the [next section](#typespec-configuration-options) for details on each option. + +```typespec +model TypeSpecProjectSchema { + extends?: string; + parameters?: Record<{default: string}> + "environment-variables"?: Record<{default: string}> + "warn-as-error"?: boolean; + "output-dir"?: boolean; + "trace"?: string | string[]; + imports?: string; + emit?: string[]; + options?: Record; + linter?: LinterConfig; +} + +model LinterConfig { + extends?: RuleRef[]; + enable?: Record; + disable?: Record; +} +``` + +### Extending project files + +There is cases where you might want to build different folders with different options(for example different emitters) but want to share some configuration for both as well. + +For that you can use the `extends` property of the configuration file + +in `/tspconfig.yaml` + +```yaml +options: + emitter1: + some-option: my-name + emitter2: + some-other-option: This is a title +``` + +in `/proj2/tspconfig.yaml`, enable `emitter1` using the options specified in the parent `tspconfig.yaml` + +```yaml +extends: ../tspconfig.yaml +emit: + - emitter1 +``` + +### Variable interpolation + +The typespec project file provide variable interpolation using: + +- built-in variables +- environment variables +- config file parameters +- emitter options can reference each other + +Variable interpolation is done using an variable expression surrounded by `{` and `}`. (`{}`) + +Examples: + +- `{output-dir}/my-path` +- `{env.SHARED_PATH}/my-path` + +### Emitter path config interpolation + +Some config of emitters can be interpolated using a special rule that will collapse a path. + +If a variable is followed by a `/` or `.` and the emitter interpolating the config doesn't provide that variable it will then omit the path segment. + +For example given the following config value: `{service-name}/output.{version}.json` +The following would get produced + +| Service name value | Version value | Result | +| ------------------ | ------------- | ------------------------- | +| `"PetStore"` | `"v1"` | `PetStore/output.v1.json` | +| `"PetStore"` | `undefined` | `PetStore/output.json` | +| `undefined` | `"v1"` | `output.v1.json` | +| `undefined` | `undefined` | `output.json` | + +#### Built-in variables + +| Variable name | Scope | Description | +| -------------- | --------------- | ------------------------------------------------------------------------------------ | +| `cwd` | \* | Points to the current working directory | +| `project-root` | \* | Points to the the tspconfig.yaml file containing folder. | +| `output-dir` | emitter options | Common `output-dir` See [output-dir](#output-dir---configure-the-default-output-dir) | +| `emitter-name` | emitter options | Name of the emitter | + +#### Project parameters + +A typespec project file can specify some parameters that can then be specified via the CLI. + +`{cwd}` and `{project-root}` variables can be used in the default value of those parmeters. + +The parameters can then be referenced by their name in a variable interpolation expression. + +Parameters must have a default value. +**Example:** + +```yaml +parameters: + base-dir: + default: "{cwd}" + +output-dir: {base-dir}/output +``` + +The parameter can then be specified with `--arg` in this format `--arg "="` + +```bash +tsp compile . --arg "base-dir=/path/to/base" +``` + +#### Environment variables + +A typespec project file can define which environment variables it can interpolate. + +`{cwd}` and `{project-root}` variables can be used in the default value of the environment variables. + +The environment variables can then be referenced by their name in a variable interpolation expression with the `env.` prefix. + +Environment variables must have a default value. + +**Example:** + +```yaml +environment-variables: + BASE_DIR: + default: "{cwd}" + +output-dir: {env.BASE_DIR}/output +``` + +#### Emitter options + +Emitter options can reference each other using the other option name as the variable expresion. + +Can only interpolate emitter options from the same emitter. + +```yaml +options: + @typespec/openapi3: + emitter-output-dir: {output-dir}/{emitter-sub-folder} + emitter-sub-folder: bar + +``` + +## TypeSpec Configuration Options + +| Config | Cli | Description | +| --------------- | ------------------------- | -------------------------------------------------------- | +| `output-dir` | `--output-dir` | Default output directory | +| `config` | `--config` | Path to config file or folder to search for config file. | +| `trace` | `--trace` | Specify tracing area to enable | +| `warn-as-error` | `--warn-as-error` | Treat warning as error | +| `imports` | `--import` | Additional imports to include | +| `emit` | `--emit` | Emitter configuration | +| `options` | `--option` or `--options` | Emitter configuration | +| `linter` | | Linter configuration | + +### `output-dir` - Configure the default output dir + +Specify the common output-dir for all emitters. See [this](#output-directory-configuration) to configure per emitter. + +```yaml +output-dir: {cwd}/typespec-build +``` + +Output dir can be provided using the `--output-dir` cli flag + +```bash +tsp compile . --output-dir "./typespec-build" +``` + +Output dir must be an absolute path in the config. Use `{cwd}` or `{project-root}` to explicitly specify what it should be relative to. + +See [output directory configuration for mode details](#output-directory-configuration) + +### `trace` - Configure what to trace + +Configure what area to trace. See [tracing docs](./tracing.md) + +```yaml +# Trace all. +trace: * + +# or specific areas +trace: + - import-resolution + - projection +``` + +Trace can be provided using the `--trace` cli flag + +```bash +tsp compile . --trace import-resolution --trace projection +``` + +### `warn-as-error` - Treat warning as error + +All warnings will be emitted as error. Result in a non zero exit code in case of warning. + +**This is recommended to use in CI to prevent warning from being unadressed.** + +```yaml +warn-as-error: true +``` + +or via the cli + +```bash +tsp compile . --warn-as-error +``` + +### `--ignore-deprecated` + +Suppress all `deprecated` diagnostics that are raised when declarations are marked with the `#deprecated` directive. + +```yaml +tsp compile . --ignore-deprecated +``` + +### `imports` - Configure additional imports + +```yaml +imports: + - sidecar.tsp +``` + +Specify additional typespec files to import + +```bash +tsp compile . --import "sidecar.tsp" +``` + +### `emit` - Specifying which emitters to run + +Specify which emitters to use and their options if applicable. + +The value can be the name of an emitter or a path to the emitter package/entrypoint. + +```yaml +emit: + - emitter1 # Package name + - /path/to/emitter2 # Give a path to an emitter +``` + +or via the cli + +```bash +tsp compile . --emit emitter1 --emit /path/to/emitter2 +``` + +### `options` - Configuring emitters + +Emitters can define a set of options, those can be set as the value of the map. + +```yaml +options: + # Enable and configure emitter1 + emitter1: + option1: "option1-value" + option2: "option1-value" + # Only enable emitter2 + emitter2: true +``` + +Emitters options can also be provided using the `--option` in this format `--option=.=` + +```bash + +tsp compile . --option "emitter1.option1=option1-value" +``` + +Options specified via the CLI take precedence over the ones specified in `tspconfig.yaml`. + +#### Emitters built-in options + +##### `emitter-output-dir` + +Represent the path where the emitter should be outputing the generated files. + +Default: `{output-dir}/{emitter-name}` + +See [output directory configuration for mode details](#output-directory-configuration) + +### `linter` - Configuring linters + +Configure which linter rules should be enabled in this repository. Referencing to a rule or ruleset must be using their id which is in this format `:` + +```yaml +linter: + extends: # Extend `recommended` ruleset from @typespec/best-practices library + - "@typespec/best-practices/recommended" + + enable: # Explicitly enable some rules + "@typespec/best-practices/no-x": true + + disable: # Disable some rules defined in one of the ruleset extended. + "@typespec/best-practices/no-y": "This rule cannot be applied in this project because X" +``` + +## Emitter control cli flags + +### `--no-emit` + +Disable emitting. If emitters are still specified it will still run the emitter but emitters shouldn't be writing anything to disk. + +Can also be used to hide the "There is no emitters warning". + +```yaml +tsp compile . --no-emit +``` + +## Other Command line flags + +### `--config` + +Specify a different config file + +```bash +tsp compile . --config ./tspconfig.alt.yaml +``` + +### `--watch` + +Start the tsp compiler in watch mode: watch for file changes and compile on save. + +```bash +tsp compile . --watch +``` + +:::caution +Known issue: the watch mode does not pickup changes in JS files that are indirectly included(Only imported via another JS file.) +::: + +### `--nostdlib` + +Don't load the TypeSpec standard library. + +```bash +tsp compile . --nostdlib +``` + +### `--version` + +Log the version of the tsp compiler. + +```bash +tsp compile . --version +``` + +### `--pretty` + +**Default: `true`** + +Enable/Disable pretty logging(Colors, diagnostic preview, etc.). + +```bash +tsp compile . --pretty=false +``` + +## Output directory configuration + +Typespec compiler will provide a unique output directory for each emitter that is being run to reduce conflicts. +By default the output-dir of an emitter is set to this value: + +``` +{output-dir}/{emitter-name} +``` + +where + +- `output-dir` is the compiler common `output-dir` that can be configured via `--output-dir` +- `emitter-name` is the name of the emitter package(for example `@typespec/openapi3`) + +Example: +Given the following emitters: `@typespec/openapi3` and `@typespec/jsonschema`, the default output folder structure would be + +``` +{project-root}/tsp-output: + @typespec: + openapi3 + ... openapi3 files ... + jsonschema + ... json schema files ... +``` + +Changing the compiler `output-dir` with `--output-dir` or setting that value in the tspconfig.yaml would result in the following structure + +``` +--output-dir={cwd}/my-custom-output-dir + +{cwd}/my-custom-output-dir: + @typespec: + openapi3 + ... openapi3 files ... + jsonschema + ... json schema files ... + +``` + +Changing a specific emitter output-dir can be done by setting that emitter `emitter-output-dir` option + +``` +--option "@typespec/openapi3.output-dir={projectroot}/openapispec" + +{project-root} + openapispec: + ... openapi3 files ... + tsp-output: + @typespec: + jsonschema + ... json schema files ... +``` diff --git a/packages/website-astro/src/content/docs/current/introduction/configuration/tracing.md b/packages/website-astro/src/content/docs/current/introduction/configuration/tracing.md new file mode 100644 index 0000000000..3536f687f7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/configuration/tracing.md @@ -0,0 +1,85 @@ +--- +title: Tracing +--- + +# Tracing + +By default the TypeSpec Compiler will build without any debug information. The standard output will be minimal and limited to any `warning` or `error` diagnostics emitted during compilation. + +Some additional information is however being collected and can be revealed using the `--trace` cli flag. + +```bash +tsp compile . --trace import-resolution +``` + +You can use the `--trace` option multiple times if there is multiple areas that should be logged from. + +```bash +tsp compile . --trace import-resolution --trace projection +``` + +Using `--trace *` will log everything. This might be a bit overwhelming but you can [pick and choose which trace area to include](#trace-selection) + +It can also be provided via the `tspconfig.yaml` file: + +```yaml +trace: * + +trace: + - import-resolution + - projection +``` + +## Trace selection + +The tracing system in the tsp compiler works by having each trace under an area. The area name is a dot `.` separated string of area segments. + +When filtering which area to select you can use this area path to select which area is going to be revealed. +The filter follow the same naming style, except the last segment could be a wildcard `*`. This is however the same result as omitting the last segment all together. In other words, those filter have the exact same behavior: + +- `foo` and `foo.*` +- `one.two` and `one.two.*` + +For example, assuming we'd have those 3 areas + +- `one.two.three` +- `one.foo` +- `bar.info` + +Using: + +- `*` will log everything +- `one` will log everything under `one`(`one.two.three`, `one.foo`) +- `bar` will log everything under `bar`(`bar.info`) +- `one.foo` will log everything under `one.foo`(`one.foo`) +- `other` will log everything under `other` which is nothing here. + +## Compiler Trace Areas + +This is a list of the trace area used in the compiler + +| Area | Description | +| ------------------------------ | -------------------------------------------------------------------- | +| `compiler.options` | Log the resolved compiler options | +| `import-resolution.library` | Information related to the resolution of import libraries | +| `projection.log` | Debug information logged by the `log()` function used in projections | +| `bind.js` | Information when binding JS files | +| `linter.register-library` | Information that a library rules will be loaded | +| `linter.register-library.rule` | Information about a rule that is being registered | +| `linter.extend-rule-set.start` | Information about a ruleset it is about to extend | +| `linter.extend-rule-set.end` | Information about rules enabled after extending a ruleset | +| `linter.lint` | Start the lint process and show information of all the rules enabled | + +## Tracing in TypeSpec library + +TypeSpec libraries can emit their own tracing that can be collected using the same mechanism. It is recommended that a library scope their tracing area under the library name to prevent collision. This can be achieved by calling the `sub(subArea: string)` method on the tracer. + +```ts +const tracer = program.tracer.sub("my-library"); +``` + +the tracer is then available for trace collection + +```ts +tracer.trace("emitting-ts", "Emitting ts interface"); +``` diff --git a/packages/website-astro/src/content/docs/current/introduction/editor/vs.md b/packages/website-astro/src/content/docs/current/introduction/editor/vs.md new file mode 100644 index 0000000000..4ef5613854 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/editor/vs.md @@ -0,0 +1,38 @@ +--- +title: TypeSpec Visual Studio Extension +--- + +## Installation + +:::note +Extension is not available yet in the marketplace and must be installed via the command line. +::: + +```bash +tsp vs install +``` + +## Configure + +1. Create a file `.vs/VSWorkspaceSettings.json` at the root of the project. +2. Add configuration as key value pair in this file. Example: + +```json +{ + "typespec.tsp-server.path": "${workspaceFolder}/my-nested-project/node_modules/@typespec/compiler" +} +``` + +TypeSpec wil interpolate a few variables using this pattern `${}`. For example `${workspaceFolder}`. + +Available variables: + +- `workspaceFolder`: Correspond to the root of your Visual Studio workspace. + +## Uninstall + +Uninstalling can be done via the Visual Studio extension manager or via the command line: + +```bash +tsp vs uninstall +``` diff --git a/packages/website-astro/src/content/docs/current/introduction/editor/vscode.md b/packages/website-astro/src/content/docs/current/introduction/editor/vscode.md new file mode 100644 index 0000000000..81e5427cfe --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/editor/vscode.md @@ -0,0 +1,46 @@ +--- +title: TypeSpec VSCode extension +--- + +## Installation + +:::note +Extension is not available yet in the marketplace and must be installed via the command line. +::: + +```bash +tsp code install + +# For VSCode insiders +tsp code install --insiders +``` + +## Configure + +TypeSpec wil interpolate a few variables using this pattern `${}`. For example `${workspaceFolder}`. + +Available variables: + +- `workspaceFolder`: Corespond to the root of your Visual Studio workspace. + +### `typespec.tsp-server.path`: Configure the server path + +There are cases where the TypeSpec project is located in a subfolder. In such cases, the TypeSpec extension is not able to find the tsp compiler automatically and needs a little guidance. +This setting provides the ability to configure where the tsp compiler is located. + +```json +{ + "typespec.tsp-server.path": "${workspaceFolder}/my-nested-project/node_modules/@typespec/compiler" +} +``` + +## Uninstall + +Uninstalling can be done via the Visual Studio Code extension manager or via the command line: + +```bash +tsp code uninstall + +# For VSCode insiders +tsp code uninstall --insiders +``` diff --git a/packages/website-astro/src/content/docs/current/introduction/faq.md b/packages/website-astro/src/content/docs/current/introduction/faq.md new file mode 100644 index 0000000000..15f3867c50 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/faq.md @@ -0,0 +1,16 @@ +--- +id: faq +title: FAQ +--- + +# Frequently Asked Questions + +## `Cannot find package 'x' imported from 'y'` but not using this package + +This is most likely due to package y having a `peerDependency` on package `x` and package x wasn't installed. +Verify the version of npm you are using. Before version 7 peerDependencies would not get installed automatically and you would have to manually install them. + +### Solutions + +- Update npm `npm install -g npm` +- If you cannot update npm, then adding the dependencies to your project dependency should resolve the issue `npm install x` diff --git a/packages/website-astro/src/content/docs/current/introduction/formatter.md b/packages/website-astro/src/content/docs/current/introduction/formatter.md new file mode 100644 index 0000000000..330e791b3e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/formatter.md @@ -0,0 +1,44 @@ +--- +id: formatter +title: Formatter +--- + +# Formatter + +TypeSpec comes with a built-in formatter. The formatter can be used in different ways: + +- [Via the cli](#via-the-cli) +- Via the vscode/vs extension +- As a prettier plugin + +## Via the cli + +Format all typespec files: + +```bash +tsp format **/*.tsp +``` + +Validate that the files are formatted but don't format them. Useful for enforcing in CI. + +```bash +tsp format --check **/*.tsp +``` + +## Via the VSCode or VS extension + +When using the VS Code or Visual Studio extensions, the tsp formatter is automatically available. + +Using the keyboard shortcut for formatting the document (`alt+shift+F` by default) when inside a TypeSpec file will format the document. + +## Via prettier + +Underneath the tsp formatter is a prettier plugin. If you already have a prettier configuration for formatting other languages it can be convenient to just have typespec plug in into this existing pipeline. + +In your prettier config file, add: + +```yaml +plugins: + - "./node_modules/@typespec/prettier-plugin-typespec" +overrides: [{ "files": "*.tsp", "options": { "parser": "typespec" } }] +``` diff --git a/packages/website-astro/src/content/docs/current/introduction/installation.md b/packages/website-astro/src/content/docs/current/introduction/installation.md new file mode 100644 index 0000000000..603a93f95a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/installation.md @@ -0,0 +1,61 @@ +--- +id: installation +title: Installation +--- + +# Installation + +## Requirements + +Install [Node.js 16 LTS](https://nodejs.org/en/download/) and ensure you are able to run the `npm` command in a command prompt: + +```bash +npm --version +``` + +It is recommended to have npm 7+. To update npm run `npm install -g npm` + +## Install tsp compiler + +First step is to install the tsp compiler/cli + +```bash +npm install -g @typespec/compiler +``` + +## Install the VS and VSCode extensions + +TypeSpec provides extension for the following editors: + +- [Visual Studio Code](./editor/vscode.md) +- [Visual Studio](./editor/vscode.md) + +## Create first TypeSpec Project + +To get your first TypeSpec project started run in a fresh directory + +```bash +tsp init +``` + +This will prompt you with a few question, pick the `Generic Rest API` template, your project name, and select the `@typespec/openapi3` library. + +Next, you can install the dependencies + +```bash +tsp install +``` + +You should now have a basic TypeSpec project setup with a structure looking like + +```bash +package.json # Package manifest defining your typespec project as a node package. +tspconfig.yaml # TypeSpec project configuration letting you configure emitters, emitter options, compiler options, etc. +main.tsp # TypeSpec entrypoint +``` + +## Compile project + +```bash +tsp compile . +``` diff --git a/packages/website-astro/src/content/docs/current/introduction/introduction.md b/packages/website-astro/src/content/docs/current/introduction/introduction.md new file mode 100644 index 0000000000..3ea0903fd4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/introduction.md @@ -0,0 +1,15 @@ +--- +id: introduction +title: Introduction +--- + +# Introduction to TypeSpec + +TypeSpec is a language for describing cloud service APIs and generating other API description languages, client and service code, documentation, and other assets. TypeSpec provides highly extensible core language primitives that can describe API shapes common among REST, GraphQL, gRPC, and other protocols. + +## Try TypeSpec + +You can try TypeSpec on the web without installing anything. + +- [TypeSpec playground](https://cadlplayground.z22.web.core.windows.net) +- [TypeSpec playground for Azure services](https://azure.github.io/typespec-azure/playground) diff --git a/packages/website-astro/src/content/docs/current/introduction/releases.md b/packages/website-astro/src/content/docs/current/introduction/releases.md new file mode 100644 index 0000000000..e60842968c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/releases.md @@ -0,0 +1,60 @@ +--- +id: releases +title: Releases +--- + +# Releases + +## Package versioning strategy + +TypeSpec is not stable yet, all packages are released with `0.` major version. Each minor version might have some breaking changes to the typespec language, library API or both. Those are documented [here](../release-notes). + +Every change to the `main` branch is automatically published under the npm `@next` tag. + +## Current packages + +| Name | Changelog | Latest | Next | +| -------------------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| Core functionality | | | | +| [@typespec/compiler][compiler_src] | [Changelog][compiler_chg] | [![](https://img.shields.io/npm/v/@typespec/compiler)](https://www.npmjs.com/package/@typespec/compiler) | ![](https://img.shields.io/npm/v/@typespec/compiler/next) | +| TypeSpec Libraries | | | | +| [@typespec/rest][rest_src] | [Changelog][rest_chg] | [![](https://img.shields.io/npm/v/@typespec/rest)](https://www.npmjs.com/package/@typespec/rest) | ![](https://img.shields.io/npm/v/@typespec/rest/next) | +| [@typespec/openapi][openapi_src] | [Changelog][openapi_chg] | [![](https://img.shields.io/npm/v/@typespec/openapi)](https://www.npmjs.com/package/@typespec/openapi) | ![](https://img.shields.io/npm/v/@typespec/openapi/next) | +| [@typespec/openapi3][openapi3_src] | [Changelog][openapi3_chg] | [![](https://img.shields.io/npm/v/@typespec/openapi3)](https://www.npmjs.com/package/@typespec/openapi3) | ![](https://img.shields.io/npm/v/@typespec/openapi3/next) | +| [@typespec/versioning][versioning_src] | [Changelog][versioning_chg] | [![](https://img.shields.io/npm/v/@typespec/versioning)](https://www.npmjs.com/package/@typespec/versioning) | ![](https://img.shields.io/npm/v/@typespec/versioning/next) | +| TypeSpec Tools | | | | +| [@typespec/prettier-plugin-typespec][prettier_src] | [Changelog][prettier_chg] | [![](https://img.shields.io/npm/v/@typespec/prettier-plugin-typespec)](https://www.npmjs.com/package/@typespec/prettier-plugin-typespec) | ![](https://img.shields.io/npm/v/@typespec/prettier-plugin-typespec/next) | +| [typespec-vs][typespec-vs_src] | [Changelog][typespec-vs_chg] | [![](https://img.shields.io/npm/v/typespec-vs)](https://www.npmjs.com/package/typespec-vs) | ![](https://img.shields.io/npm/v/typespec-vs/next) | +| [typespec-vscode][typespec-vscode_src] | [Changelog][typespec-vscode_chg] | [![](https://img.shields.io/npm/v/typespec-vscode)](https://www.npmjs.com/package/typespec-vscode) | ![](https://img.shields.io/npm/v/typespec-vscode/next) | +| [tmlanguage-generator][tmlanguage_src] | [Changelog][tmlanguage_chg] | [![](https://img.shields.io/npm/v/tmlanguage-generator)](https://www.npmjs.com/package/tmlanguage-generator) | ![](https://img.shields.io/npm/v/tmlanguage-generator/next) | + +[compiler_src]: https://github.com/microsoft/typespec/blob/main/packages/compiler +[compiler_chg]: https://github.com/microsoft/typespec/blob/main/packages/compiler/CHANGELOG.md +[rest_src]: https://github.com/microsoft/typespec/blob/main/packages/rest +[rest_chg]: https://github.com/microsoft/typespec/blob/main/packages/rest/CHANGELOG.md +[openapi_src]: https://github.com/microsoft/typespec/blob/main/packages/openapi +[openapi_chg]: https://github.com/microsoft/typespec/blob/main/packages/openapi/CHANGELOG.md +[openapi3_src]: https://github.com/microsoft/typespec/blob/main/packages/openapi3 +[openapi3_chg]: https://github.com/microsoft/typespec/blob/main/packages/openapi3/CHANGELOG.md +[versioning_src]: https://github.com/microsoft/typespec/blob/main/packages/versioning +[versioning_chg]: https://github.com/microsoft/typespec/blob/main/packages/versioning/CHANGELOG.md +[prettier_src]: https://github.com/microsoft/typespec/blob/main/packages/prettier-plugin-typespec +[prettier_chg]: https://github.com/microsoft/typespec/blob/main/packages/prettier-plugin-typespec/CHANGELOG.md +[typespec-vs_src]: https://github.com/microsoft/typespec/blob/main/packages/typespec-vs +[typespec-vs_chg]: https://github.com/microsoft/typespec/blob/main/packages/typespec-vs/CHANGELOG.md +[typespec-vscode_src]: https://github.com/microsoft/typespec/blob/main/packages/typespec-vscode +[typespec-vscode_chg]: https://github.com/microsoft/typespec/blob/main/packages/typespec-vscode/CHANGELOG.md +[tmlanguage_src]: https://github.com/microsoft/typespec/blob/main/packages/tmlanguage-generator +[tmlanguage_chg]: https://github.com/microsoft/typespec/blob/main/packages/tmlanguage-generator/CHANGELOG.md + +## Release cadence + +We release changes from all packages the first week of every month. + +You can look at the millestones https://github.com/microsoft/typespec/milestones to see upcoming changes. Millestones are named after the target release month (i.e `[2022] October` is the sprint running in september targeting a release in the first week of October.) + +## Breaking changes migration guides + +Release notes describing the breaking changes and how to migrate can be found in this folder: + +[https://github.com/microsoft/typespec/tree/main/docs/release-notes](https://github.com/microsoft/typespec/tree/main/docs/release-notes) diff --git a/packages/website-astro/src/content/docs/current/introduction/reproducibility.md b/packages/website-astro/src/content/docs/current/introduction/reproducibility.md new file mode 100644 index 0000000000..c8f9b986b6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/reproducibility.md @@ -0,0 +1,36 @@ +--- +title: Reproducibility +--- + +A key point to service definition is the ability to reliably reproduce the exact same output over time. In cases like: + +1. A dependency or dependency of dependency was updated with an unintended breaking change +2. Changes to a new version of a service shouldn't affect the older versions +3. A change to the TypeSpec spec + +This can be mitigated with a few steps: + +## 1. Defend against dependency changes + +_Note: This section applies if using `tsp install` or `npm install` to install dependencies. However other package managers (`yarn`, `pnpm`, etc.) have their own similar lock mechanisms._ + +When using `tsp install` or `npm install` a `package-lock.json` will be installed. This file SHOULD be committed to source control. It will ensure that later calls to `tsp install` or `npm install` will use the exact versions resolved in the lock files unless the `package.json` was updated or a command like `npm update` was run. + +The command `npm ci` can also be used in the CI to ensure that the `package.json` and `package-lock.json` are in sync. + +## 2. Work with multiple versions of a service + +TypeSpec provides a library `@typespec/versioning` that can be used to describe changes to a service or library over time. Using this will ensure that a service can evolve while keeping track of the changes and allowing emitters to see the service representation at different versions. + +[See versioning docs](../standard-library/versioning/reference/index.md) + +## 3. Change to the TypeSpec spec + +If you don't directly control the spec, you might still want to make sure you remember which exact definition was used. +Using version control and pinning to a specific commit SHA will ensure that the spec will remain exactly as it was. + +## Summary + +1. Use `package-lock.json` +2. Use [versioning library](../standard-library/versioning/reference/index.md) +3. Keep track of commit IDs diff --git a/packages/website-astro/src/content/docs/current/introduction/style-guide.md b/packages/website-astro/src/content/docs/current/introduction/style-guide.md new file mode 100644 index 0000000000..3d5a548d95 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/style-guide.md @@ -0,0 +1,221 @@ +--- +title: Style guide +--- + +# TypeSpec Language Style Guide + +This is a guide providing a recommended set of naming convention to use when writing a TypeSpec spec. + +:::info +The guidelines in this article are used in TypeSpec Core libraries. You can use them, or adapt them to your needs. The primary objectives are consistency and readability within your project, team, organization, or company source code. +::: + +## Naming convention + +| Type | Naming | Example | +| ---------------- | -------------------------------------------- | ------------------------------------------------ | +| scalar | camelCase | `scalar uuid extends string;` | +| model | PascalCase | `model Pet {}` | +| model property | camelCase | `model Pet {furColor: string}` | +| enum | PascalCase | `enum Direction {}` | +| enum member | camelCase | `enum Direction {up, down}` | +| namespace | PascalCase | `namespace Org.PetStore` | +| interface | PascalCase | `interface Stores {}` | +| operation | camelCase | `op listPets(): Pet[];` | +| operation params | camelCase | `op getPet(petId: string): Pet;` | +| unions | PascalCase | `union Pet {cat: Cat, dog: Dog}` | +| unions variants | camelCase | `union Pet {cat: Cat, dog: Dog}` | +| alias | camelCase or PascalCase depending on context | `alias myString = string` or `alias MyPet = Pet` | +| decorators | camelCase | `@format`, `@resourceCollection` | +| functions | camelCase | `addedAfter` | +| file name | kebab-case | `my-lib.tsp` | + +## Layout convention + +TypeSpec has a built-in formatter. See [formatter section](./formatter.md) for more information on how to use it. + +- Use 2 space indenting + + +```typespec +// bad +model Pet { + name: string; +} + +// good +model Pet { + name: string; +} +``` + +- Place a space before an opening curly brace + + +```typespec +// bad +model Pet{ + name: string; +} + +// good +model Pet { + name: string; +} +``` + +- Block opening curly brace `{` should be on the same line + + +```typespec +// bad +model Pet +{ + name: string; +} + +// good +model Pet { + name: string; +} +``` + +- Add a newline after blocks + + +```typespec +// bad +model Pet { + name: string; +} +model Cat extends Pet {} + +// good +model Pet { + name: string; +} + +model Cat extends Pet {} +``` + +- Place no space between an operation/decorator/function name and the parameter list + + +```typespec +// bad +op list (filter: string): Pet[]; + +// bad +@doc ("This is a pet") + +// good +op list(filter: string): Pet[]; + +// good +@doc("This is a pet") +``` + +- Do not add spaces inside parentheses + + +```typespec +// bad +op list( filter: string ): Pet[]; + +// good +op list(filter: string): Pet[]; + +``` + +- Add spaces inside curly braces. + + +```typespec +// bad +alias foo = {type: "cat"}; + +// good +alias foo = { type: "cat" }; +``` + +- Do not add space inside square brackets + + +```typespec +// bad +alias foo = [ 1, 2, 3 ]; + +// good +alias foo = [1, 2, 3]; +``` + +- Start all comments with a space + + +```typespec +//bad + +// good +``` + +- Avoid trailing spaces at the end of lines. + +### Model layout + +- Properties should hug each other unless it has decorators or comments + + +```tsp +// bad +model Foo { + one: string; + + two: string; + + three: string; +} + +// good +model Foo { + one: string; + two: string; + three: string; +} +``` + +- Wrap properties in new lines if it has leading comments or decorators + + +```tsp +// bad +model Foo { + one: string; + @doc("Foo") + two: string; + // line comment + three: string; + /** + * Block comment + */ + four: string; + five: string; +} + +// good +model Foo { + one: string; + + @doc("Foo") + two: string; + + // line comment + three: string; + + /** + * Block comment + */ + four: string; + + five: string; +} +``` diff --git a/packages/website-astro/src/content/docs/current/introduction/usage.md b/packages/website-astro/src/content/docs/current/introduction/usage.md new file mode 100644 index 0000000000..8d53564225 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/introduction/usage.md @@ -0,0 +1,31 @@ +--- +id: usage +title: Usage +--- + +# Usage + +See full usage documentation by typing `tsp --help`: + +```bash +>tsp --help +TypeSpec compiler v0.36.1 + +tsp + +Commands: + tsp compile Compile TypeSpec source. + tsp code Manage VS Code Extension. + tsp vs Manage Visual Studio Extension. + tsp format Format given list of TypeSpec files. + tsp init [templatesUrl] Create a new TypeSpec project. + tsp install Install typespec dependencies + tsp info Show information about current TypeSpec compiler. + +Options: + --help Show help [boolean] + --debug Output debug log messages. [boolean] [default: false] + --pretty Enable color and formatting in TypeSpec's output to make compiler error + s easier to read. [boolean] [default: true] + --version Show version number [boolean] +``` diff --git a/packages/website-astro/src/content/docs/current/language-basics/alias.md b/packages/website-astro/src/content/docs/current/language-basics/alias.md new file mode 100644 index 0000000000..42bac207dc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/alias.md @@ -0,0 +1,16 @@ +--- +id: aliases +title: Aliases +--- + +# Alias + +Aliases can be defined for types. This can be helpful 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`](./models.md) to provide an alternate name for a model. + +Alias can be defined using the `alias` keyword + +```typespec +alias Options = "one" | "two"; +``` diff --git a/packages/website-astro/src/content/docs/current/language-basics/built-in-types.md b/packages/website-astro/src/content/docs/current/language-basics/built-in-types.md new file mode 100644 index 0000000000..a3d9e1d713 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/built-in-types.md @@ -0,0 +1,63 @@ +--- +id: built-in-types +title: Built-in types +--- + +# Built-in Types + +TypeSpec Standard Library provide some built-in types that can be used to build more complex types. + +Built in types are related to each other according to the rules described in [type relations](../language-basics/type-relations.md). + +## Numeric types + +| Type | Range | Description | +| ------------ | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------- | +| `numeric` | | Parent type for all numeric types | +| `integer` | | A whole-number | +| `float` | | A binary number | +| `int64` | `-9,223,372,036,854,775,808` to `9,223,372,036,854,775,807` | A 64-bit integer | +| `int32` | `-2,147,483,648` to `2,147,483,647` | A 32-bit integer | +| `int16` | `-32,768` to `32,767` | A 16-bit integer | +| `int8` | `-128` to `127` | A 8-bit integer | +| `safeint` | −9007199254740991 (−(253 − 1)) to 9007199254740991 (253 − 1) | An integer that can be serialized to JSON | +| `uint64` | `0` to `18,446,744,073,709,551,615` | Unsigned 64-bit integer | +| `uint32` | `0` to `4,294,967,295` | Unsigned 32-bit integer | +| `uint16` | `0` to `65,535` | Unsigned 16-bit integer | +| `uint8` | `0` to `255 ` | Unsigned 8-bit integer | +| `float32` | ±1.5 x 1045 to ±3.4 x 1038 | A 32 bit floating point number | +| `float64` | ±5.0 × 10−324 to ±1.7 × 10308 | A 64 bit floating point number | +| `decimal` | | A decimal number | +| `decimal128` | 34 decimal digits with an exponent range from `-6143` to `6144` | A 128 bit decimal number | + +## Date and time types + +| Type | Description | +| ---------------- | ----------------------------------------------------------------------------------- | +| `plainDate` | A date on a calendar without a time zone, e.g. "April 10th" | +| `plainTime` | A time on a clock without a time zone, e.g. "3:00 am" | +| `utcDateTime` | A date and time in coordinated universal time (UTC), e.g. "1985-04-12T23:20:50.52Z" | +| `offsetDateTime` | A date and time in a particular time zone, e.g. "April 10th at 3:00am in PST" | +| `duration` | A duration/time period. e.g 5s, 10h | + +## Other core types + +| Type | Description | +| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `bytes` | A sequence of bytes | +| `string` | A sequence of textual characters | +| `boolean` | Boolean with `true` and `false` values | +| `null` | Null value | +| `Array` | Array model type, equivalent to `T[]` | +| `Record` | Model with string keys where all the values have type `T` (similar to `Map` in TypeScript or `Dictionary` in .Net) | +| `unknown` | A top type in TypeSpec that all types can be assigned to. Values that can have any type should be assigned this value (similar to `any` in JavaScript) | +| `void` | A function/operation return type indicating the function/operation doesn't return a value. | +| `never` | The never type indicates the values that will never occur. | + +## String types + +Built-in types that are known string formats + +| Type | Description | +| ----- | ------------ | +| `url` | A url String | diff --git a/packages/website-astro/src/content/docs/current/language-basics/decorators.md b/packages/website-astro/src/content/docs/current/language-basics/decorators.md new file mode 100644 index 0000000000..929cbe5dc8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/decorators.md @@ -0,0 +1,64 @@ +--- +id: decorators +title: Decorators +--- + +# Decorators + +Decorators enable a developer to attach metadata to types in a TypeSpec program. They can also be used to calculate types based on their inputs. Decorators are the backbone of TypeSpec's extensibility and give it the flexibility to describe many different kinds of APIs and associated metadata like documentation, constraints, samples, and the like. + +Many TypeSpec constructs can be decorated, including [namespaces](./namespaces.md), [operations](./operations.md) and their parameters, and [models](./models.md) and their members. + +Decorators are defined using JavaScript functions that are exported from a standard ECMAScript module. When you import a JavaScript file, TypeSpec will look for any exported functions prefixed with `$`, and make them available as decorators inside the TypeSpec syntax. When a decorated declaration is evaluated by TypeSpec, it will invoke the decorator function, passing along a reference to the current compilation, an object representing the type it is attached to, and any arguments the user provided to the decorator. + +## Using decorators + +Decorators are referenced using the `@` prefix and must be specified before the entity they are decorating. Arguments can be provided by using parentheses in a manner similar to many programming languages, e.g. `@myDec1, "hi", { a: string })`. + +The following shows an example of declaring and then using a decorator: + +```typespec +@tag("Sample") +model Dog { + @validate(false) + name: string; +} +``` + +The parentheses can be omitted when no arguments are provided. + +```typespec +@mark +model Dog {} +``` + +## Augment decorators + +Decorators can also be used from a different location by referring to the type being decorated. For this you can declare an augment decorator using the `@@` prefix. The first argument of an augment decorator is the type reference that should be decorated. As the augment decorator is a statement, it must end with a semicolon (`;`). + +```typespec +model Dog {} + +@@tag(Dog, "Sample"); +``` + +Which is equivalent to + +```typespec +@tag("Sample") +model Dog {} +``` + +Example: Decorate a model property + +```typespec +model Dog { + name: string; +} + +@@readOnly(Dog.name); +``` + +## Writing decorator + +[See creating decorator documentation](../extending-typespec/create-decorators.md) diff --git a/packages/website-astro/src/content/docs/current/language-basics/documentation.md b/packages/website-astro/src/content/docs/current/language-basics/documentation.md new file mode 100644 index 0000000000..d8ce3e7806 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/documentation.md @@ -0,0 +1,74 @@ +--- +id: documentation +title: Documentation +--- + +# Documentation + +Documentation is crucial to any API. TypeSpec provides a number of ways to document your API using TSDoc doc comments and decorators. + +# Documenting APIs + +## `@doc` Decorator + +The `@doc` decorator can be used to attach documentation to most TypeSpec declarations. It most-commonly accepts a string argument that will be used as the documentation for the declaration. + +```typespec +@doc("This is a sample model") +model Dog { + @doc("This is a sample property") + name: string; +} +``` + +The `@doc` decorator can also accept a source object which can be used, for example, to provide templated documentation for a generic type. + +```typespec +@doc("Templated {name}", T) +model Template { +} + +// doc will read "Templated A" +model A is Template +``` + +## TSDoc Doc Comments + +TSDoc doc comments are a standard way to document TypeScript code. They are supported by many IDEs and can be used to generate external documentation using tools like [TypeDoc](https://typedoc.org/). + +You can annotate objects in your TypeSpec spec with TSDoc doc comments. These comments will be considered the same as if they were attached using the `@doc` decorator and can be used to generate external documentation. + +```typespec +/** + * Get a widget. + * @param widgetId The ID of the widget to retrieve. + * / +op @get create(@path widgetId: string): Widget | Error; +``` + +This is functionally equivalent to: + +```typespec +@doc("Get a widget.") +op @get create( + @doc("The ID of the widget to retrieve.") + @path + widgetId: string): Widget | Error; +``` + +The benefit to using TSDoc doc comment syntax is that it keeps all of the documentation for a declaration in one place, making it easier to read and maintain. Additionally, it allows the generation of documentation using tools like TypeDoc without having to write a custom emitter to examine the `@doc` metadata. + +# Comments + +TypeSpec supports both single-line and multi-line comments. Single-line comments start with `//` and continue until the end of the line. Multi-line comments start with `/*` and continue until the closing `*/` is encountered. + +```typespec +// This is a single-line comment +model Dog { + /* This is a multi-line comment + that spans multiple lines */ + name: string; +} +``` + +Comments are ignored by the compiler and are not included in the generated output. They are intended to be used to document your spec internally and are not suitable for generating external documentation. diff --git a/packages/website-astro/src/content/docs/current/language-basics/enums.md b/packages/website-astro/src/content/docs/current/language-basics/enums.md new file mode 100644 index 0000000000..2d5251ed74 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/enums.md @@ -0,0 +1,81 @@ +--- +id: enums +title: Enums +--- + +# Enums + +Enums allow a developer to define a set of named constants. Using enums can make it easier to document intent, or create a set of distinct cases. Enums can either be numeric or string-based. For other types, look into [union](./unions.md) + +## Basics + +Enums are declared using the `enum` keyword. +The enums members are comma `,` separated and can be typespec `identifier`s or `string literal`s. + +```typespec +enum Direction { + North, + East, + South, + West, +} +``` + +In this case, we haven't specified how the constants will be represented. Different scenarios might handle the enums differently. + +## Values + +Enums members can have a custom value that can be assigned using the `:` operator. + +```typespec +enum Direction { + North: "north", + East: "east", + South: "south", + West: "west", +} +``` + +Values can also be integers. + +```typespec +enum Foo { + One: 1, + Ten: 10, + Hundred: 100, + Thousand: 1000, +} +``` + +or float + +```typespec +enum Hour { + Zero: 0, + Quarter: 0.25, + Half: 0.5, + ThreeQuarter: 0.75, +} +``` + +## Composing enums + +Enums can be reused using the spread `...` pattern. All the members of the source enums will be copied in the target enum but it doesn't create any reference between the source and target enums. + +```typespec +enum DirectionExt { + ...Direction, + `North East`, + `North West`, + `South East`, + `South West`, +} +``` + +## Referencing enum members + +Enum members can be referenced using the `.` operator for identifiers. + +```typespec +alias North = Direction.North; +``` diff --git a/packages/website-astro/src/content/docs/current/language-basics/imports.md b/packages/website-astro/src/content/docs/current/language-basics/imports.md new file mode 100644 index 0000000000..2118916736 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/imports.md @@ -0,0 +1,51 @@ +--- +id: imports +title: Imports +--- + +# Import + +Imports add files or libraries to your TypeSpec program. When you compile a TypeSpec file, you provide a path to your root TypeSpec file, by convention called "main.tsp". From there, any files you import are added to your program. If you import a directory, TypeSpec will look for a `main.tsp` file inside that directory. + +The path you import must either begin with `"./"` or `"../"` or otherwise be an absolute path. The path must either refer to a directory, or else have an extension of either ".tsp" or ".js". The following demonstrates how to use imports to assemble a TypeSpec program from multiple files: + +## Import TypeSpec file + +```typespec +import "./models/foo.tsp"; +``` + +## Import Js file + +```typespec +import "./decorators.js"; +``` + +## Import a library + +The import value can be name one of the package dependencies. In that case typespec will lookup for the `package.json` file and check the `tspMain` entry (or default to `main` if absent) to decide what is the library entrypoint to load. + +```typespec +import "@typespec/rest"; +``` + +```json +// ./node_modules/@typespec/rest/package.json +{ + "tspMain": "./lib/main.tsp" +} +``` + +which result in `./node_modules/@typespec/rest/lib/main.tsp` to be imported + +## Import a directory + +If the import value is a directory it will lookup if that directory is a node package and follow the npm package [lookup logic](#import-a-library) or if the directory contains a `main.tsp`. + +```typespec +import "./models"; // same as `import "./models/main.tsp"; +``` + +```typespec +import "./path/to/local/module"; // Assuming this path is a typespec package, it will load it using the tspMain file. +``` diff --git a/packages/website-astro/src/content/docs/current/language-basics/interfaces.md b/packages/website-astro/src/content/docs/current/language-basics/interfaces.md new file mode 100644 index 0000000000..ab22cb7a56 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/interfaces.md @@ -0,0 +1,102 @@ +--- +id: interfaces +title: Interfaces +--- + +# Interfaces + +Interfaces can be used to group and reuse [operations](./operations.md). + +Interfaces are declared using the `interface` keyword. + +```typespec +interface SampleInterface { + foo(): int32; + bar(): string; +} +``` + +## Composing interfaces + +The keyword `extends` can be used to compose operations from other interfaces into a new interface. + +Given the following interfaces + +```typespec +interface A { + a(): string; +} + +interface B { + b(): string; +} +``` + +a new interface `C` can be created including all operations from `A` and `B` + +```typespec +interface C extends A, B { + c(): string; +} +``` + +which is equivalent to + +```typespec +interface C { + a(): string; + b(): string; + c(): string; +} +``` + +## Interface template + +Interfaces can be templated, [see templates](./templates.md) for details on templates. + +```typespec +interface ReadWrite { + read(): T; + write(t: T): void; +} +``` + +## Interface operation templates + +Operations defined inside of an interface can also be templated. ([see templates](./templates.md) for details on templates.) + +```typespec +interface ReadWrite { + read(): T; + write(t: T): R; +} + +alias MyReadWrite = ReadWrite; + +op myWrite is MyReadWrite.write; +``` + +:::caution +Any uninstantiated, templated operation defined in an interface will be excluded from the list of service operations. + +This also applies when using `extends` on an interface that contains templated operations with unfilled template arguments. + +```typespec +interface ReadWrite { + read(): T; + write(t: T): R; +} + +interface MyReadWrite extends ReadWrite {} // Here the `read()` operation is fully instantiated and will be included in a service definition. `write()` however isn't. +``` + +When working with building block interface like this use alias to create your interface building block instead of `interface extends`. This way the instantiated interface and its member will not be resolved in the service definition. + +```typespec +alias MyReadWrite = ReadWrite; + +op myRead is MyReadWrite.read; +op myWrite is MyReadWrite.write; +``` + +::: diff --git a/packages/website-astro/src/content/docs/current/language-basics/intersections.md b/packages/website-astro/src/content/docs/current/language-basics/intersections.md new file mode 100644 index 0000000000..15e9fe8ff2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/intersections.md @@ -0,0 +1,21 @@ +--- +id: intersections +title: Intersections +--- + +# Intersections + +Intersections describe a type that must include all the intersection's constituents. Declare an intersection with the `&` operator. + +```typespec +alias Dog = Animal & Pet; +``` + +An intersection is equivalent to [spreading](./models.md#spread) both types. + +```typespec +alias Dog = { + ...Animal; + ...Pet; +}; +``` diff --git a/packages/website-astro/src/content/docs/current/language-basics/models.md b/packages/website-astro/src/content/docs/current/language-basics/models.md new file mode 100644 index 0000000000..3b78fd581d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/models.md @@ -0,0 +1,183 @@ +--- +id: models +title: Models +--- + +# Models + +TypeSpec models are used to describe data shapes or schemas. + +## Model kinds + +Models can be used to represent 2 types: + +- [Record](#record) +- [Array](#array) + +### Record + +Record models are structure with named fields called properties. + +- name can be an `identifier` or `string literal`. +- type can be any type reference +- properties are ordered. See [ordering of properties](#ordering-of-properties) + +```typespec +model Dog { + name: string; + age: number; +} +``` + +#### Optional properties + +Properties can be marked as optional using the `?` punctuation. + +```typespec +model Dog { + address?: string; +} +``` + +#### Default values + +[Optional properties](#optional-properties) can be provided with a default value using `=` operator. + +```typespec +model Dog { + address?: string = "wild"; +} +``` + +#### Ordering of properties + +Properties are ordered in the order that they appear in source. Properties obtained via `model is` appear before properties defined in the model body. Properties obtained via `...` are inserted where the spread appears in source. + +Example: + +```tsp +model Pet { + name: string; + age: int32; +} + +model HasHome { + address: string; +} + +model Cat is Pet { + meow: boolean; + ...HasHome; + furColor: string; +} + +// Resulting property order for cat: +// name, age, meow, address, furColor +``` + +### Special property types + +#### `never` + +A model property can be declared as having the type never. This can be interpreted as the model not having that property. + +This can be useful in a model template to omit a property. + +```typespec +model Address { + state: TState; + city: string; + street: string; +} + +model UKAddress is Address; +``` + +:::note +It is up to the emitter to remove `never` properties. The TypeSpec compiler will not automatically omit them. +::: + +### Array + +Array are models created using the `[]` syntax which is just a syntactic sugar for using the `Array` 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. + +```typespec +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. + +```typespec +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](./decorators.md) as well. One common use case is to give a better name to a [template](#Templates) instantiation: + +```typespec +@decorator +model Thing { + property: T; +} + +model StringThing is Thing; + +// StringThing declaration is equivalent to the following declaration: +@decorator +model StringThing { + property: string; +} +``` + +## Model templates + +[See templates](./templates.md) for details on templates + +```typespec +model Page { + size: number; + item: T[]; +} + +model DogPage { + ...Page; +} +``` + +## Meta type references + +Some model property meta types can be referenced using `::` + +| Name | Example | Description | +| ---- | ---------------- | ---------------------------------------- | +| type | `Pet.name::type` | Reference the type of the model property | diff --git a/packages/website-astro/src/content/docs/current/language-basics/namespaces.md b/packages/website-astro/src/content/docs/current/language-basics/namespaces.md new file mode 100644 index 0000000000..18f24aba48 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/namespaces.md @@ -0,0 +1,98 @@ +--- +id: namespaces +title: Namespaces +--- + +# Namespaces + +Namespaces let you group related types together into namespaces. This helps organize your types, making them easier to find and prevents name conflicts. Namespaces are merged across files, so you can reference any type anywhere in your TypeSpec program via its namespace. + +## Basics + +Create a namespace with the `namespace` keyword. + +```typespec +namespace SampleNamespace { + model SampleModel {} +} +``` + +_The name of a namespace must be a valid TypeSpec identifier._ + +The `SampleNamespace` can then be used from other places: + +```typespec +model Foo { + sample: SampleNamespace.SampleModel; +} +``` + +## Nested namespace + +Namespaces can contain sub namespaces providing additional granularity + +```typespec +namespace Foo { + namespace Bar { + namespace Baz { + model SampleModel {} + } + } +} +``` + +or this can be simplified using `.` notation + +```typespec +namespace Foo.Bar.Baz { + model SampleModel {} +} +``` + +The sub-namespace can then be used from other places using the fully qualified name. + +```typespec +model A { + sample: Foo.Bar.Baz.SampleModel; +} +``` + +## File namespace + +A namespace for all declarations contained in a file can be provided at the top (After the `import` statements) using a blockless namespace statement + +```typespec +namespace SampleNamespace; + +model SampleModel {} +``` + +A file can only have a single blockless namespace. + +## Using a namespace + +The content of a namespace can be exposed to the current scope using the `using` keyword. + +```typespec +using SampleNamespace; + +model Foo { + sample: SampleModel; +} +``` + +The bindings introduced by a `using` statement are local to the namespace they are declared in. They do not become part of the namespace themselves. + +```typespec +namespace One { + model A {} +} + +namespace Two { + using One; + alias B = A; // ok +} + +alias C = One.A; // not ok +alias C = Two.B; // ok +``` diff --git a/packages/website-astro/src/content/docs/current/language-basics/operations.md b/packages/website-astro/src/content/docs/current/language-basics/operations.md new file mode 100644 index 0000000000..96161f10e5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/operations.md @@ -0,0 +1,83 @@ +--- +id: operations +title: Operations +--- + +# Operations + +Operations describe service endpoints and consist of an operation name, parameters, and return type. + +Operations are declared using the `op` keyword: + +```typespec +op ping(): void; +``` + +## Parameters + +The operation's parameters describe a model, so anything you can do in a model you can do in a parameter list as well, including using the spread operator: + +```typespec +op feedDog(...CommonParams, name: string): void; +``` + +## Return type + +Often an endpoint returns one of any number of models. For example, there might be a return type for when an item is found, and a return type for when an item isn't found. Unions are used to describe this pattern: + +```typespec +model DogNotFound { + error: "Not Found"; +} + +op getDog(name: string): Dog | DogNotFound; +``` + +## Reuse operations + +Operation signatures can be reused using the `is` keyword. Given an operation + +```typespec +op Delete(id: string): void; +``` + +its signature can be reused like this: + +```typespec +op deletePet is Delete; +``` + +This means that `deletePet` will have the same parameters, return type and decorators as the `Delete` operation. + +This pattern is most commonly used in combination with [operation templates](#operations-templates) + +## Operations templates + +[See templates](./templates.md) for details on templates. + +```typespec +op ReadResource(id: string): T; +``` + +The operation template can then be referenced via `is`: + +```typespec +op readPet is ReadResource; +``` + +## Referencing model properties + +Model properties can be referenced using the `.` operator for identifiers. + +```tsp +alias PetName = Pet.name; +``` + +## Meta type references + +Some operation meta types can be referenced using `::` + +| Name | Example | Description | +| ---------- | --------------------- | ----------------------------------------- | +| parameters | `readPet::parameters` | Reference the parameters model expression | +| returnType | `readPet::returnType` | Reference the operation return type | diff --git a/packages/website-astro/src/content/docs/current/language-basics/overview.md b/packages/website-astro/src/content/docs/current/language-basics/overview.md new file mode 100644 index 0000000000..9d615fa0e2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/overview.md @@ -0,0 +1,159 @@ +--- +id: overview +title: Overview +--- + +# Language Overview + +This is an overview of the language concept in TypeSpec. It doesn't go in detail but can be used as a cheat sheet. + +## Declarations + +- Declaration names must be unique across types within the same scope. For example this is not allowed + + ```typespec + model Dog {} + namespace Dog {} + ``` + +## Imports + +_Details: [Imports](./imports.md)_ + +| Feature | Example | +| -------------------- | ------------------------- | +| Import typespec file | `import "./models.tsp"` | +| Import JS file | `import "./models.js"` | +| Import Library | `import "@typespec/rest"` | + +## Namespaces + +_Details: [Namespaces](./namespaces.md)_ + +| Feature | Example | +| ----------------- | ---------------------------- | +| Declare namespace | `namespace PetStore {}` | +| File namespace | `namespace PetStore;` | +| Nested namespace | `namespace PetStore.Models;` | +| Using namespace | `using PetStore.Models;` | + +## Decorators + +_Details: [Decorators](./decorators.md)_ + +| Feature | Example | +| ---------------------------- | ----------------------------------------------------------------------------------- | +| Use decorator | `@mark` | +| Use decorator with arguments | `@tag("abc")` | +| Declare a decorator in JS | `export function $tag(context: DecoratorContext, target: Type, name: string) {...}` | +| Save state in decorator | `context.program.stateMap(key).set(target, )` | +| Augment decorator | `@@tag(MyType, "abc");` | + +## Scalars + +_Details: [Scalars](./models.md)_ + +| Feature | Example | +| ------------------ | ------------------------------------------- | +| Scalar declaration | `scalar ternary` | +| Extend scalar | `scalar Password extends string` | +| Template scalar | `@doc(T) scalar Password` | + +## Models + +_Details: [Models](./models.md)_ + +| Feature | Example | +| ------------------------------ | ------------------------------------- | +| Model declaration | `model Pet {}` | +| Model inheritance | `model Dog extends Pet {}` | +| scalar is | `model uuid extends string;` | +| Model spread | `model Dog {...Animal}` | +| Property | `model Dog { name: string }` | +| Optional property | `model Dog { owner?: string }` | +| Optional property with default | `model Dog { name?: string = "Rex" }` | +| Model template | `model Pet { t: T }` | + +## Operations + +_Details: [Operations](./operations.md)_ + +| Feature | Example | +| ----------------------------- | ------------------------------------------------ | +| Operation declaration | `op ping(): void` | +| Operation with parameters | `op upload(filename: string, data: bytes): void` | +| Operation with return type | `op health(): HealthStatus` | +| Operation with multiple types | `op health(): HealthStatus \| ErrorResponse` | +| Operation template | `op getter(id: string): T` | +| Operation is | `op getPet is getter;` | + +## Interfaces + +_Details: [Interfaces](./interfaces.md)_ + +| Feature | Example | +| --------------------- | -------------------------------------- | +| Interface declaration | `interface PetStore { list(): Pet[] }` | +| Interface composition | `interface PetStore extends Store { }` | +| Interface template | `interface Restful { list(): T[] }` | + +## Templates + +_Details: [Templates](./templates.md)_ + +| Feature | Example | +| --------------------------------- | --------------------------------------------------- | +| Simple template | `model Response {value: T}` | +| Template with multiple parameters | `model Response {key: K, value: T}` | +| Template default | `model Response {value: T}` | +| Template constraints | `model Response {value: T}` | +| Template constraints and defaults | `model Response {value: T}` | + +## Enums + +_Details: [Enums](./enums.md)_ + +| Feature | Example | +| ------------------ | ---------------------------------------------- | +| Enum declaration | `enum Direction {Up, Down}` | +| Enum string values | `enum Direction {Up: "up", Down: "down"}` | +| Enum int values | `enum Size {Small: 1000, Large: 2000}` | +| Enum float values | `enum Part {Quarter: 0.25, Half: 0.5}` | +| Enum composing | `enum Direction2D {...Direction, Left, Right}` | + +## Unions + +_Details: [Unions](./unions.md)_ + +| Feature | Example | +| ----------------------- | -------------------------------- | +| Union declaration | `"cat" \| "dog"` | +| Named union declaration | `union Pet {cat: Cat, dog: Dog}` | + +## Intersections + +_Details: [Intersections](./intersections.md)_ + +| Feature | Example | +| ------------------------ | -------------- | +| Intersection declaration | `Pet & Animal` | + +## Type literals + +_Details: [Type literals](./type-literals.md)_ + +| Feature | Example | +| ----------------- | -------------------------------------------------------- | +| String | `"Hello world!"` | +| Multi line String | `"""\nHello world!\n"""` (\n) represent actual new lines | +| Int | `10` | +| Float | `10.0` | +| Boolean | `false` | + +## Aliases + +_Details: [Aliases](./alias.md)_ + +| Feature | Example | +| ----------------- | --------------------------------- | +| Alias declaration | `alias Options = "one" \| "two";` | diff --git a/packages/website-astro/src/content/docs/current/language-basics/scalars.md b/packages/website-astro/src/content/docs/current/language-basics/scalars.md new file mode 100644 index 0000000000..bbf99d5b18 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/scalars.md @@ -0,0 +1,30 @@ +--- +title: Scalars +--- + +# Scalars + +These are types without any fields(For example `string`, `int32`, `boolean`, etc.) + +Scalar can be declared using the `scalar` keyword + +```typespec +scalar ternary; +``` + +## Extend another scalar + +Scalar can be extended using the `extends` keyword. + +```typespec +scalar Password extends string; +``` + +## Template scalar + +Scalar support template parameters. Note: the only use for those template are decorators. + +```typespec +@doc(T) +scalar Unreal; +``` diff --git a/packages/website-astro/src/content/docs/current/language-basics/templates.md b/packages/website-astro/src/content/docs/current/language-basics/templates.md new file mode 100644 index 0000000000..32dc5022d7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/templates.md @@ -0,0 +1,68 @@ +--- +id: templates +title: Templates +--- + +# Templates + +It is often useful to let the users of a model fill in certain details. Templates enable this pattern. Similar to generics found in other languages, model templates declare template parameters that users provide when referencing the type. + +Templates can be used on: + +- [alias](./alias.md) +- [models](./models.md) +- [operations](./operations.md) +- [interfaces](./interfaces.md) + +```typespec +model Page { + size: number; + item: T[]; +} + +model DogPage { + ...Page; +} +``` + +## Default values + +A template parameter can be given a default value with `= `. + +```typespec +model Page { + size: number; + item: T[]; +} +``` + +## Parameter constraints + +Template parameter can provide a constraint using the `extends` keyword. See [type relations](./type-relations.md) documentation for details on how validation works. + +```typespec +alias Foo = T; +``` + +now instantiating Foo with the wrong type will result in an error + +```typespec +alias Bar = Foo<123>; + ^ Type '123' is not assignable to type 'TypeSpec.string' +``` + +Template constraints can be a model expression + +```typespec +// Expect T to be a model with property name: string +alias Foo = T; +``` + +Template parameter default also need to respect the constraint + +```typespec +alias Foo = T +// Invalid +alias Bar = T + ^ Type '123' is not assignable to type 'TypeSpec.string' +``` diff --git a/packages/website-astro/src/content/docs/current/language-basics/type-literals.md b/packages/website-astro/src/content/docs/current/language-basics/type-literals.md new file mode 100644 index 0000000000..cf6ee9af22 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/type-literals.md @@ -0,0 +1,81 @@ +--- +id: type-literals +title: Type literals +--- + +# Type literals + +API authors often need to describe API shapes in terms of specific literal values. For example, this operation returns this specific integer status code, or this model member can be one of a few specific string values. It is also often useful to pass specific literal values to decorators. TypeSpec supports string, number, and boolean literal values to support these cases. + +## String literals + +String literals can be represented using double quotes `"` + +```typespec +alias Str = "Hello World!"; +``` + +## Multi line string literals + +A multi string literal is represented using a set of 3 double quotes `"""`. + +```typespec +alias Str = """ +This is a multi line string + - opt 1 + - opt 2 +"""; +``` + +- Opening `"""` must be followed by a new line. +- Closing `"""` must be preceded by a new line. + +### Multi line string indentation trimming + +Multi lines automatically remove leading whitespaces of each line aligned with the closing `"""`. This is particularly useful to keep multi line string indented with the code and not have to worry about unwanted indentation. + +All those options will produce the exact same string value `"one\ntwo"` + +```typespec +model MultiLineContainer { + prop1: """ +one +two +""") + + // Lines are indented at the same level as closing """" + prop2: """ + one + two + """ + + prop3: """ + one + two + """ + + // lines are less indented as the closing """" + prop4: """ + one + two + """ +} +``` + +## Numeric literal + +Numeric literals can be declared by using the raw number + +```typespec +alias Kilo = 1000; +alias PI = 3.14; +``` + +## Boolean literal + +Boolean literals can be declare by using `true` or `false` keywords + +```typespec +alias InTypeSpec = true; +alias Cheater = false; +``` diff --git a/packages/website-astro/src/content/docs/current/language-basics/type-relations.md b/packages/website-astro/src/content/docs/current/language-basics/type-relations.md new file mode 100644 index 0000000000..f4e6119dcc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/type-relations.md @@ -0,0 +1,145 @@ +--- +id: type-relations +title: Type relations +--- + +# Types Relations + +## Type hierarchy + +```mermaid +graph RL + record["Record"] --> unknown + customModel["Custom model with properties"] --> record["Record"] + array["Array"] --> unknown + tuple["Tuple"] --> array + numeric --> unknown + subgraph numerics[For numeric types, a narrower type can be assigned to a wider one] + integer --> numeric + int8 --> integer + int16 --> integer + int32 --> integer + safeint --> integer + int64 --> integer + uint8 --> integer + uint16 --> integer + uint32 --> integer + uint64 --> integer + float --> numeric + float32 --> float + float64 --> float + decimal --> numeric + decimal128 --> decimal + end + string --> unknown + boolean --> unknown + null --> unknown + bytes --> unknown + plainDate --> unknown + plainTime --> unknown + zoneDateTime --> unknown + duration --> unknown +``` + +## Model with properties + +When checking if type `S` can be assigned to type `T`, if `T` is a model with properties, it will look for all those properties to be present inside of `S` and their type be assignable to the type of the property is T. + +For example + +```typespec +model T { + foo: string; + bar: int32; +} + +// Valid + +model S { // When properties types are the exact same + foo: string; + bar: int32; +} +model S { // When the properties types are literal assignable to the target type + foo: "abc"; + bar: 123; +} +model S { + foo: string; + bar: int8; // int8 is assignable to int16 +} +model S { + foo: string; + bar: int32; + otherProp: boolean; // Additional properties are valid. +} + +// Invalid +model S { // Missing property bar + foo: string; +} +model S { + foo: string; + bar: int64; // int64 is NOT assignable to int32 +} +``` + +## `Record` + +A record is a model indexed with a string with value of T. This means that it represents a model where all properties(string key) are assignable to the type T. You can assign a model expression where all the properties are of type T or another model that `is` also a `Record` + +```typespec +// Represent an object where all the values are int32. +alias T = Record; + +// Valid +alias S = { + foo: 123; + bar: 345; +}; +alias S = { + foo: int8; + bar: int32; +}; +model S is Record; +model S is Record { + foo: 123; +} + +// Invalid +alias S = { + foo: "abc"; + bar: 456; +}; +alias S = { + foo: int64; + bar: int32; +}; +model S { + foo: 123; + bar: 456; +} +``` + +#### Why is the last case not assignable to `Record`? + +In this scenario + +```typespec +alias T = Record; +model S { + foo: 123; + bar: 456; +} +``` + +The reason is `model S` here is not assignable but the model expression `{ foo: 123; bar: 456; }` is, is that model S could be extended with additional properties that could then not be compatible. + +If you for example now add a new model + +```typespec +model Foo is S { + otherProp: string; +} +``` + +Now here `Foo` is assignable to `S` following the [model with property logic](#model-with-properties) and if `S` was assignable to `Record`, `Foo` would be able to be passed through as well but this is now invalid as `otherProp` is not an `int32` property. diff --git a/packages/website-astro/src/content/docs/current/language-basics/unions.md b/packages/website-astro/src/content/docs/current/language-basics/unions.md new file mode 100644 index 0000000000..431d23bc29 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/language-basics/unions.md @@ -0,0 +1,35 @@ +--- +id: unions +title: Unions +--- + +# Unions + +Unions describe a type that must be exactly one of the union's constituents. There is 2 types of unions: + +- union expressions +- named unions + +## Union expressions + +Unnamed unions can be declared by joining the variants using the `|` operator + +```typespec +alias Breed = Beagle | GermanShepherd | GoldenRetriever; +``` + +Here it says that `Breed` can accept either a `Beagle`, a `GermanShepherd` or a `GoldenRetriever`. + +## Named unions + +Named unions provide a way to specify a name for the union as well as explicit variant reference. Named unions are in a way similar to [enums](./enums.md) but instead of having `string` or `numeric` values it is a [record models](./models.md) + +```typespec +union Breed { + beagle: Beagle, + shepherd: GermanShepherd, + retriever: GoldenRetriever, +} +``` + +The above example is equivalent to the `Breed` alias above, except that emitters can actually see `Breed` as a named entity and also see the `beagle`, `shepherd`, and `retriever` names for the options. It also becomes possible to apply [decorators](./decorators.md) to each of the options when using this form. diff --git a/packages/website-astro/src/content/docs/current/release-notes/cadl-typespec-migration.md b/packages/website-astro/src/content/docs/current/release-notes/cadl-typespec-migration.md new file mode 100644 index 0000000000..45faa66f29 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/cadl-typespec-migration.md @@ -0,0 +1,71 @@ +--- +title: Cadl to TypeSpec rename completed in March 2023 release +--- + +As you may recall from our previous email to partners, we are renaming the product as it becomes more mature, stable and one step closer to release. + +With the 2023-03-13 release, We are pleased to announce that we have completed the process of changing the name of our product from **Cadl** to **TypeSpec**. This marks another important milestone. The new name better aligns with the functionality and benefits of the product, and we believe it will make it easier for our customers to understand and remember. + +We understand that change can be challenging, and we appreciate your patience and support during this process. + +## Name Changes + +- Packages: + + - NPM package scope: + + - @cadl-lang/[xx] -> @typespec/[xx] + + - Package names + +| Old Package Name | Old Namespace | New Package Name | New Namespace | +| ------------------- | -------------------- | ------------------ | ------------------------ | +| @cadl-lang/compiler | using Cadl; | @typespec/compiler | using TypeSpec; | +| @cadl-lang/rest | using Cadl.Http; | @typespec/http; | using TypeSpec.Http; | +| @cadl-lang/rest | using Cadl.Rest; | @typespec/rest | using TypeSpec.Rest; | +| @cadl-lang/openapi | using Cadl.OpenApi; | @typespec/openapi | using TypeSpec.OpenApi; | +| @cadl-lang/openapi3 | using Cadl.OpenApi3; | @typespec/openapi3 | using TypeSpec.OpenApi3; | + +- File extension: + + - `.cadl` -> `.tsp` + +- Configuration file: + + - `cadl-project.yaml` -> `tspconfig.yaml` + +- CLI + + - `npx cadl compile .` -> `npx tsp compile .` + +- Compiler JS APIs + - All artifacts with `*Cadl*` in the name have been updated to `*TypeSpec*`. However, aliases have been created with older `*Cadl*` name with `@deprecated` flag. +- Noteable changes: + + - @cadl-lang/rest was split into two packages, @typespec/rest and @typespec/http + +- Back-compatibility + - `.cadl` files are continue be recognized by compiler. + - `cadl-project.yaml` is still supported if `tspconfig.yaml` not found + +## Migration tool + +An experimental migration tool has been introduced to take care of many of the manual migration steps. Just execute following command in your TypeSpec folder. + +```bash + npx @typespec/migrate +``` + +If you would like execute from a different folder or don't have a `package.json` that indicates compiler package versions, please see command line options: + +```bash + npx @typespec/migrate --help +``` + +The migration tool will perform following steps: + +- Rename `cadl-project.yaml` to `tspconfig.yaml`. +- Update `tspconfig.yaml` format to new `emit` schema if necessary. +- Rename `.cadl` files to `.tsp`. +- Update `import` and `using` statements in any `.tsp` files +- Update `package.json` with new package name and versions. diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2022-07-08.md b/packages/website-astro/src/content/docs/current/release-notes/release-2022-07-08.md new file mode 100644 index 0000000000..fb2308d64f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2022-07-08.md @@ -0,0 +1,98 @@ +--- +title: July 2022 +--- + +# Release Notes July 2022 (2022-07-08) + +This release contains **breaking changes** + +- Emitter options normalized to use kebab-case instead of camelCase. +- `@serviceHost` decorator replaced by `@server` decorator +- Versioning decorators now use enumerated values instead of strings + +## Emitter options + +This release brings a stricter option definition for emitters and requires usage of those options to be specified with the fully qualified name to prevent conflicts. +All options have also been renamed to match `kebab-case` naming. +The options can also be specified via the `tspconfig.yaml` file. + +### Migrating Command Line Scripts + +If you had for example `--option operationPollingLocation=tenant` + +1. Use `tspconfig.yaml` project file **Recommended** + + If you don't have that file yet, create it next to `package.json`, this file can be used to configure the emitters. + + ```yaml + emitters: + : + : + + # For example + emitters: + @typespec/openapi3: + output-file: ./openapi.json + ``` + +2. Via the `--option` flag + + You can still use the `--option` flag but you'll need to specify the fully qualified name of the option. + + ```bash + --option @.= + + # For example + --option @typespec/openapi3.output-file=openapi.json + ``` + +#### Renamed Emitter Options + +| Before | Now | +| ---------------------- | ------------- | +| **@typespec/openapi3** | +| `outputFile` | `output-file` | + +## `@serviceHost` decorator replaced with `@server` decorator + +The `@serviceHost` decorator that decorated the root namespace was used to specify the domain name of the base service endpoint. This functionality has been replaced by the `@server` decorator, which allows specifying full and parametrized Uris for the service endpoint, as described [here](https://microsoft.github.io/typespec/docs/standard-library/http/#service-definition-and-metadata) + +### Before + +```typespec +@serviceHost("example.com") +namespace MyService; +``` + +### After + +```typespec +@server("https://example.com") +namespace MyService; +``` + +## Versioning uses enums instead of strings + +Versions must now be specified using string-valued enumerations, and each of the versioning decorators must reference an enum value rather than using the version string directly. + +```typespec +// Before +@versioned("2021-01-12" | "2022-01-15-preview") +namespace Api; + +// After +@versioned(Versions) +namespace Api; + +enum Versions { v2021_01_12: "2021-01-12", v2022_01_15_preview: "2022-01-15-preview" } +``` + +```typespec +// Before +@added("2022-01-15-preview") +model Foo {} + +// After +@added(Versions.v2022_01_15_preview) +model Foo {} +``` diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2022-08-10.md b/packages/website-astro/src/content/docs/current/release-notes/release-2022-08-10.md new file mode 100644 index 0000000000..0436e06207 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2022-08-10.md @@ -0,0 +1,285 @@ +--- +title: August 2022 +--- + +# Release Notes August 2022 (2022-08-10) + +This release contains **breaking changes** + +- Operation parameters without decorators +- OkResponse is no longer a template +- Route resolution changes +- Remove `Map` type +- `@path` may not decorate optional properties or parameters without a default value + +## Operation parameters without decorators + +A single undecorated (not marked `@query`, `@header`, `@body` or `@path`) operation parameter will now become a property of the request body rather than have its type define the request body. This allows defining the body with multiple unannotated parameters, which can include unannotated properties that are spread into parameters. (Previously, more than one unannotated parameter was an error.) + +For example, the following used to define a request body of type `string`, but now defines a request body that is an object with a property named `body` of type string. + +```typespec +op create(body: string): void; +``` + +To get the previous behavior, the parameter now needs to be explicitly marked with `@body`: + +```typespec +op create(@body body: string): void; +``` + +## OkResponse is no longer a template + +Previously, OkResponse took an argument for the body type. Now it is a simple model like the other XxxResponse types. Alone, it implies a status code of 200 with no body. + +Since 200 is the default status code for non-empty bodies, you can usually replace `OkResponse` with simply `T`. + +```typespec +op get(id: string): OkResponse; +``` + +Can be: + +```typespec +op get(id: string): Pet; +``` + +In certain situations where the body type is not (necessarily) a model, you will need to use the new `Body` type. For example. + +```typespec +op list(): OkResponse; +``` + +Can become: + +```typespec +op list(): OkResponse & Body; +``` + +Since 200 status code is used by default, this could also be: + +```typespec +op list(): Pet[]; +``` + +Generic models based on `OkResponse` may also require `Body`. For example: + +```typespec +model MyResponse { + ...OkResponse; + @header example: string; +} +``` + +Since T is not constrainted to be a model, it might be an intrinsic type, an array, or the like, the template should be changed to use `Body`: + +```typespec +model MyResponse { + ...OkResponse; + ...Body; + @header example: string; +} +``` + +In general, the prior `OkResponse` is equivalent to `OkResponse & Body` now or, equivalently, `{ ...OkResponse, ...Body }`. In practice there are many situations where you can leave out OkResponse altogether and use plain `T` rather than `Body`. + +See also https://microsoft.github.io/typespec/docs/standard-library/http/#request--response-bodies + +## Route resolution changes + +Resolving operation routes now follows the following logic: + +- if there is a service namespace specified + - only emit the operations and interfaces under that namespace(recursively) +- if not: + - only emit the operations and interfaces defined at the root (DO NOT look into namespaces) + +### Action if applicable + +- If a typespec spec used a service namespace without `@serviceTitle` add the `@serviceTitle` decorator to the service namespace, otherwise no routes will be emitted. +- If a typespec spec contains service namespaces that are not child namespaces of the service namespace, move these namespaces under the service namespace. + +### Cases + +#### Operation at the root + +```typespec +op test(): void; +``` + +✅ Stay the same + +| Before | After | +| ------- | ------- | +| `["/"]` | `["/"]` | + +#### Operation in namespace (not service namespace) + +```typespec +namespace DemoService; + +op test(): void; +``` + +⚠️ Output stays the same but add warning that no routes are emitted + +| Before | After | +| ------ | ----- | +| `[]` | `[]` | + +#### Operation in namespace (not service namespace) with @route + +```typespec +namespace DemoService; + +@route("/") +op test(): void; +``` + +⚠️ Now the same as previous case, no routes emitted and emit warning + +| Before | After | +| ------- | ----- | +| `["/"]` | `[]` | + +##### Resolve by adding the `@serviceTitle` decorator + +Add `@serviceTitle` to the namespace + +```typespec +@serviceTitle("DemoService") +namespace DemoService; + +@route("/") +op test(): void; +``` + +#### Operation in service namespace + +```typespec +@serviceTitle("My Service") +namespace Foo; + +op test(): void; +``` + +✅ Stay the same + +| Before | After | +| ------- | ------- | +| `["/"]` | `["/"]` | + +#### Operation in namespaces other than the service namespace + +```typespec +import "@typespec/rest"; + +using TypeSpec.Http; + +@serviceTitle("My Service") +namespace Foo { + @route("in-service") + op test(): void; +} + +namespace MyLib { + @route("my-lib") + op test(): void; +} +``` + +⚠️ Other namespace routes are not included anymore + +| Before | After | +| --------------------------- | ----------------- | +| `["/in-service", "my-lib"]` | `["/in-service"]` | + +##### Resolve by making additional namespaces children of the service namespace + +Make any added namespaces children of the service namespace + +```typespec +import "@typespec/rest"; + +using TypeSpec.Http; + +@serviceTitle("My Service") +namespace Foo { + @route("in-service") + op test(): void; +} + +namespace Foo.MyLib { + @route("my-lib") + op test(): void; +} +``` + +## Remove Map type + +`Map` type was removed. Usages of `Map` can be replaced with new type `Record`. Other usages of `Map` may be replaced with `object`. + +### Map using string key type + +```typespec +model Foo { + options: Map; +} +``` + +#### Replace with `Record` + +```typespec +model Foo { + options: Record; +} +``` + +### Map using non-string key type + +```typespec +model Foo { + options: Map; +} +``` + +#### Replace with `object` + +```typespec +model Foo { + options: object; +} +``` + +## `@path` may not decorate optional properties or parameters without a default + +Properties and parameters marked with the `@path` decorator should be required, but may be optional if they have a default value + +### optional path parameters + +```typespec +model Foo { + @path + name?: string; +} +``` + +Was a bad practice, but was allowed in previous versions. This will now throw an error diagnostic. + +### Resolve by making the property required + +```typespec +model Foo { + @path + name: string; +} +``` + +### Resolve by adding a default value + +```typespec +model Foo { + @path + name?: string = "singleton"; +} +``` diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2022-09-07.md b/packages/website-astro/src/content/docs/current/release-notes/release-2022-09-07.md new file mode 100644 index 0000000000..2d65e49e47 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2022-09-07.md @@ -0,0 +1,73 @@ +--- +title: September 2022 +--- + +# Release Notes September 2022 (2022-09-07) + +This release contains **breaking changes**: + +- **`Api`**: Remove `Type` suffix +- **`TypeSpec`**: Rename `Page` to `CollectionWithNextLink` +- **`Api`**: `Enum.members` change typed from `EnumMember[]` to `Map` +- **`TypeSpec`** **`Api`**: **Deprecation** of `@consumes` `@produces` decorators + +## **[API]** `Type` suffix removed from most `Type`s + +The following types have been renamed in the compiler API: + +- `ModelType` -> `Model` +- `ModelTypeProperty` -> `ModelProperty` +- `InterfaceType` -> `Interface` +- `EnumType` -> `Enum` +- `EnumMemberType` -> `EnumMember` +- `TemplateParameterType` -> `TemplateParameter` +- `NamespaceType` -> `Namespace` +- `OperationType` -> `Operation` +- `StringLiteralType` -> `StringLiteral` +- `NumericLiteralType` -> `NumericLiteral` +- `BooleanLiteralType` -> `BooleanLiteral` +- `TupleType` -> `Tuple` +- `UnionType` -> `Union` +- `UnionTypeVariant` -> `UnionVariant` +- `ProjectionType` -> `Projection` + +Update uses of the type names on the left with the type names on the right. The old names can still be used but they are deprecated and may be removed from a future release. + +## [TYPESPEC] Rename `Page` to `CollectionWithNextLink` + +In library `@typespec/rest` in `TypeSpec.Rest.Resources` namespace the `Page` model was renamed to `CollectionWithNextLink`. +This resolve an issue with `Page` being to generic of a name for this very opinionated model. + +Before + +```typespec +op test(): Page; +``` + +Rename to + +```typespec +op test(): CollectionWithNextLink; +``` + +## **[Api]** `Enum.members` change to `Map` [#953](https://github.com/microsoft/typespec/pull/953) + +Changed the type of the `members` property of `Enum` from `EnumMember[]` => `Map` + +```diff +-members: EnumMember[]; ++members: Map +``` + +## [TypeSpec] [Api] **Deprecation**: `@consumes` `@produces` + +Consumption of the data set by decorators was already removed in a previous release. Using them was a no-op. + +The following are deprecated and will be removed in next release. + +- `@consumes` +- `@produces` +- `getConsumes` +- `getProduces` + +Alternative is to use a `@header contentType: ` property on the operation parameters or return type diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2022-10-12.md b/packages/website-astro/src/content/docs/current/release-notes/release-2022-10-12.md new file mode 100644 index 0000000000..113c120759 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2022-10-12.md @@ -0,0 +1,125 @@ +--- +title: October 2022 +--- + +# Release Notes October 2022 (2022-10-12) + +This release contains **breaking changes**: + +- **`TypeSpec`**: Cannot `extends` or `is` a model expression via alias +- **`Api`**: Removed `createProgram` and changed `compile` parameter order +- **`TypeSpec`** **Deprecation** `@service` decorator replacing `@serviceTitle` and `@serviceVersion` +- **`TypeSpec`** **`Api`**: Move `@discriminator` to compiler + +## [TypeSpec] Cannot `extends` or `is` a model expression via alias [PR 1004](https://github.com/microsoft/typespec/pull/1004) + +Using model expression for `is` or `extends` directly was already forbidden. + + +```typespec +model IsModelExpr is {bar: string} {} + +model ExtendsModelExpr extends {bar: string} {} +``` + +The following workaround was however tolerated. This PR remove this functionality. + + +```typespec +alias ModExpr = {bar: string}; +model IsModelExprWAlias is ModExpr {} + +model ExtendsModelExprWAlias extends ModExpr {} +``` + +Use a named model instead of an alias. + +## [API] Removed `createProgram` and changed `compile` parameter order + +`createProgram` has been removed in favor of `compile`. The new compile has the same parameter as `createProgram` + +```ts +// Before +createProgram(host, "main.tsp); + +// After +compile(host, "main.tsp"); +``` + +`compile` api was changed to match the same order as old `createProggram` + +```ts +// Before +compile("main.tsp", host); + +// After +compile(host, "main.tsp"); +``` + +## [TypeSpec] Deprecation: @service decorator replacing `@serviceTitle` and `@serviceVersion` + +- `@serviceTitle` has been deprecated +- `@serviceVersion` has been deprecated + +```typespec +// Before +@serviceTitle("Pet Store") +@serviceVersion("v1") +namespace PetStore; + +// After +@service({"Pet Store", version: "v1"}) +namespace PetStore; +``` + +This allows to specify the service namespace without any title or version + +```typespec +@service +namespace PetStore; +``` + +## [TypeSpec] [Api] Move `@discriminator` to compiler + +The `@discriminator` has been moved to the compiler. This means that if you were using the fully qualified name to reference the decorator `@TypeSpec.Rest.disriminator` it should be changed to `@discriminator` + +**No changes** + +```typespec +using TypeSpec.Rest; + +@disriminator("kind") +model Pet {} +``` + +**Before** + +```typespec +@TypeSpec.Rest.disriminator("kind") +model Pet {} +``` + +**After** + +```typespec +@disriminator("kind") +model Pet {} +``` + +### Change to api + +the `getDiscriminator` accessor has also been removed into the compiler. + +Before + + +```ts +import { getDiscriminator } from "@typespec/rest"; +``` + +After + + +```ts +import { getDiscriminator } from "@typespec/compiler"; +``` diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2022-12-07.md b/packages/website-astro/src/content/docs/current/release-notes/release-2022-12-07.md new file mode 100644 index 0000000000..5a35a3cc82 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2022-12-07.md @@ -0,0 +1,293 @@ +--- +title: December 2022 +--- + +# Release Notes December 2022 (2022-12-07) + +:::danger +This release contains **breaking changes** +::: + +## New features + +### Decorator signature help + +With the decorator signature `extern dec` added in previous release and the doc comment support added in this version the IDE is able to provide a signature help for decorators + +![](./signature-help.png) + +## New `scalar` type + +:::danger +This is a breaking change [see details here](#change-to-typespec-intrinsic-models) +::: + +This release introduce a new [scalar](../language-basics/scalars.md) type meant to represent what were previously models with no properties actually representing an scalar value. + +```typespec +scalar uuid extends string; +``` + +## Emitter options interpolation and standardization + +Emitter options are not able to interpolate other values. See [details](../introduction/configuration/configuration.md#variable-interpolation) + +```yaml +output-dir: {cwd}/generated +options: + @typespec/openapi3: + emitter-output-dir: {output-dir}/openapi3 +``` + +## Breaking changes + +### `TypeSpec` `Api` `Compiler` Moved typespec intrinsic types to a new Type `scalar` + +A new type has been introduced to typespec in order to differentiate scalar from structured models types. Those new types can be declared using `scalar` and can extend another scalar using `extends`. + +#### Change to typespec intrinsic models + +All of TypeSpec intrinsic models have been updated to be `scalar` types instead of `model`. In most cases this shouldn't affect a spec but if you are defining a custom model that `is` one of the intrinsic types you'll have to update it + +Before + +``` +model MyStr is string; +``` + +After + +``` +scalar MyStr extends string; +``` + +##### Migration script + +The following script can be used to automatically migrate previous usages. + +```typespec +npx @typespec/migrate +``` + +#### Change to Compiler API + +Removed: + +- `getIntrinsicModelName`: Check it is a std type with `program.checker.isStdType(type)` and then use the `type.name` otherwise look for `type.baseScalar` +- `isIntrinsic`: Check it is a std type with `program.checker.isStdType(type)` or just remove the check if goal was to omit intrinsic types from models. + +Migration: + +1. Add a new switch to handle the new `scalar` type +2. To resolve a scalar type, check if its a std type using `program.checker.isStdType(type)` +3. If yes, do the same behavior has before with `getIntrinsicModelName` +4. If not, call `scalar.baseScalar` and repeat step 2. + +### `API` - Change to `onEmit` signature + +The signature of `onEmit` has been updated to accommodate for changes to the emitter options + +**Before** + +```ts +export function $onEmit(program: Program, options: MyEmitterOptions); +``` + +**Now** + +```ts +export function $onEmit(context: EmitContext); +``` + +Access properties + +| Before | Now | +| ----------------------- | --------------------------------------------------------------------------------------------------------------- | +| `program` | `context.program` | +| `options` | `context.options` | +| `options["output-dir"]` | `context.emitterOutputDir` [See details](#typespec-api-emitter-option-output-dir-renamed-to-emitter-output-dir) | + +### [TypeSpec] [Api] Emitter option `output-dir` renamed to `emitter-output-dir` + +The option has been renamed for all emitters as `emitter-output-dir` is now managed in the compiler +Before + +```yaml +emitters: + my-emitter: + output-dir: /path/to-output-dir +``` + +Now + +```yaml +emitters: + my-emitter: + emitter-output-dir: {output-dir}/for-this-emitter +# ^ can now reference the common output-dir +``` + +### Change to api + +**Before** + +```ts +export function $onEmit(program: Program, options: MyEmitterOptions) { + const outputDir = options["output-dir"]; +} +``` + +**Now** + +```ts +export function $onEmit(context: EmitContext) { + const outputDir = context.emitterOutputDir; +} +``` + +### `API > @typespec/compiler` Multiple services per typespec specs are now allowed making a service accessor obsolete. + +The following functions have been deprecated + +```ts +export function getServiceTitle(program: Program): string; +export function getServiceVersion(program: Program): string; +export function getServiceNamespace(program: Program): Namespace; +export function getServiceNamespaceString(program: Program): string | undefined; +export function setServiceNamespace(program: Program, namespace: Namespace); +``` + +and replaced with + +```ts +export interface ServiceDetails { + title?: string; + version?: string; +} +export interface Service extends ServiceDetails { + type: Namespace; +} + +export function listServices(program: Program): Service[]; +export function getService(program: Program, namespace: Namespace): Service | undefined; +export function isService(program: Program, namespace: Namespace): boolean; + +export function addService(program: Program, type: Namespace, details?: ServiceDetails); +``` + +Other changes to the service resolution: + +- Title won't be defaulted to `(title)` +- Version won't be defaulted to `0000-00-00` +- Service namespace won't be defaulted to global namespace + +| Before | To add support for multi serviceF | +| ------------------------------------ | -------------------------------------------------------------------------------------------- | +| `getServiceNamespace(program)` | `listServices(program)` to get all services | +| `getServiceNamespaceString(program)` | `getNamespaceName(service.type)` is where service is `getService(program, serviceNamespace)` | +| `getServiceTitle(program)` | `service.title` where service is `getService(program, serviceNamespace)` | +| `getServiceVersion(program)` | `service.version` where service is `getService(program, serviceNamespace)` | + +### `TypeSpec` Directives can no longer be placed in certain contexts. + +For example, this is no longer valid: + +```typespec +model M< +#suppress example +T +> {} +``` + +And will now result in an error "Cannot place directive on template parameter". + +Move such directives up to the nearest statement, interface operation, model property, operation parameter, union variant, or enum member. + +For the above example, that would be: + +``` +#suppress example +model M {} +``` + +## Deprecations + +:::caution +Deprecated items will be removed in 2 release cycle. +::: + +### `TypeSpec > @typespec/rest` - `@segmentSeparator` is deprecated. The `@actionSeparator` decorator should be used instead. + +Before + +```typespec +@autoRoute +namespace Things { + @action + @segmentSeparator(":") + @put + op customAction1( + @segment("things") + @path + thingId: string, + ): string; +} +``` + +After: + +```typespec +@autoRoute +namespace Things { + @action + @actionSeparator(":") + @put + op customAction1( + @segment("things") + @path + thingId: string, + ): string; +} +``` + +### `TypeSpec` Deprecated `uri` being replaced by `url` + +Before: + +```typespec +model Server { + endpoint: uri; +} +``` + +Now: + +```typespec +model Server { + endpoint: url; +} +``` + +### `Config` - Deprecated `emitters` property in the `tspconfig.yaml` + +The `emitters` property of the configuration file has been deprecated and replaced by 2 new properties making it consistent with the CLI + +Before: + +```yaml +emitters: + "@typespec/openapi3": + output-file: openapi3.json + other-emitter: true +``` + +After: + +```yaml +emit: + - "@typespec/openapi3" + - "other-emitter" +options: + @typespec/openapi3: + output-file: openapi3.json +``` diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2023-01-12.md b/packages/website-astro/src/content/docs/current/release-notes/release-2023-01-12.md new file mode 100644 index 0000000000..534e6c1c7b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2023-01-12.md @@ -0,0 +1,62 @@ +--- +title: January 2023 +--- + +# Release Notes January 2023 (2023-01-12) + +:::danger +This release contains **breaking changes** +::: + +## Breaking Changes + +### `@typespec/openapi3` Default output-file is `openapi.yaml` + +As the openapi3 emitter added support for serializing the openapi document to yaml it changed the default to emit yaml to `openapi.yaml`. + +```yaml +options: + @typespec/openapi3: + file-type: json +``` + +or alternatively specify the name of the file you'd want + +```yaml +options: + @typespec/openapi3: + output-file: custom.json +``` + +### [API] Templated operation inside interface + +This breaking change affects libraries and emitters + +- `templateArguments` property on templated type is deprecated and has been replaced with more detailed `templateMapper` + + If you where you using the `templateArgument` to find out if something was a template instance change + + ```ts + type.templateArguments.length > 0; + ``` + + to + + ```ts + isTemplateInstance(type); + ``` + +- Interfaces might have some templated operations + + If blindly including all operations in an interface you might need to make sure the operation is not a template declaration first. + + For example with the following tsp code: + + ```typespec + interface Factory { + read(): T; + ping(): void; + } + ``` + +The emitter probably only wants to include the `ping()` operation but ignore read(). The `isTemplateDeclaration` helper can be used to filter out the template operations. diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2023-02-07.md b/packages/website-astro/src/content/docs/current/release-notes/release-2023-02-07.md new file mode 100644 index 0000000000..b093ca047a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2023-02-07.md @@ -0,0 +1,151 @@ +--- +title: February 2023 +--- + +# Release Notes February 2023 (2023-02-07) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### Emitter Framework + +The new emitter framework makes it simpler to build emitters from TypeSpec to other assets. It provides an easy way to handle TypeSpec types and provides a template for asset emitters to spell out the emitter tasks. It provides helpers to solve many difficult problems, including: + +- Constructing references between types +- Handling circular references +- Propagating type context based on containers or references +- Class-based inheritance to encourage reuse and specialization of existing emitters + +Details are available on the documentation website or in the [repository documentation] (https://github.com/microsoft/typespec/blob/main/docs/extending-typespec/emitter-framework.md). + +### Cli support for emitters in development + +Use the path to the emitter to specify emitter options, rather than the emitter name. + +### Allow `@autoroute` and `@route` to be used together + +Provide standard rules for combining `@route` and `@autoroute` decorators + +- Allow `@route` applied to an operation to override route settings from the interface +- Allow `@route` on an operation to prepend the paths provided by `@autoroute` + +### Simplified versioning dependencies + +Introduced the `@useDependency` decorator to replace `@versionedDependency` decorator. Simplify dependencies between versioned namespaces, by allowing each version to be decorated with the appropriate versioned dependency, rather than requiring the user to construct a dependency map. + +## Breaking Changes + +Breaking changes in this release resulted from removal of previously decorated types and functions, including: + +- `uri` scalar removed. Use the `url` scalar instead. +- Removed deprecated metadata types with the 'type' suffix. + - Use `Enum` instead of `EnumType` + - Use `EnumMember` instead of `EnumMemberType` + - Use `Interface` instead of `InterfaceType` + - Use `Model` instead of `ModelType` + - Use `ModelProperty` instead of `ModelTypeProperty` + - Use `Namespace` instead of `NamespaceType` + - Use `Operation` instead of `OperationType` + - Use `Tuple` instead of `TupleType` + - Use `Union` instead of `UnionType` +- Removed `Map` type, use `Record` instead +- Removed `@serviceTitle` and `@serviceVersion` decorators. Use the `@service` decorator instead. +- Removed helper and accessor functions associated with `@serviceTitle` and `@serviceVersion` decorators + - Replace `getServiceNamespace`, `getServiceTitle`, `getServiceVersion`, and `getServiceNamespaceString` with `getService` or `listServices` + - Replace `setServiceNamespace` with `addService` +- Removed `@segmentSeparator`, use `@actionSeparator` instead +- Removed `@produces` and `@consumes` decorators. Use `@header contentType: ` instead in the operation return type +- Removed `getSegmentSeparator` function. Use `getActionSeparator` instead +- Removed `getProduces` and `getConsumes` functions. Use `getContentTypes` instead + +## Deprecations + +### Deprecates the `@versionedDependency` decorator in favor of the `@useDependency` decorator + +For versioned libraries, `@useDependency` is applied to the version enum members + +#### Before (versioned namespace) + +```typespec +@armProviderNamespace +@service({ + title: "Microsoft.Observability", +}) +@versionedDependency( + [ + [Microsoft.Observability.Versions.v2021_06_13_preview, Azure.Core.Versions.v1_0_Preview_2], + [Microsoft.Observability.Versions.v2022_04_30_preview, Azure.Core.Versions.v1_0_Preview_2] + ] +) +@versionedDependency( + [ + [ + Microsoft.Observability.Versions.v2021_06_13_preview, + Azure.ResourceManager.Versions.v1_0_Preview_1 + ], + [ + Microsoft.Observability.Versions.v2022_04_30_preview, + Azure.ResourceManager.Versions.v1_0_Preview_1 + ] + ] +) +@versioned(Versions) +namespace Microsoft.Observability; + +interface Operations extends Azure.ResourceManager.Operations {} + +enum Versions { + v2021_06_13_preview: "2021-06-13-preview", + v2022_04_30_preview: "2022-04-30-preview", +} +``` + +#### After (Versioned namespace) + +```typespec +@armProviderNamespace +@service({ + title: "Microsoft.Observability", +}) +@versioned(Versions) +namespace Microsoft.Observability; + +interface Operations extends Azure.ResourceManager.Operations {} + +enum Versions { + @useDependency(Azure.Core.Versions.v1_0_Preview_2, Azure.ResourceManager.Versions.v1_0_Preview_1) + v2021_06_13_preview: "2021-06-13-preview", + + @useDependency(Azure.Core.Versions.v1_0_Preview_2, Azure.ResourceManager.Versions.v1_0_Preview_1) + v2022_04_30_preview: "2022-04-30-preview", +} +``` + +For unversioned libraries that reference versioned libraries, simply replace `@versionedDependency` with `@useDependency` + +#### Before (unversioned namespace using versioned library) + +```typespec +@service({ + title: "Microsoft.EnvelopeTest", + version: "2021-09-21-preview", +}) +@versionedDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@armProviderNamespace +namespace Microsoft.EnvelopeTest; +``` + +#### After (unversioned namespace using versioned library) + +```typespec +@service({ + title: "Microsoft.EnvelopeTest", + version: "2021-09-21-preview", +}) +@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@armProviderNamespace +namespace Microsoft.EnvelopeTest; +``` diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2023-03-13.md b/packages/website-astro/src/content/docs/current/release-notes/release-2023-03-13.md new file mode 100644 index 0000000000..843e0c58f9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2023-03-13.md @@ -0,0 +1,69 @@ +--- +title: March 2023 +--- + +# Release Notes March 2023 (2023-03-13) + +:::danger +This release contains **breaking changes** + +Please see [Cadl to TypeSpec rename and migration FAQ](./cadl-typespec-migration.md) +::: + +## New Features + +### Add--config option + +Enable specifying path to configuration file + +### Allow escaping identifiers using backticks + +Identifiers may contain reserved words or non-standard characters when surrounded with backticks (`), for example: + +```typespec +op `op`(): void; +``` + +### Correct Order of Application for augment decorators + +Augment decorators applied last + +### Added migration script for specs using Cadl + +Migration script available for existing specs, see `@typespec/migrate` for details + +### Added public formatIdentifier function + +Added public formatIdentifier function. + +### Visibility defaults to read + +Default visibility is configurable, but default to 'read'. + +## Breaking Changes + +### Cadl renamed to Typespec + +All core cadl packages moved from the `@cadl-lang` group to the `@typespec` group + +| Old Package Name | New Package Name | +| --------------------- | ------------------------------ | +| @cadl-lang/compiler | @typespec/compiler | +| @cadl-lang/rest | @typespec/rest, @typespec/http | +| @cadl-lang/migrate | @typespec/migrate | +| @cadl-lang/openapi | @typespec/openapi | +| @cadl-lang/openapi3 | @typespec/openapi3 | +| @cadl-lang/versioning | @typespec/versioning | + +### `rest` library split into `http` and `rest` libraries + +Basic http protocol support is in the `http` library, support for resources and ReST are in the `rest` library. The migration tool will correctly update imports in your spec to match the new +libraries. + +### Removed Support for Visual Studio 2019 in Visual Studio IDE extension + +You must use a later version of Visual Studio + +### Removed `emitters` option in configuration + +Use `emit` and `options` instead diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2023-04-11.md b/packages/website-astro/src/content/docs/current/release-notes/release-2023-04-11.md new file mode 100644 index 0000000000..6f0fa53770 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2023-04-11.md @@ -0,0 +1,116 @@ +--- +title: April 2023 +--- + +# Release Notes April 2023 (2023-04-11) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### @typespec/compiler + +- Emit diagnostic when ambiguous symbol exists between global and usings +- Add support for referencing metatypes ModelProperty `::type` and Operation `::returnType` and `::parameters` +- Relax constraint on derived type overrides +- Prevent use of augment decorators on instantiated templates. +- Allow projectedNames helpers to work with previous projections +- Add helper `interpolatePath` for emitter to do additional interpolation on config properties +- Api: Update `getTypeName` to omit standard library namespace +- Allow overloads in interfaces to work under projection +- Add pre-projection support +- Provide access to extended interfaces in type graph +- Document member ordering and fix projection rename reordering + +### @typespec/openapi3 + +- Support shared routes +- Update to use new `interpolatePath` logic to resolve the `output-file` + +### @typespec/migrate + +- Add migrate script for zonedDateTime +- Add migration script for `@header` and `@query` format required + +## Bug Fixes + +### @typespec/compiler + +- Fix: emitter framework will now visit scalar declarations +- Fix: Alias unknown ref crash +- Fix: Empty model expression assignable to array +- Fix: `tsp code uninstall` not finding extension to uninstall +- Fix: Issue where template parameter type check wouldn't work if constraint is exact same type as next validation + +### @typespec/rest + +- Fix: Issue where `@action("")` was treated the same as `@action`. Now this emits an error. + +### @typespec/versioning + +- Fix: Issue with using version as a template parameter across different namespaces. Includes a significant change in the versioning library internals. +- Fix:Use pre-projections to fix issues with versioned resources. + +### VS Code extension + +- Fix: Highlighting of TypeSpec code blocks in markdown. + +## Breaking Changes + +### @typespec/versioning: Removed deprecated versioning symbols. + +- Removed `@versionedDependency` decorator. Use `@useDependency` instead. +- Removed `getRenamedFromVersion`. Use `getRenamedFromVersions` instead. +- Removed `getRenamedFromOldName`. Use `getNameAtVersion` instead. +- Removed `getAddedOn`, `addedAfter`, `getRemovedOn` and `removedOnOrBefore`. Use `existsAtVersion` instead. +- Removed `renamedAfter`. Use `hasDifferentNameAtVersion` instead. + +### @typespec/compiler: Removed `zonedDateTime` and replaced with `utcDateTime` and `offsetDateTime` + +To disambiguate important time concepts and encourage best practice behavior in representing date-time types we +removed `zonedDateTime` which was being used to represent a time with offset, and replaced it with two new types that are more precisely defined: + +- `utcDateTime` which represents a precise instant in time. This type should be used to represent time values given in coordinated universal time (UTC) and unix timestamps. This is the preferred mechanism for capturing dateTime in most service specifications. +- `offsetDateTime` which represents a time with offset. Note that while this time contains an offset from UTC, it does not contain any additional time zone information. + +#### Change instances of `zonedDateTime` to `utcDateTime` + +##### Old + +```typespec +model MyModel { + createdAt: zonedDateTime; +} +``` + +#### New + +```typespec +model MyModel { + createdAt: utcDateTime; +} +``` + +#### Use the (experimental) Migration tool to make this change + +The (experimental) migration tool will automatically migrate instances of `zonedDateTime` to `utcDateTime`. To perform all migrations in a TypeSpec or Cadl specification package, execute: + +```bash +npx @typespec/migrate +``` + +If you would like to execute from a different folder or don't have a package.json that indicates compiler package versions, please see command line options: + +```bash +npx @typespec/migrate --help +``` + +### @typespec/http: Removed header and query default format + +`@header` and `@query` no longer default the `format` to `csv` and `multi` respectively. A value must now be provided when the type is an array. The migration tool can also be used to make this change. + +### @typespec/lint: Removed global state + +Rules from another library can no longer be enabled on a LibraryLinter. diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2023-05-10.md b/packages/website-astro/src/content/docs/current/release-notes/release-2023-05-10.md new file mode 100644 index 0000000000..249a9b0777 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2023-05-10.md @@ -0,0 +1,133 @@ +--- +title: May 2023 +--- + +# Release Notes May 2023 (2023-05-10) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### @typespec/compiler features + +- Add `@encode` decorator, with new formats for date and duration encoding support + - `"rfc3339"`, `"rfc7231'` for `utcDateTime`, `offsetDateTime` types + - `"unixTimestamp"` support for `utcDateTime` type + - `"iso8601"` support for `duration` types + - `"base64"`, `"base64url"` support for `bytes` types +- Allow default values for required model properties and parameters +- `sourceModel` property added to `Model` types +- `sourceOperation` property added to `Operation` types +- `Model` and `Scalar` types added to `TypeSpec.Reflection` namespace + +### @typespec/http features + +- add `@sharedRoute` decorator +- allow union types within a response status code + +### @typespec/openapi3 features + +- Enhanced support for shared routes +- Support for union types within a response status code + +## Bug Fixes + +- General fixes to generated reference documentation for all modules + +### @typespec/compiler fixes + +- Fix: compiler mismatch error recommendation +- Fix: Interface with templated operation causing crash if defined after use +- Fix: Issue with templated operations in templated interface would get cached only by keying on the operation template args. +- Fix: `missing-index` diagnostic showing at the wrong location +- Fix: `--emit` pointing to emitter js entrypoint resolve correct options +- Fix: `scalar` template parameter name conflict with each other + +### @typespec/migrate fixes + +- Fix: incorrect resolution of tsp version +- Fix: always loading current version of compiler + +### @typespec/openapi3 fixes + +- Fix openapi3 emitter to mark request body required +- Fix issue where shared request bodies did not emit correctly. + +### @typespec/rest + +- Add validation to ensure that @action or @collectionAction operations have a specified name when used with `@sharedRoute` + +### @typespec/versioning + +- Fix: Crash during validation when using certain templated models from versioned library +- Added validation preventing version enums from having duplicate values. +- Fix issue where "is" dependencies were not detected. +- Raise error if versioned spec specifies a single service version. + +## Breaking Changes + +### `@typespec/compiler`: `isTemplateDeclaration` will only return true for the original declaration and not partially instantiated templates + +If library or emitter code needs to detect a partially instantiated template, the code will need to check `isTemplateInstance` _and_ `isTemplateDeclaration` properties are false. + +## Deprecations + +### `@typespec/compiler`: Use `@encode` instead of `@format` for encoding scalars and properties of type `bytes` + +The new `@encode` decorator should be used whenever the serialized type on the wire differs from the analogous TypeSpec type + +#### Old deprecated usage of `@format` decorator + +```typespec +model Foo { + @format("base64url") + bar: bytes; +} +``` + +#### New usage of `@encode` decorator + +```typespec +model Foo { + @encode("base64url") + bar: bytes; +} +``` + +### http: Use `@sharedRoute` instead of the `shared` property of `@route` options + +The new `@sharedRoute` decorator replaces `@route` options for identifying operations that share a route + +#### Old deprecated usage of `@route` decorator `shared` option + +```typespec +@route( + "/doStuff", + { + shared: true, + } +) +op doIntStuff(input: int32): int32; + +@route( + "/doStuff", + { + shared: true, + } +) +op doStringStuff(input: string): string; +``` + +#### New usage of `@sharedRoute` decorator + +```typespec +@sharedRoute +@route("/doStuff") +op doIntStuff(input: int32): int32; + +@sharedRoute +@route("/doStuff") +op doStringStuff(input: string): string; +``` diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2023-06-06.md b/packages/website-astro/src/content/docs/current/release-notes/release-2023-06-06.md new file mode 100644 index 0000000000..d8df3c9510 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2023-06-06.md @@ -0,0 +1,152 @@ +--- +title: June 2023 +--- + +# Release Notes June 2023 (2023-06-06) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +- Json Schema Emitter +- New decimal types +- Support for using doc comments instead of the @doc decorator +- New `valueof` type constraint modifier for type literals +- Lazy evaluation of emitter configuration +- Signature Help for Template Arguments and other IDE improvements + +### New Decimal Types + +Added support for `decimal` and `decimal128` types + +```typespec +model Foo { + price: decimal; + shortPrice: decimal128; +} +``` + +These types represent values stored in decimal format which are often used in financial calculations to avoid rounding errors introduced by binary floating point formats. `decimal` can store values of any size and precision, while `decimal128` corresponds to the 128 bit decimal floating point format described by IEEE 754. + +### Support for Doc Comments + +Doc comments (`/** */`) will be treated as the documentation for types, unless there is an explicit `@doc` decorator + +```typespec +/** This will now be the documentation for model Foo */ +model Foo { + name: string; +} +``` + +### New `valueof` type constraint modifier to require type literals + +Templates and decorators can now constrain arguments to literal types. For example, the following template constraint: + +```typespec +model Foo { + @doc(T) + name: string; +} +``` + +would match quoted literal strings, "this", as well as references to enum values. Templates and decorators that require string values should change to using this new formulation. + +### Allow lazy evaluation of emitter config + +- Validate linter configuration only for linters that are executing. This removes warnings for emitters that are configured but not available in a particular compilation. + +### Enable Signature Help for Template Arguments + +- Template completion will now have similar help in IDE language server as decorators currently do. + +### Show documentation Comments on Aliases in IDE Language Tooling + +- Documentation comments will show up in the IDE, just as documentation comments for other library types. + +### Ensure a dev release for all packages + +- Packages with no changes will now release with a `-dev.0` version in dev releases. + +### Json Schema Emitter + +- Core packages now contain a Json Schema emitter `@typespec/json-schema` + +## Bug Fixes + +-`tspconfig.yaml` should always get resolved relative to the entrypoint. + +- `Array` and `Record` doc comments are treated as developer documentation. + +- Fixed formatting of comment between decorator and `op` statement. + +- Decorators on operations may reference the same operation, or may reference an operation that references this operation. + +```typespec +interface FooOperations { + @nextPageOperation(getNextPage) // allowed + getNextPage(pageLink: url): Page; +} +``` + +- Fix validation for `unixTimeStamp`. + +- Fix diagnostic for `intrinsic type expected` to not assume `string` as the required type. + +- Fix error message for `@encode` errors. + +- Fix error handling when template is missing or invalid in `tsp init`. + +- Emitter framework: uppercase type argument type names when constructing a declaration name from a template instantiation. + +- Add reference documentation for missing decorators. + +- Remove dependency on `node-fetch`. + +- Remove inaccurate output directory message from compilation success. + +- Allow template resolution over http redirects for `tsp init` templates. + +- Improve signature help for an unterminated argument list. + +## New Deprecations + +- Templates that use decorators with the `valueof` constraint will receive a warning if their input types are not similarly constrained. + +```typespec +model Foo { + @doc(T) // valueof constraint here will cause a warning + id: uuid; +} +``` + +should be changed to apply the valueof constraint to their parameters that are passed to such decorators: + +```typespec +model Foo { + @doc(T) // no warning + id: uuid; +} +``` + +- The `object` type is deprecated. Templates and decorators should use TypeSpec.Reflection.Model to indicate a model contraint. In specs, `{}` designates and empty model, `unknown[]` indicates and empty array, and `Record` indicates a keyed type with unknown property types. + +## Breaking Changes + +- Decorators that require literal type value marshalling MUST change to using the `valueof` keyword. + +```typespec +extern dec myDecorator(target: Type, name: string); +``` + +Must be changed to use the valueof decorator + +```typespec +extern dec myDecorator(target: Type, name: valueof string); +``` + +- Arrays are no longer assignable to an empty model (or object) + +- Remove `@format(\"url\") from url scalar. OpenAPI emitters will still emit the appropriate format, emitters should rely on the scalar type to determine how to process the url type, not the format string. diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2023-07-11.md b/packages/website-astro/src/content/docs/current/release-notes/release-2023-07-11.md new file mode 100644 index 0000000000..f59cd4be2d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2023-07-11.md @@ -0,0 +1,92 @@ +--- +title: July 2023 +--- + +# Release Notes July 2023 (2023-07-11) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### `@typespec/compiler` and core language + +- New built-in linter system. Typespec libraries are able to define linting rules which can be configured in `tspconfig.yaml`. See documentation for [configuring a linter](https://microsoft.github.io/typespec/introduction/configuration#linter---configuring-linters) and [writing a linter](https://microsoft.github.io/typespec/extending-typespec/linters) +- Allow decorators, directives and doc comments to be specified in any order +- Format doc comments above decorators and directives +- Improve formatting for properties with comments and decorators +- Support for new Unicode 15.0 identifier characters + +### Emitter framework + +- Add `writeOutput` to TypeEmitter for additional customization in writing generated files +- Add `meta` property to source files and declarations to store arbitrary metadata +- Add support for emitting enum member references +- Add new `TypeEmitter` methods for scalar instantiation + +### `@typespec/http` library + +- Add documentation on automatic header name resolution from property name for `@header` decorator + +### `@typespec/json-schema` emitter + +- Support `@extension` for adding arbitrary vendor extensions into the output +- Add support for `Record` +- Support templates instantiated with intrinsic types and type expressions +- Export emitter and related types from the npm package +- By default, types that are not marked with `@jsonSchema` or are within a namespace with `@jsonSchema` are bundled into the schemas that reference them. Set the `emitAllRefs` option to true to get the previous behavior of emitting all types referenced as JSON Schema + +### `@typespec/openapi3` emitter + +- Omit `x-typespec-name` extension by default from openapi3 output. A new configuration and command line option `include-x-typespec-name: \"inline-only\" | \"never\"` has been added to get previous behavior + +### `@typespec/rest` library + +- Add `isListOperation` function migrated from `@typespec/compiler` + +## Bug Fixes + +### `@typespec/compiler` and core language bug fixes + +- Add support for `UTF-8 with bom` for other files loaded by typespec compiler. `.tsp` files already had support, this make it more available for any library/emitter using the compiler api to load a file. +- Fix signature help after comment with no closing parenthesis or angle bracket +- Doc comment `/** */` should override base type doc in `model is` or `op is` +- Formatter incorrectly formatting `::` to `.` +- Fix formatting issue with comment between decorator and scalar or interface +- Fix stack overflow when a circular reference with `op is` exists inside an interface. +- Clean up handling of non-standard entrypoints in language server +- Fix stack overflow when referencing decorator target in checker and projections + +### `@typespec/openapi3` emitter bug fixes + +- OpenAPI emitters: treat union namespaces like namespaces for other types + +### Emitter framework bug fixes + +- Fix that some context methods were not being passed the expected parameters +- Fix that context was set incorrectly for some `TypeEmitter` methods, and add missing context methods for model properties, enum members, and union variants + +### `@typespec/json-schema` emitter bug fixes + +- Fix a bug that could result in a schema being bundled more than once + +## Breaking Changes + +### For Specification Authors + +- Update tsp init template schema for future extensibility. Older tsp version will fail validation when trying to initialize a project with a new template definition. +- Json Schema Emitter: the namespace has been corrected to TypeSpec.JsonSchema. Update any using statements from `JsonSchema` to `TypeSpec.JsonSchema`, and any references from `JsonSchema.[Type]` to `TypeSpec.JsonSchema.[Type]`. + +### For Emitters and Libraries + +- Minimum version of TypeScript updated to 5.0. TypeSpec is using new features available in TypeScript 5.0 which result in a definition file not parsable by older version. Note that this only affect compiling TypeScript code and is not breaking any JS or TypeSpec code. [See more information on typescript 5.0](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/) +- Emitter Framework: Add support for templates instantiated with types without declared names. In such cases, `TypeEmitter`'s declarationName method may return `undefined`, and so the various `*Instantiation` methods might be called with an undefined name, and `AssetEmitter`'s `emitDeclarationName` method might return undefined. +- Make internal `@resourceTypeForKeyParam` decorator in `@typespec/rest` library private + +## Deprecations + +- `@list` decorator from TypeSpec core is deprecated. Use `@listsResource` from `@typespec/http` instead +- `isListOperation` function from TypeSpec core is deprecated. Use `isListOperation` from `@typespec/http` instead +- `getListOperationType` from TypeSpec core is deprecated +- `@typespec/linter` Package is deprecated in favor of built-in linter system diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2023-08-08.md b/packages/website-astro/src/content/docs/current/release-notes/release-2023-08-08.md new file mode 100644 index 0000000000..2258de93d2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2023-08-08.md @@ -0,0 +1,59 @@ +--- +title: August 2023 +--- + +# Release Notes August 2023 (2023-08-08) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### `@typespec/compiler` New Features + +- Allow unnamed variants in named unions +- Add `#deprecated` directive to replace `@deprecated` decorator, allowing deprecation any language element +- Add a new util `resolveCompilerOptions` to resolve compiler options from a given entrypoint. This will resolve the options from the tspconfig.yaml in the same way the cli would. +- Improvements to compiler watch mode. Files loaded in previous compilation will be watched for changes. +- Allow library dependency versions to be specified in init templates using the form `{ name: \"the-lib\", version: \"1.0.0\" }` +- Update init template version compare to be greaterThanAndEqual instead of greaterThan. + +### `@typespec/http` New Features + +- Update model, operation and template docs for OpenAPI developers +- Add collection format support for query and header properties: simple, form, ssv, tsv, pipes + +### `@typespec/openapi` and `@typespec/openapi3` New Features + +- Add new `@info` decorator providing the ability to specify the additional fields from openapi info object. +- Support collection format support for query and header properties: simple, form, ssv, tsv, pipes +- Change datetimes encoded with `rfc7231` to produce format `http-date` instead of `date-time-rfc7231` to be inline with [Openapi format registry](https://spec.openapis.org/registry/format/) + +## Bug Fixes + +### `@typespec/compiler` Bug Fixes + +- Fix: Compiler version mismatch error would fire incorrectly +- Fix some issues with not reporting deprecation on template constraints +- Fix issue where using augment decorators on spread model properties, enum members or operations extended from parent interface would have no effect. +- Fix issue where using augment decorator on operation parameters applied to source operation parameter as well. +- Fix `warn-as-error` configuration in `tspconfig.yaml` was ignored +- Emit diagnostic for an unresolved metatype property reference +- Fix crash when `using` argument is not a namespace + +### `@typespec/openapi3` Bug Fixes + +- Fix: Emit clear diagnostics for empty unions and enum types +- Fix: Apply `@minItems` and `@maxItems` decorators on model array + +### `@typespec/jsonschema` + +- Fix: Crash when using interfaces inside a `@jsonSchema` namespace + +## Breaking Changes + +### `@typespec/compiler` Breaking Changes + +- Emitter Framework: `sourceFile` method can return a `Promise`. This allows running async processes when generating the file content, such as a formatter. This results in a potential breaking change if calling `emitSourceFile` where you'll have to add `await` before. +- The helper function `formatTypeSpec` is now async. Formatter was updated to use prettier 3.0. diff --git a/packages/website-astro/src/content/docs/current/release-notes/release-2023-09-12.md b/packages/website-astro/src/content/docs/current/release-notes/release-2023-09-12.md new file mode 100644 index 0000000000..ba0bf66744 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/release-notes/release-2023-09-12.md @@ -0,0 +1,87 @@ +--- +title: September 2023 +--- + +# Release Notes September 2023 (2023-09-12) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### `@typespec/compiler` New Features + +- Allow library authors to precisely define the visibility of operation templates with new decorators `@parameterVisibility` and `@returnTypeVisibility`, paired with corresponding accessor methods `getParameterVisibility` and `getReturnTypeVisibility`. +- Add coloring for documentation comments in Visual Studio and Visual Studio Code language extensions. +- Change yaml parser from `js-yaml` to `yaml`, enabling more precise validation and error reporting in `tspconfig.yaml` +- Added validation to ensure that properties of a derived model (using `extends`) are compatible with the base model indexer. +- Export `CompilerOptions` TypeScript type. +- Report library information when library code crashes during `$onValidate` execution. +- Diagnostics reported on a node with an `id` property will highlight the id instead of the entire node. For example, if a diagnostic is reported on a `model` type, the model name will be highlighted, instead of the entire model definition. + +### `@typespec/http` New Features + +- Add new helper method `resolveRequestVisibility` which incorporates settings from new core decorators `@parameterVisibility` and `@returnTypeVisibility`. This replaces the deprecated `getRequestVisibility` helper. +- Add new helper method `getDefaultVisibilityForVerb` which returns the default visibility for Http verbs. +- Add validation step to issue a warning when an `operation is` statement does not include route information from the original operation container (`interface` or `namespace`). This helps to prevent unexpected route changes when using operation references. +- Add validation to prevent runtime errors when `OAuth2Auth` is given invalid `OAuth2Flow` arguments. + +### `@typespec/json-schema` New Features + +- Support decimal scalar types. + +### `@typespec/openapi3` New Features + +- Allow library authors to override default Http verb visibility in operation declarations. + +### `@typespec/protobuf` New features + +- Support `omit-unreachable-types` option. +- Automatically convert empty operation parameters into a reference to `google.protobuf.Empty` instead of synthesizing an empty model. + +### `typespec-vscode` New features + +- Add color definition for `@param` tag in documentation comments + +## Bug Fixes + +### `@typespec/compiler` Bug Fixes + +- Fix issue where specifying a directory using the `--config` command line option would search the parent folder hierarchy looking for `tspconfig.yaml`. +- Fix Stack overflow when a model property references itself. +- Fix compiler crash when using the alias of a namespace that has decorators. +- Fix compiler freeze when an invalid token appears between doc comment and type. +- Fix compiler crash when relating recursive types. +- Fix typo in format error diagnostic. + +### `@typespec/openapi3` Bug Fixes + +- Fixed issue where parameters marked with visibility \"create\" did not appear in a `PATCH` request body. +- Fixed incorrect usage of `exclusiveMinimum` and `exclusiveMaximum` boolean properties. +- Use `anyOf` instead of `oneOf` for operations with shared routes and different request or response bodies. +- Fix handling of `Record` in `model is` and `model extends` statements. + +### `@typespec/versioning` Bug Fixes + +- Fixed validation in `@typeChangedFrom` for incorrect versioned references. + +## Deprecations + +### `@typespec/compiler` Deprecations + +- The `@deprecated` decorator has been marked as deprecated. Use `#deprecated` directive instead. + +### `@typespec/http` Deprecations + +- The `getRequestVisibility` helper function is now deprecated. Use `resolveRequestVisibility` or `getDefaultVisibilityForVerb` instead. + +## Breaking Changes + +### `@typespec/compiler` Breaking Changes + +- A semicolon is now required at the end of augment decorator statements. The formatter was already inserting the semicolon, if omitted. For example: + + ```tsp + @@doc(MyType.myProperty, "Documentation for myProperty"); + ``` diff --git a/packages/website-astro/src/content/docs/current/release-notes/signature-help.png b/packages/website-astro/src/content/docs/current/release-notes/signature-help.png new file mode 100644 index 0000000000..63d02f100c Binary files /dev/null and b/packages/website-astro/src/content/docs/current/release-notes/signature-help.png differ diff --git a/packages/website-astro/src/content/docs/current/standard-library/built-in-data-types.md b/packages/website-astro/src/content/docs/current/standard-library/built-in-data-types.md new file mode 100644 index 0000000000..9badf3d43e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/built-in-data-types.md @@ -0,0 +1,415 @@ +--- +title: "Built-in Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- +# Data types +## TypeSpec +### `Array` {#Array} + + + + +```typespec +model Array +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | The type of the array elements | + + + +### `DefaultKeyVisibility` {#DefaultKeyVisibility} + +Applies a visibility setting to a collection of properties. + +```typespec +model DefaultKeyVisibility +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | An object whose properties are spread. | +| Visibility | The visibility to apply to all properties. | + + + +### `object` {#object} + +Represent a model + +```typespec +model object +``` + + + +### `OmitDefaults` {#OmitDefaults} + +Represents a collection of properties with default values omitted. + +```typespec +model OmitDefaults +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | An object whose spread property defaults are all omitted. | + + + +### `OmitProperties` {#OmitProperties} + +Represents a collection of omitted properties. + +```typespec +model OmitProperties +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | An object whose properties are spread. | +| TKeys | The property keys to omit. | + + + +### `OptionalProperties` {#OptionalProperties} + +Represents a collection of optional properties. + +```typespec +model OptionalProperties +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | An object whose spread properties are all optional. | + + + +### `Record` {#Record} + + + + +```typespec +model Record +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | The type of the properties | + + + +### `ServiceOptions` {#ServiceOptions} + +Service options. + +```typespec +model ServiceOptions +``` + + + +### `UpdateableProperties` {#UpdateableProperties} + +Represents a collection of updateable properties. + +```typespec +model UpdateableProperties +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | An object whose spread properties are all updateable. | + + + +### `BytesKnownEncoding` {#BytesKnownEncoding} + +Known encoding to use on bytes + +```typespec +enum BytesKnownEncoding +``` + + + +### `DateTimeKnownEncoding` {#DateTimeKnownEncoding} + +Known encoding to use on utcDateTime or offsetDateTime + +```typespec +enum DateTimeKnownEncoding +``` + + + +### `DurationKnownEncoding` {#DurationKnownEncoding} + +Known encoding to use on duration + +```typespec +enum DurationKnownEncoding +``` + + + +### `boolean` {#boolean} + +Boolean with `true` and `false` values. + +```typespec +scalar boolean +``` + + + +### `bytes` {#bytes} + +Represent a byte array + +```typespec +scalar bytes +``` + + + +### `decimal` {#decimal} + +A decimal number with any length and precision. + +```typespec +scalar decimal +``` + + + +### `decimal128` {#decimal128} + +A 128-bit decimal number. + +```typespec +scalar decimal128 +``` + + + +### `duration` {#duration} + +A duration/time period. e.g 5s, 10h + +```typespec +scalar duration +``` + + + +### `float` {#float} + +A number with decimal value + +```typespec +scalar float +``` + + + +### `float32` {#float32} + +A 32 bit floating point number. (`±5.0 × 10^−324` to `±1.7 × 10^308`) + +```typespec +scalar float32 +``` + + + +### `float64` {#float64} + +A 32 bit floating point number. (`±1.5 x 10^−45` to `±3.4 x 10^38`) + +```typespec +scalar float64 +``` + + + +### `int16` {#int16} + +A 16-bit integer. (`-32,768` to `32,767`) + +```typespec +scalar int16 +``` + + + +### `int32` {#int32} + +A 32-bit integer. (`-2,147,483,648` to `2,147,483,647`) + +```typespec +scalar int32 +``` + + + +### `int64` {#int64} + +A 64-bit integer. (`-9,223,372,036,854,775,808` to `9,223,372,036,854,775,807`) + +```typespec +scalar int64 +``` + + + +### `int8` {#int8} + +A 8-bit integer. (`-128` to `127`) + +```typespec +scalar int8 +``` + + + +### `integer` {#integer} + +A whole number + +```typespec +scalar integer +``` + + + +### `numeric` {#numeric} + +A numeric type + +```typespec +scalar numeric +``` + + + +### `offsetDateTime` {#offsetDateTime} + +A date and time in a particular time zone, e.g. "April 10th at 3:00am in PST" + +```typespec +scalar offsetDateTime +``` + + + +### `plainDate` {#plainDate} + +A date on a calendar without a time zone, e.g. "April 10th" + +```typespec +scalar plainDate +``` + + + +### `plainTime` {#plainTime} + +A time on a clock without a time zone, e.g. "3:00 am" + +```typespec +scalar plainTime +``` + + + +### `safeint` {#safeint} + +An integer that can be serialized to JSON (`−9007199254740991 (−(2^53 − 1))` to `9007199254740991 (2^53 − 1)` ) + +```typespec +scalar safeint +``` + + + +### `string` {#string} + +A sequence of textual characters. + +```typespec +scalar string +``` + + + +### `uint16` {#uint16} + +A 16-bit unsigned integer (`0` to `65,535`) + +```typespec +scalar uint16 +``` + + + +### `uint32` {#uint32} + +A 32-bit unsigned integer (`0` to `4,294,967,295`) + +```typespec +scalar uint32 +``` + + + +### `uint64` {#uint64} + +A 64-bit unsigned integer (`0` to `18,446,744,073,709,551,615`) + +```typespec +scalar uint64 +``` + + + +### `uint8` {#uint8} + +A 8-bit unsigned integer (`0` to `255`) + +```typespec +scalar uint8 +``` + + + +### `url` {#url} + +Represent a URL string as described by https://url.spec.whatwg.org/ + +```typespec +scalar url +``` + + + +### `utcDateTime` {#utcDateTime} + +An instant in coordinated universal time (UTC)" + +```typespec +scalar utcDateTime +``` + + diff --git a/packages/website-astro/src/content/docs/current/standard-library/built-in-decorators.md b/packages/website-astro/src/content/docs/current/standard-library/built-in-decorators.md new file mode 100644 index 0000000000..a6dcb9ade1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/built-in-decorators.md @@ -0,0 +1,997 @@ +--- +title: "Built-in Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- +# Built-in Decorators +## TypeSpec +### `@deprecated` {#@deprecated} + +Mark this type as deprecated. + +NOTE: This decorator **should not** be used, use the `#deprecated` directive instead. + +```typespec +@deprecated(message: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| message | `valueof scalar string` | Deprecation message. | + +#### Examples + +Use the `#deprecated` directive instead: + +```typespec +#deprecated "Use ActionV2" +op Action(): T; +``` + + +### `@discriminator` {#@discriminator} + +Specify the property to be used to discriminate this type. + +```typespec +@discriminator(propertyName: valueof string) +``` + +#### Target + +`union Model | Union` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| propertyName | `valueof scalar string` | The property name to use for discrimination | + +#### Examples + +```typespec +@discriminator("kind") +union Pet{ cat: Cat, dog: Dog } + +model Cat {kind: "cat", meow: boolean} +model Dog {kind: "dog", bark: boolean} +``` + +```typespec +@discriminator("kind") +model Pet{ kind: string } + +model Cat extends Pet {kind: "cat", meow: boolean} +model Dog extends Pet {kind: "dog", bark: boolean} +``` + + +### `@doc` {#@doc} + +Attach a documentation string. + +```typespec +@doc(doc: valueof string, formatArgs?: {}) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| doc | `valueof scalar string` | Documentation string | +| formatArgs | `model {}` | Record with key value pair that can be interpolated in the doc. | + +#### Examples + +```typespec +@doc("Represent a Pet available in the PetStore") +model Pet {} +``` + + +### `@encode` {#@encode} + +Specify how to encode the target type. + +```typespec +@encode(encoding: string | EnumMember, encodedAs?: Scalar) +``` + +#### Target + +`union Scalar | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| encoding | `union string \| EnumMember` | Known name of an encoding. | +| encodedAs | `Scalar` | What target type is this being encoded as. Default to string. | + +#### Examples +##### offsetDateTime encoded with rfc7231 + + +```tsp +@encode("rfc7231") +scalar myDateTime extends offsetDateTime; +``` + +##### utcDateTime encoded with unixTimestamp + + +```tsp +@encode("unixTimestamp", int32) +scalar myDateTime extends unixTimestamp; +``` + + +### `@error` {#@error} + +Specify that this model is an error type. Operations return error types when the operation has failed. + +```typespec +@error +``` + +#### Target + +`Model` + +#### Parameters +None + +#### Examples + +```typespec +@error +model PetStoreError { +code: string; +message: string; +} +``` + + +### `@errorsDoc` {#@errorsDoc} + +Attach a documentation string to describe the error return types of an operation. +If an operation returns a union of success and errors it only describe the errors. See `@errorsDoc` for success documentation. + +```typespec +@errorsDoc(doc: valueof string) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| doc | `valueof scalar string` | Documentation string | + +#### Examples + +```typespec +@errorsDoc("Returns doc") +op get(): Pet | NotFound; +``` + + +### `@format` {#@format} + +Specify a known data format hint for this string type. For example `uuid`, `uri`, etc. +This differs from the `@pattern` decorator which is meant to specify a regular expression while `@format` accepts a known format name. +The format names are open ended and are left to emitter to interpret. + +```typespec +@format(format: valueof string) +``` + +#### Target + +`union string | bytes | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| format | `valueof scalar string` | format name. | + +#### Examples + +```typespec +@format("uuid") +scalar uuid extends string; +``` + + +### `@friendlyName` {#@friendlyName} + +Specifies how a templated type should name their instances. + +```typespec +@friendlyName(name: valueof string, formatArgs?: unknown) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| name | `valueof scalar string` | name the template instance should take | +| formatArgs | `(intrinsic) unknown` | Model with key value used to interpolate the name | + +#### Examples + +```typespec +@friendlyName("{name}List", T) +model List { +value: T[]; +nextLink: string; +} +``` + + +### `@inspectType` {#@inspectType} + +A debugging decorator used to inspect a type. + +```typespec +@inspectType(text: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| text | `valueof scalar string` | Custom text to log | + + + +### `@inspectTypeName` {#@inspectTypeName} + +A debugging decorator used to inspect a type name. + +```typespec +@inspectTypeName(text: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| text | `valueof scalar string` | Custom text to log | + + + +### `@key` {#@key} + +Mark a model property as the key to identify instances of that type + +```typespec +@key(altName?: valueof string) +``` + +#### Target + +`ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| altName | `valueof scalar string` | Name of the property. If not specified, the decorated property name is used. | + +#### Examples + +```typespec +model Pet { +@key id: string; +} +``` + + +### `@knownValues` {#@knownValues} + +Provide a set of known values to a string type. + +```typespec +@knownValues(values: Enum) +``` + +#### Target + +`union string | numeric | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| values | `Enum` | Known values enum. | + +#### Examples + +```typespec +@knownValues(KnownErrorCode) +scalar ErrorCode extends string; + +enum KnownErrorCode { +NotFound, +Invalid, +} +``` + + +### `@list` {#@list} + +Mark this operation as a `list` operation for resource types. + +```typespec +@list(listedType?: Model) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| listedType | `Model` | Optional type of the items in the list. | + + + +### `@maxItems` {#@maxItems} + +Specify the maximum number of items this array should have. + +```typespec +@maxItems(value: valueof integer) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar integer` | Maximum number | + +#### Examples + +```typespec +@maxItems(5) +model Endpoints is string[]; +``` + + +### `@maxLength` {#@maxLength} + +Specify the maximum length this string type should be. + +```typespec +@maxLength(value: valueof integer) +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar integer` | Maximum length | + +#### Examples + +```typespec +@maxLength(20) +scalar Username extends string; +``` + + +### `@maxValue` {#@maxValue} + +Specify the maximum value this numeric type should be. + +```typespec +@maxValue(value: valueof numeric) +``` + +#### Target + +`union numeric | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar numeric` | Maximum value | + +#### Examples + +```typespec +@maxValue(200) +scalar Age is int32; +``` + + +### `@maxValueExclusive` {#@maxValueExclusive} + +Specify the maximum value this numeric type should be, exclusive of the given +value. + +```typespec +@maxValueExclusive(value: valueof numeric) +``` + +#### Target + +`union numeric | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar numeric` | Maximum value | + +#### Examples + +```typespec +@maxValueExclusive(50) +scalar distance is float64; +``` + + +### `@minItems` {#@minItems} + +Specify the minimum number of items this array should have. + +```typespec +@minItems(value: valueof integer) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar integer` | Minimum number | + +#### Examples + +```typespec +@minItems(1) +model Endpoints is string[]; +``` + + +### `@minLength` {#@minLength} + +Specify the minimum length this string type should be. + +```typespec +@minLength(value: valueof integer) +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar integer` | Minimum length | + +#### Examples + +```typespec +@minLength(2) +scalar Username extends string; +``` + + +### `@minValue` {#@minValue} + +Specify the minimum value this numeric type should be. + +```typespec +@minValue(value: valueof numeric) +``` + +#### Target + +`union numeric | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar numeric` | Minimum value | + +#### Examples + +```typespec +@minValue(18) +scalar Age is int32; +``` + + +### `@minValueExclusive` {#@minValueExclusive} + +Specify the minimum value this numeric type should be, exclusive of the given +value. + +```typespec +@minValueExclusive(value: valueof numeric) +``` + +#### Target + +`union numeric | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar numeric` | Minimum value | + +#### Examples + +```typespec +@minValueExclusive(0) +scalar distance is float64; +``` + + +### `@overload` {#@overload} + +Specify this operation is an overload of the given operation. + +```typespec +@overload(overloadbase: Operation) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| overloadbase | `Operation` | Base operation that should be a union of all overloads | + +#### Examples + +```typespec +op upload(data: string | bytes, @header contentType: "text/plain" | "application/octet-stream"): void; +@overload(upload) +op uploadString(data: string, @header contentType: "text/plain" ): void; +@overload(upload) +op uploadBytes(data: bytes, @header contentType: "application/octet-stream"): void; +``` + + +### `@parameterVisibility` {#@parameterVisibility} + +Sets which visibilities apply to parameters for the given operation. + +```typespec +@parameterVisibility(...visibilities: valueof string[]) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| visibilities | `valueof model string[]` | List of visibility strings which apply to this operation. | + + + +### `@pattern` {#@pattern} + +Specify the the pattern this string should respect using simple regular expression syntax. +The following syntax is allowed: alternations (`|`), quantifiers (`?`, `*`, `+`, and `{ }`), wildcard (`.`), and grouping parentheses. +Advanced features like look-around, capture groups, and references are not supported. + +```typespec +@pattern(pattern: valueof string) +``` + +#### Target + +`union string | bytes | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| pattern | `valueof scalar string` | Regular expression. | + +#### Examples + +```typespec +@pattern("[a-z]+") +scalar LowerAlpha extends string; +``` + + +### `@projectedName` {#@projectedName} + +Provide an alternative name for this type. + +```typespec +@projectedName(targetName: valueof string, projectedName: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| targetName | `valueof scalar string` | Projection target | +| projectedName | `valueof scalar string` | Alternative name | + +#### Examples + +```typespec +model Certificate { +@projectedName("json", "exp") +expireAt: int32; +} +``` + + +### `@returnsDoc` {#@returnsDoc} + +Attach a documentation string to describe the successful return types of an operation. +If an operation returns a union of success and errors it only describe the success. See `@errorsDoc` for error documentation. + +```typespec +@returnsDoc(doc: valueof string) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| doc | `valueof scalar string` | Documentation string | + +#### Examples + +```typespec +@returnsDoc("Returns doc") +op get(): Pet | NotFound; +``` + + +### `@returnTypeVisibility` {#@returnTypeVisibility} + +Sets which visibilities apply to the return type for the given operation. + +```typespec +@returnTypeVisibility(...visibilities: valueof string[]) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| visibilities | `valueof model string[]` | List of visibility strings which apply to this operation. | + + + +### `@secret` {#@secret} + +Mark this string as a secret value that should be treated carefully to avoid exposure + +```typespec +@secret +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters +None + +#### Examples + +```typespec +@secret +scalar Password is string; +``` + + +### `@service` {#@service} + +Mark this namespace as describing a service and configure service properties. + +```typespec +@service(options?: ServiceOptions) +``` + +#### Target + +`Namespace` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| options | `model ServiceOptions` | Optional configuration for the service. | + +#### Examples + +```typespec +@service +namespace PetStore; +``` + +##### Setting service title + +```typespec +@service({title: "Pet store"}) +namespace PetStore; +``` + +##### Setting service version + +```typespec +@service({version: "1.0"}) +namespace PetStore; +``` + + +### `@summary` {#@summary} + +Typically a short, single-line description. + +```typespec +@summary(summary: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| summary | `valueof scalar string` | Summary string. | + +#### Examples + +```typespec +@summary("This is a pet") +model Pet {} +``` + + +### `@tag` {#@tag} + +Attaches a tag to an operation, interface, or namespace. Multiple `@tag` decorators can be specified to attach multiple tags to a TypeSpec element. + +```typespec +@tag(tag: valueof string) +``` + +#### Target + +`union Namespace | Interface | Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| tag | `valueof scalar string` | Tag value | + + + +### `@visibility` {#@visibility} + +Indicates that a property is only considered to be present or applicable ("visible") with +the in the given named contexts ("visibilities"). When a property has no visibilities applied +to it, it is implicitly visible always. + +As far as the TypeSpec core library is concerned, visibilities are open-ended and can be arbitrary +strings, but the following visibilities are well-known to standard libraries and should be used +with standard emitters that interpret them as follows: + +- "read": output of any operation. +- "create": input to operations that create an entity.. +- "query": input to operations that read data. +- "update": input to operations that update data. +- "delete": input to operations that delete data. + +See also: [Automatic visibility](https://microsoft.github.io/typespec/standard-library/http/operations#automatic-visibility) + +```typespec +@visibility(...visibilities: valueof string[]) +``` + +#### Target + +`ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| visibilities | `valueof model string[]` | List of visibilities which apply to this property. | + +#### Examples + +```typespec +model Dog { +// the service will generate an ID, so you don't need to send it. +@visibility("read") id: int32; +// the service will store this secret name, but won't ever return it +@visibility("create", "update") secretName: string; +// the regular name is always present +name: string; +} +``` + + +### `@withDefaultKeyVisibility` {#@withDefaultKeyVisibility} + +Set the visibility of key properties in a model if not already set. + +```typespec +@withDefaultKeyVisibility(visibility: valueof string) +``` + +#### Target + +`Model` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| visibility | `valueof scalar string` | The desired default visibility value. If a key property already has a `visibility` decorator then the default visibility is not applied. | + + + +### `@withOptionalProperties` {#@withOptionalProperties} + +Returns the model with required properties removed. + +```typespec +@withOptionalProperties +``` + +#### Target + +`Model` + +#### Parameters +None + + + +### `@withoutDefaultValues` {#@withoutDefaultValues} + +Returns the model with any default values removed. + +```typespec +@withoutDefaultValues +``` + +#### Target + +`Model` + +#### Parameters +None + + + +### `@withoutOmittedProperties` {#@withoutOmittedProperties} + +Returns the model with the given properties omitted. + +```typespec +@withoutOmittedProperties(omit: string | Union) +``` + +#### Target + +`Model` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| omit | `union string \| Union` | List of properties to omit | + + + +### `@withUpdateableProperties` {#@withUpdateableProperties} + +Returns the model with non-updateable properties removed. + +```typespec +@withUpdateableProperties +``` + +#### Target + +`Model` + +#### Parameters +None + + + +### `@withVisibility` {#@withVisibility} + +Removes properties that are not considered to be present or applicable +("visible") in the given named contexts ("visibilities"). Can be used +together with spread to effectively spread only visible properties into +a new model. + +See also: [Automatic visibility](https://microsoft.github.io/typespec/standard-library/http/operations#automatic-visibility) + +When using an emitter that applies visibility automatically, it is generally +not necessary to use this decorator. + +```typespec +@withVisibility(...visibilities: valueof string[]) +``` + +#### Target + +`Model` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| visibilities | `valueof model string[]` | List of visibilities which apply to this property. | + +#### Examples + +```typespec +model Dog { +@visibility("read") id: int32; +@visibility("create", "update") secretName: string; +name: string; +} + +// The spread operator will copy all the properties of Dog into DogRead, +// and @withVisibility will then remove those that are not visible with +// create or update visibility. +// +// In this case, the id property is removed, and the name and secretName +// properties are kept. +@withVisibility("create", "update") +model DogCreateOrUpdate { +...Dog; +} + +// In this case the id and name properties are kept and the secretName property +// is removed. +@withVisibility("read") +model DogRead { +...Dog; +} +``` + diff --git a/packages/website-astro/src/content/docs/current/standard-library/discriminated-types.md b/packages/website-astro/src/content/docs/current/standard-library/discriminated-types.md new file mode 100644 index 0000000000..3c616c844f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/discriminated-types.md @@ -0,0 +1,104 @@ +--- +title: Discriminated types +--- + +TypeSpec can express unions and inheritance. However, when sending types over the wire many languages need a way to discriminate between the various union variants or models in an inheritance hierarchy. + +TypeSpec provide the [`@discriminator` decorator](./built-in-decorators#@discriminator) to be able to help with this pattern. + +### Using polymorphism + +#### `string` discriminator + +```typespec +@discriminator("kind") +model Pet { + name: string; + weight?: float32; +} +model Cat extends Pet { + kind: "cat"; + meow: int32; +} +model Dog extends Pet { + kind: "dog"; + bark: string; +} +``` + +#### `enum` discriminator + +```typespec +enum PetKind { + cat, + dog, +} + +@discriminator("kind") +model Pet { + kind: PetKind; + name: string; + weight?: float32; +} +model Cat extends Pet { + kind: PetKind.cat; + meow: int32; +} +model Dog extends Pet { + kind: PetKind.dog; + bark: string; +} +``` + +#### Nested discriminator + +```tsp +@discriminator("kind") +model Pet { + kind: string; + name: string; + weight?: float32; +} + +@discriminator("breed") +model Cat extends Pet { + kind: "cat"; + breed: string; + meow: int32; +} + +@discriminator("breed") +model Siamese extends Cat { + breed: "siamese"; +} + +@discriminator("breed") +model Bengal extends Cat { + breed: "bengal"; +} + +model Dog extends Pet { + kind: "dog"; + bark: string; +} +``` + +### Using unions + +```typespec +@discriminator("kind") +union Pet { + cat: Cat, + dog: Dog, +} + +model Cat { + kind: "cat"; + meow: int32; +} + +model Dog { + kind: "dog"; + bark: string; +} +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/authentication.md b/packages/website-astro/src/content/docs/current/standard-library/http/authentication.md new file mode 100644 index 0000000000..70390f5561 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/authentication.md @@ -0,0 +1,113 @@ +--- +title: Authentication +--- + +# Configure Http Authentication + +Notes: + +- Authentication right now can ONLY be configured at the service level. + +## Configure + +Authentication can be configured using the `@useAuth` decorator on the service namespace. The decorator accept a few options: + +- A security scheme (see options [here](https://github.com/microsoft/typespec/blob/main/packages/http/lib/auth.tsp)). This means this is the security scheme to use to authenticate this service. + +```typespec +@useAuth(Auth1) +``` + +- A tuple of security scheme. This means ALL the different security schemes of the tuple MUST be used together to authenticate this service. + +```typespec +// Use BOTH Auth1 or Auth2 +@useAuth([Auth1, Auth2]) +``` + +- A union of security scheme. This means EITHER of the security schemes can be used to authenticate this service + +```typespec +// Use EITHER Auth1 or Auth2 +@useAuth(Auth1 | Auth2) +``` + +- A union of tuple security scheme. This means EITHER of the security groups schemes can be used to authenticate this service + +```typespec +// Use EITHER (Auth1 AND Auth2) OR Auth3 +@useAuth([Auth1, Auth2] | Auth3) +``` + +## Available security schemes + +Models can be found in https://github.com/microsoft/typespec/blob/main/packages/http/lib/auth.tsp + +### `BasicAuth` + +Basic authentication is a simple authentication scheme built into the HTTP protocol. +The client sends HTTP requests with the Authorization header that contains the word Basic word followed by a space and a base64-encoded string username:password. +For example, to authorize as demo / p@55w0rd the client would send + +``` + Authorization: Basic ZGVtbzpwQDU1dzByZA== +``` + +```typespec +@useAuth(BasicAuth) +``` + +### `BearerAuth` + +Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. +The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. +The client must send this token in the Authorization header when making requests to protected resources: + +``` + Authorization: Bearer +``` + +```typespec +@useAuth(BearerAuth) +``` + +### `ApiKeyAuth` + +An API key is a token that a client provides when making API calls. The key can be sent in the query string: + +``` +GET /something?api_key=abcdef12345 +``` + +```typespec +@useAuth(ApiKeyAuth) +``` + +or as a request header + +``` +GET /something HTTP/1.1 +X-API-Key: abcdef12345 +``` + +```typespec +@useAuth(ApiKeyAuth) +``` + +or as a cookie + +``` +GET /something HTTP/1.1 +Cookie: X-API-KEY=abcdef12345 +``` + +```typespec +@useAuth(ApiKeyAuth) +``` + +### `OAuth2Auth` + +OAuth 2.0 is an authorization protocol that gives an API client limited access to user data on a web server. +OAuth relies on authentication scenarios called flows, which allow the resource owner (user) to share the protected content from the resource server without sharing their credentials. +For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner. +For more information about OAuth 2.0, see oauth.net and RFC 6749. diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/cheat-sheet.md b/packages/website-astro/src/content/docs/current/standard-library/http/cheat-sheet.md new file mode 100644 index 0000000000..cfad5acd06 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/cheat-sheet.md @@ -0,0 +1,52 @@ +--- +title: Cheat sheet +--- + +## Verb + +| Feature | Example | +| ---------------- | --------------------------- | +| Get operation | `@get op read(): void` | +| Put operation | `@put op set(): void` | +| Post operation | `@post op add(): void` | +| Patch operation | `@patch op patch(): void` | +| Delete operation | `@delete op delete(): void` | +| Head operation | `@head op read(): void` | + +## Routing + +| Feature | Example | +| ---------------------------------- | ------------------------------------------------------------------------------------------ | +| Fixed route | `@route("/pets") op list(): Pet[]` | +| Route with path parameter | `@route("/pets/{petId}") op getPet(petId: string): Pet` | +| Route with multiple path parameter | `@route("/stores/{storeId}/pets/{petId}/") op getPet(storeId: string, petId: string): Pet` | + +## Data types + +| Feature | Example | +| ----------------------- | ------------------------------------------- | +| Request header | `op read(@header traceparent: string): Pet` | +| Response header | `op read(): {@header eTag: string, ...Pet}` | +| Query parameter | `op list(@query filter: string): Pet[]` | +| Explicit body parameter | `op add(@body pet: Pet): void` | +| Implicit body parameter | `op add(...Pet): void` | +| Status code | `op read(): {@statusCode _: 200, ...Pet}` | + +## Server + +| Feature | Example | +| ------------- | ------------------------------------------------------------------------------------- | +| Single | `@server("https://example.com", "Example 1 endpoint")` | +| Multiple | `@server("https://example1.com", "E1") @server("https://example2.com", "E2")` | +| Parameterized | `@server("https://{region}.example.com", "Region scoped endpoint", {region: string})` | + +## Authentication + +_Details: [Authentication](./authentication.md)_ + +| Feature | Example | +| --------------- | ------------------------------------------- | +| Basic auth | `@useAuth(BasicAuth)` | +| Bearer auth | `@useAuth(BearerAuth)` | +| Api key auth | `@useAuth(ApiKeyAuth<"header", "Api-Key">)` | +| OAuth2 key auth | `@useAuth(OAuth2Flow<[MyScope]>)` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/content-types.md b/packages/website-astro/src/content/docs/current/standard-library/http/content-types.md new file mode 100644 index 0000000000..f2420d1fd4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/content-types.md @@ -0,0 +1,99 @@ +--- +title: Content types +--- + +## Default behavior + +Content type is assumed to be `application/json` by default regardless of the type of the request or response body. + +**Examples:** + +```typespec +op download(): bytes; // Returns a json string with the bytes serialized as a base64. +op getContent(): string; // Returns a json string +op getPet(): { + // Json object with a name property. + name: string; +}; +``` + +## Specify content type + +The content type for an operation can be specified by including a header parameter named `contentType`. + +#### Request content type + +```typespec +op uploadImage(@header contentType: "image/png", @body image: bytes): void; +``` + +#### Response content type: + +```typespec +op downloadImage(): { + @header contentType: "image/png"; + @body image: bytes; +}; +``` + +#### Multiple content types + +If there is multiples content types for the same body, they can be specified using a union of string. + +```typespec +op uploadImage(@header contentType: "image/png" | "image/jpeg", @body image: bytes): void; +``` + +## Content type negotiation + +There could be cases where you might the same endpoint to return different content depending on the content type requested. This can be achieved in 2 ways: + +- using shared routes where different content response is represented as a different operation that share the same endpoint +- using overloads where each different content response is an overload. + +For example assuming there is an api that lets you download the avatar as a `png` or `jpeg` which is decided by what `Accept` header is sent. + +### Option 1: Using shared route + +```tsp +model PngImage { + @header contentType: "image/png"; + @body image: bytes; +} + +model JpegImage { + @header contentType: "image/jpeg"; + @body image: bytes; +} + +@route("/avatar") +@sharedRoute +op getAvatarAsPng(@header accept: "image/png"): PngImage; + +@route("/avatar") +@sharedRoute +op getAvatarAsJpeg(@header accept: "image/jpeg"): JpegImage; +``` + +### Option 2: Using overload + +```tsp +model PngImage { + @header contentType: "image/png"; + @body image: bytes; +} + +model JpegImage { + @header contentType: "image/jpeg"; + @body image: bytes; +} + +@route("/avatar") +op getAvatar(@header accept: "image/png" | "image/jpeg"): PngImage | JpegImage; + +@overload(getAvatar) +op getAvatarAsPng(@header accept: "image/png"): PngImage; + +@overload(getAvatar) +op getAvatarAsJpeg(@header accept: "image/jpeg"): JpegImage; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/encoding.md b/packages/website-astro/src/content/docs/current/standard-library/http/encoding.md new file mode 100644 index 0000000000..5089b05dd1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/encoding.md @@ -0,0 +1,136 @@ +--- +title: Encoding of types +--- + +This document describe how the http library interpret TypeSpec built-in types and how to configure + +## `bytes` + +**Default behavior:** + +- `bytes` are serialized as `base64` when used inside a model serialized as JSON +- In request or response body it represent a binary payload. + +:::note +This behavior is only a specification and MUST be respected by the emitter. The http library DOES NOT automatically apply the `@encode("base64")` when used inside a JSON model. +::: + +Use `@encode` to configure + +```tsp +model Pet { + icon: bytes; // Serialize as base64 + @encode(BytesKnownEncoding.base64url) // Serialize as base64url + other: bytes; +} + +op read(): Pet; + +op download(): bytes; // Return application/octet-stream +op upload(@body data: bytes): void; // Accept application/octet-stream +``` + +## `utcDatetime` and `offsetDateTime` + +**Default behavior:** + +- Encoded as `rfc7231` when used in a header +- Encoded as `rfc3339` otherwise. + +:::note +This behavior is only a specification and MUST be respected by the emitter. The http library DOES NOT automatically apply the `@encode("rfc7231")` on `utcDatetime` and `offsetDateTime` when used in a header. +::: + +Use `@encode` to configure. + + + + + + + +
TypeSpecExample payload
+ +```tsp +model User { + // Headers + @header("Created-At") createdAtHeader: utcDateTime; + + @header("Created-At-Rfc3339") + @encode(DateTimeKnownEncoding.rfc3339) + createdAtHeaderRfc3339Encoding: utcDateTime; + + // In Json payload + createdAt: utcDateTime; // rfc3339 + + updatedAt: offsetDateTime; // rfc3339 + + @encode(DateTimeKnownEncoding.rfc7231) + createdAtPretty: utcDateTime; // rfc7231 + + @encode(DateTimeKnownEncoding.rfc7231) + updatedAtPretty: offsetDateTime; // rfc7231 + + @encode(DateTimeKnownEncoding.unixTimestamp, int32) + createdAtUnix: utcDateTime; // unixTime +} +``` + + + +```yaml +Created-At: Wed, 12 Oct 2022 07:20:50 GMT +Created-At-Rfc3339: 2022-10-12T07:20:50.52Z +``` + +```json +{ + "createdAt": "2022-10-12T07:20:50.52Z", + "updatedAt": "2022-10-25T07:20:50.52+07:00", + "createdAtPretty": "Wed, 12 Oct 2022 07:20:50 GMT", + "updatedAtPretty": "Tue, 25 Oct 2022 00:20:50 GMT", + "createdAtUnix": 1665559250520 +} +``` + +
+ +## `duration` + +**Default behavior:** + +- Encoded as `ISO8601` + +Use `@encode` to configure. + + + + + + + +
TypeSpecExample payload
+ +```tsp +model User { + runtime: duration; // ISO8601 + + @encode(DurationKnownEncoding.seconds, int32) + runtimeInSecondsInt: duration; // in seconds as an int32 + + @encode(DurationKnownEncoding.seconds, float32) + runtimeInSecondsFloat: duration; // in seconds as a float32 +} +``` + + + +```json +{ + "runtime": "PT5M5S", + "runtimeInSecondsInt": "305", + "runtimeInSecondsFloat": "305.0" +} +``` + +
diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/operations.md b/packages/website-astro/src/content/docs/current/standard-library/http/operations.md new file mode 100644 index 0000000000..3ca6eded77 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/operations.md @@ -0,0 +1,415 @@ +--- +title: Operations +--- + +# Http Operations + +## Operation verb + +**Default behavior:** + +- If `@post` operation has a request body +- `@get` otherwise + +**Configure:** + +You can use one of the [verb decorators](./reference/decorators.md): `@get`, `@put`, etc. + +## Route + +An operation route can be specified using the `@route` decorator. + +```typespec +@route("/pets") op list(): Pet[]; +``` + +Route path parameters are declared using `{}`. Providing `@path` on the model property with the matching name is optional. + +```typespec +@route("/pets/{petId}") op get(petId: string): Pet; +// or explicit @path +@route("/pets/{petId}") op get(@path petId: string): Pet; +``` + +Route can be specified on a parent namespace or interface. In that case all the operations, interfaces and namespaces underneath will be prefixed with it. + +```typespec +@route("/store") +namespace PetStore { + op hello(): void; // `/store` + @route("ping") op ping(): void; // `/store/ping` + + @route("/pets") + interface Pets { + list(): Pet[]; // `/store/pets` + @route("{petId}") read(petId: string): Pet; // `/store/pets/{petId}` + } +} +``` + +## Path and query parameters + +Model properties and parameters which should be passed as path and query parameters use the `@path` and `@query` parameters respectively. Let's modify our list operation to support pagination, and add a read operation to our Pets resource: + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): Pet[]; + op read(@path petId: int32): Pet; +} +``` + +Path parameters are appended to the URL unless a substitution with that parameter name exists on the resource path. For example, we might define a sub-resource using the following TypeSpec. Note how the path parameter for our sub-resource's list operation corresponds to the substitution in the URL. + +```typespec +@route("/pets/{petId}/toys") +namespace PetToys { + op list(@path petId: int32): Toy[]; +} +``` + +## Request & response bodies + +Request and response bodies can be declared explicitly using the `@body` decorator. Let's add an endpoint to create a pet. Let's also use this decorator for the responses, although this doesn't change anything about the API. + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): { + @body pets: Pet[]; + }; + op read(@path petId: int32): { + @body pet: Pet; + }; + @post + op create(@body pet: Pet): {}; +} +``` + +Note that in the absence of explicit `@body`: + +1. The set of parameters that are not marked @header, @query, or @path form the request body. +2. The set of properties of the return model that are not marked @header or @statusCode form the response body. +3. If the return type is not a model, then it defines the response body. + +This is how we were able to return Pet and Pet[] bodies without using @body for list and read. We can actually write +create in the same terse style by spreading the Pet object into the parameter list like this: + +See also [metadata](./operations.md#metadata) for more advanced details. + +```typespec +@route("/pets") +namespace Pets { + @post + op create(...Pet): {}; +} +``` + +## Headers + +Model properties and parameters that should be passed in a header use the `@header` decorator. The decorator takes the header name as a parameter. If a header name is not provided, it is inferred from the property or parameter name. Let's add `etag` support to our pet store's read operation. + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): { + @body pets: Pet[]; + }; + op read(@path petId: int32, @header ifMatch?: string): { + @header eTag: string; + @body pet: Pet; + }; + @post + op create(@body pet: Pet): {}; +} +``` + +## Status codes + +**Default behavior:** + +- `4xx,5xx` if response is marked with `@error` +- `200` otherwise + +**Configure:** + +Use the `@header` decorator on a property named `statusCode` to declare a status code for a response. Generally, setting this to just `int32` isn't particularly useful. Instead, use number literal types to create a discriminated union of response types. Let's add status codes to our responses, and add a 404 response to our read endpoint. + +```typespec +@route("/pets") +namespace Pets { + @error + model Error { + code: string; + } + + op list(@query skip: int32, @query top: int32): { + @body pets: Pet[]; // statusCode: 200 Implicit + }; + op read(@path petId: int32, @header ifMatch?: string): { + @statusCode statusCode: 200; + @header eTag: string; + @body pet: Pet; + } | { + @statusCode statusCode: 404; + }; + op create(@body pet: Pet): { + @statusCode statusCode: 204; + } | Error; //statusCode: 4xx,5xx as Error use `@error` decorator +} +``` + +## Content type + +[See content types docs](./content-types.md) + +### Default behavior + +Depending on the body of the operation http library will assume different content types: + +- `bytes`: `application/octet-stream` +- `string`: `text/plain` +- an `object` or anything else: `application/json` + +**Examples:** + +```typespec +op download(): bytes; // response content type is application/octet-stream +op upload(@body file: bytes): void; // request content type is application/octet-stream +op getContent(): string; // response content type is text/plain +op getPet(): { + // response content type is application/json + name: string; +}; +``` + +### Specify content type + +The content type for an operation can be specified by including a header parameter named `contentType`. + +#### Request content type + +```typespec +op uploadImage(@header contentType: "image/png", @body image: bytes): void; +``` + +#### Response content type: + +```typespec +op downloadImage(): { + @header contentType: "image/png"; + @body image: bytes; +}; +``` + +#### Multiple content types + +```typespec +op uploadImage(@header contentType: "image/png" | "image/jpeg", @body image: bytes): void; +``` + +## Built-in response shapes + +Since status codes are so common for REST APIs, TypeSpec comes with some built-in types for common status codes so you don't need to declare status codes so frequently. + +There is also a `Body` type, which can be used as a shorthand for { @body body: T } when an explicit body is required. + +Lets update our sample one last time to use these built-in types: + +```typespec +model ETag { + @header eTag: string; +} +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): OkResponse & Body; + op read(@path petId: int32, @header ifMatch?: string): (OkResponse & + Body & + ETag) | NotFoundResponse; + @post + op create(...Pet): NoContentResponse; +} +``` + +Note that the default status code is 200 for non-empty bodies and 204 for empty bodies. Similarly, explicit `Body` is not required when T is known to be a model. So the following terser form is equivalent: + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): Pet[]; + op read(@path petId: int32, @header ifMatch?: string): (Pet & ETag) | NotFoundResponse; + @post + op create(...Pet): {}; +} +``` + +Finally, another common style is to make helper response types that are +shared across a larger service definition. In this style, you can be +entirely explicit while also keeping operation definitions concise. + +For example, we could write : + +```typespec +model ListResponse { + ...OkResponse; + ...Body; +} + +model ReadSuccessResponse { + ...OkResponse; + ...ETag; + ...Body; +} + +alias ReadResponse = ReadSuccessResponse | NotFoundResponse; + +model CreateResponse { + ...NoContentResponse; +} + +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): ListResponse; + op read(@path petId: int32, @header ifMatch?: string): ReadResponse; + @post + op create(...Pet): CreateResponse; +} +``` + +## Automatic visibility + +The `@typespec/rest` library understands the following well-known [visibilities](../../standard-library/built-in-decorators.md#visibility-decorators) and provides functionality for emitters to apply them based on whether on request vs. response and HTTP method usage as detailed in the table below. + +See [handling visibility and metadata](../../extending-typespec/emitter-metadata-handling.md) for how to incorporate this into + +| Name | Visible in | +| -------- | -------------------- | +| "read" | Any response | +| "query" | GET or HEAD request | +| "create" | POST or PUT request | +| "update" | PATCH or PUT request | +| "delete" | DELETE request | + +This allows a single logical TypeSpec model to be used as in the following example: + +```typespec +model User { + name: string; + @visibility("read") id: string; + @visibility("create") password: string; +} + +@route("/users") +interface Users { + @post create(@path id: string, ...User): User; + @get get(@path id: string): User; +} +``` + +There is a single logical user entity represented by the single TypeSpec type `User`, but the HTTP payload for this entity varies based on context. When returned in a response, the `id` property is included, but when sent in a request, it is not. Similarly, the `password` property is only included in create requests, but not present in responses. + +The OpenAPI v3 emitter will apply these visibilities automatically, without explicit use of `@withVisibility`, and it will generate separate schemas suffixed by visibility when necessary. `@visibility("read")` can be expressed in OpenAPI without generating additional schema by specifying `readOnly: true` and the OpenAPI v3 emitter will leverage this a an optimization, but other visibilities will generate additional schemas. For example, `@visibility("create")` applied to a model property of a type named Widget will generate a `WidgetCreate` schema. + +Another emitter such as one generating client code can see and preserve a single logical type and deal with these HTTP payload differences by means other than type proliferation. + +Modeling with logical entities rather than HTTP-specific shapes also keeps the TypeSpec spec decoupled from HTTP and REST and can allow the same spec to be used with multiple protocols. + +## Metadata + +The properties that designate content for the HTTP envelope (`@header`, `@path`, `@query`, `@statusCode`) rather than the content in an HTTP payload are often called "metadata". + +Metadata is determined to be applicable or inapplicable based on the context that it is used: + +| Context | Applicability | +| ------------- | ------------------- | +| `@query` | request only | +| `@path` | request only | +| `@statusCode` | response only | +| `@header` | request or response | + +Additionally metadata that appears in an array element type always inapplicable. + +When metadata is deemed "inapplicable", for example, if a `@path` property is seen in a response, it becomes part of the payload instead unless the [@includeInapplicableMetadataInPayload](./reference/decorators.md#@TypeSpec.Rest.includeinapplicablemetadatainpayload) decorator is used and given a value of `false`. + +The handling of metadata applicability furthers the goal of keeping a single logical model in TypeSpec. For example, this defines a logical `User` entity that has a name, ID and password, but further annotates that the ID is sent in the HTTP path and the HTTP body in responses. Also, using automatically visibility as before, we further indicate that the password is only present in create requests. + +```typespec +model User { + name: string; + @path id: string; + @visibility("create") password: string; +} +``` + +Then, we can write operations in terms of the logical entity: + +```typespec +@route("/users") +interface Users { + @post create(...User): User; +} +``` + +Abstractly, this expresses that a create operation that takes and returns a user. But concretely, at the HTTP protocol level, a create request and response look like this: + +``` +POST /Users/TypeSpecFan42 HTTP/1.1 +Content-Type: application/json +{ + "name": "TypeSpec Fan", + "password": "Y0uW1llN3v3rGu3ss!" +} + +HTTP/1.1 200 OK +Content-Type: application/json +{ + name: "TypeSpec Fan", + id: "TypeSpecFan42 +} +``` + +### Visibility vs. Metadata applicability + +Metadata properties are filtered based on visibility as [described above](#automatic-visibility). This is done independently before applicability is considered. If a a metadata property is not visible then it is neither part of the envelope nor the HTTP payload, irrespective of its applicability. + +### Nested metadata + +Metadata properties are not required to be top-level. They can also be nested deeper in a parameter or response model type. For example: + +```typespec +model Thing { + headers: { + @header example: string; + }; + name: string; +} +``` + +Note that nesting in this sense does not require the use of anonymous models. This is equivalent: + +```typespec +model Thing { + headers: Headers; + name: string; +} +model Headers { + @header example: string; +} +``` + +In the event that this nesting introduces duplication, then the least nested property with a given name is preferred and the duplicate metadata properties are ignored. + +```typespec +model Thing { + headers: { + @header example: string; // preferred + more: { + @header example: string; // ignored + }; + }; +} +``` + +## Emitter resources + +See [Handling metadata and visibility in emitters for REST API](../../extending-typespec/emitter-metadata-handling.md) for information on how to handle metadata applicability and automatic visibility in a custom emitter. diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/data-types.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/data-types.md new file mode 100644 index 0000000000..d575a9d13d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/data-types.md @@ -0,0 +1,301 @@ +--- +title: "Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Data types + +## TypeSpec.Http + +### `AcceptedResponse` {#TypeSpec.Http.AcceptedResponse} + +The request has been accepted for processing, but processing has not yet completed. + +```typespec +model TypeSpec.Http.AcceptedResponse +``` + +### `ApiKeyAuth` {#TypeSpec.Http.ApiKeyAuth} + +An API key is a token that a client provides when making API calls. The key can be sent in the query string: + +``` +GET /something?api_key=abcdef12345 +``` + +or as a request header + +``` +GET /something HTTP/1.1 +X-API-Key: abcdef12345 +``` + +or as a cookie + +``` +GET /something HTTP/1.1 +Cookie: X-API-KEY=abcdef12345 +``` + +```typespec +model TypeSpec.Http.ApiKeyAuth +``` + +#### Template Parameters + +| Name | Description | +| --------- | --------------------------- | +| TLocation | The location of the API key | +| TName | The name of the API key | + +### `AuthorizationCodeFlow` {#TypeSpec.Http.AuthorizationCodeFlow} + +Authorization Code flow + +```typespec +model TypeSpec.Http.AuthorizationCodeFlow +``` + +### `BadRequestResponse` {#TypeSpec.Http.BadRequestResponse} + +The server could not understand the request due to invalid syntax. + +```typespec +model TypeSpec.Http.BadRequestResponse +``` + +### `BasicAuth` {#TypeSpec.Http.BasicAuth} + +Basic authentication is a simple authentication scheme built into the HTTP protocol. +The client sends HTTP requests with the Authorization header that contains the word Basic word followed by a space and a base64-encoded string username:password. +For example, to authorize as demo / `p@55w0rd` the client would send + +``` +Authorization: Basic ZGVtbzpwQDU1dzByZA== +``` + +```typespec +model TypeSpec.Http.BasicAuth +``` + +### `BearerAuth` {#TypeSpec.Http.BearerAuth} + +Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. +The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. +The client must send this token in the Authorization header when making requests to protected resources: + +``` +Authorization: Bearer +``` + +```typespec +model TypeSpec.Http.BearerAuth +``` + +### `Body` {#TypeSpec.Http.Body} + +Defines a model with a single property of the given type, marked with `@body`. + +This can be useful in situations where you cannot use a bare T as the body +and it is awkward to add a property. + +```typespec +model TypeSpec.Http.Body +``` + +#### Template Parameters + +| Name | Description | +| ---- | ---------------------------------------- | +| T | The type of the model's `body` property. | + +### `ClientCredentialsFlow` {#TypeSpec.Http.ClientCredentialsFlow} + +Client credentials flow + +```typespec +model TypeSpec.Http.ClientCredentialsFlow +``` + +### `ConflictResponse` {#TypeSpec.Http.ConflictResponse} + +The request conflicts with the current state of the server. + +```typespec +model TypeSpec.Http.ConflictResponse +``` + +### `CreatedResponse` {#TypeSpec.Http.CreatedResponse} + +The request has succeeded and a new resource has been created as a result. + +```typespec +model TypeSpec.Http.CreatedResponse +``` + +### `ForbiddenResponse` {#TypeSpec.Http.ForbiddenResponse} + +Access is forbidden. + +```typespec +model TypeSpec.Http.ForbiddenResponse +``` + +### `HeaderOptions` {#TypeSpec.Http.HeaderOptions} + +Header options. + +```typespec +model TypeSpec.Http.HeaderOptions +``` + +### `ImplicitFlow` {#TypeSpec.Http.ImplicitFlow} + +Implicit flow + +```typespec +model TypeSpec.Http.ImplicitFlow +``` + +### `LocationHeader` {#TypeSpec.Http.LocationHeader} + +The Location header contains the URL where the status of the long running operation can be checked. + +```typespec +model TypeSpec.Http.LocationHeader +``` + +### `MovedResponse` {#TypeSpec.Http.MovedResponse} + +The URL of the requested resource has been changed permanently. The new URL is given in the response. + +```typespec +model TypeSpec.Http.MovedResponse +``` + +### `NoContentResponse` {#TypeSpec.Http.NoContentResponse} + +There is no content to send for this request, but the headers may be useful. + +```typespec +model TypeSpec.Http.NoContentResponse +``` + +### `NotFoundResponse` {#TypeSpec.Http.NotFoundResponse} + +The server cannot find the requested resource. + +```typespec +model TypeSpec.Http.NotFoundResponse +``` + +### `NotModifiedResponse` {#TypeSpec.Http.NotModifiedResponse} + +The client has made a conditional request and the resource has not been modified. + +```typespec +model TypeSpec.Http.NotModifiedResponse +``` + +### `OAuth2Auth` {#TypeSpec.Http.OAuth2Auth} + +OAuth 2.0 is an authorization protocol that gives an API client limited access to user data on a web server. +OAuth relies on authentication scenarios called flows, which allow the resource owner (user) to share the protected content from the resource server without sharing their credentials. +For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner. +For more information about OAuth 2.0, see oauth.net and RFC 6749. + +```typespec +model TypeSpec.Http.OAuth2Auth +``` + +#### Template Parameters + +| Name | Description | +| ------ | ---------------------------------- | +| TFlows | The list of supported OAuth2 flows | + +### `OkResponse` {#TypeSpec.Http.OkResponse} + +The request has succeeded. + +```typespec +model TypeSpec.Http.OkResponse +``` + +### `PasswordFlow` {#TypeSpec.Http.PasswordFlow} + +Resource Owner Password flow + +```typespec +model TypeSpec.Http.PasswordFlow +``` + +### `PlainData` {#TypeSpec.Http.PlainData} + +Produces a new model with the same properties as T, but with `@query`, +`@header`, `@body`, and `@path` decorators removed from all properties. + +```typespec +model TypeSpec.Http.PlainData +``` + +#### Template Parameters + +| Name | Description | +| ---- | -------------------------------------- | +| T | The model to spread as the plain data. | + +### `QueryOptions` {#TypeSpec.Http.QueryOptions} + +Query parameter options. + +```typespec +model TypeSpec.Http.QueryOptions +``` + +### `Response` {#TypeSpec.Http.Response} + +Describes an HTTP response. + +```typespec +model TypeSpec.Http.Response +``` + +#### Template Parameters + +| Name | Description | +| ------ | -------------------------------- | +| Status | The status code of the response. | + +### `UnauthorizedResponse` {#TypeSpec.Http.UnauthorizedResponse} + +Access is unauthorized. + +```typespec +model TypeSpec.Http.UnauthorizedResponse +``` + +### `ApiKeyLocation` {#TypeSpec.Http.ApiKeyLocation} + +Describes the location of the API key + +```typespec +enum TypeSpec.Http.ApiKeyLocation +``` + +### `AuthType` {#TypeSpec.Http.AuthType} + +Authentication type + +```typespec +enum TypeSpec.Http.AuthType +``` + +### `OAuth2FlowType` {#TypeSpec.Http.OAuth2FlowType} + +Describes the OAuth2 flow type + +```typespec +enum TypeSpec.Http.OAuth2FlowType +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/decorators.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/decorators.md new file mode 100644 index 0000000000..71892dba54 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/decorators.md @@ -0,0 +1,427 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.Http + +### `@body` {#@TypeSpec.Http.body} + +Explicitly specify that this property is to be set as the body + +```typespec +@TypeSpec.Http.body +``` + +#### Target + +`ModelProperty` + +#### Parameters + +None + +#### Examples + +```typespec +op upload(@body image: bytes): void; +op download(): { + @body image: bytes; +}; +``` + +### `@delete` {#@TypeSpec.Http.delete} + +Specify the HTTP verb for the target operation to be `DELETE`. + +```typespec +@TypeSpec.Http.delete +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@delete op set(petId: string): void; +``` + +### `@get` {#@TypeSpec.Http.get} + +Specify the HTTP verb for the target operation to be `GET`. + +```typespec +@TypeSpec.Http.get +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@get op read(): string; +``` + +### `@head` {#@TypeSpec.Http.head} + +Specify the HTTP verb for the target operation to be `HEAD`. + +```typespec +@TypeSpec.Http.head +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@head op ping(petId: string): void; +``` + +### `@header` {#@TypeSpec.Http.header} + +Specify this property is to be sent or received as an HTTP header. + +```typespec +@TypeSpec.Http.header(headerNameOrOptions?: string | TypeSpec.Http.HeaderOptions) +``` + +#### Target + +`ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| headerNameOrOptions | `union string \| TypeSpec.Http.HeaderOptions` | Optional name of the header when sent over HTTP or header options.
By default the header name will be the property name converted from camelCase to kebab-case. (e.g. `contentType` -> `content-type`) | + +#### Examples + +```typespec +op read(@header accept: string): { + @header("ETag") eTag: string; +}; +op create( + @header({ + name: "X-Color", + format: "csv", + }) + colors: string[], +): void; +``` + +##### Implicit header name + +```typespec +op read(): { + @header contentType: string; +}; // headerName: content-type +op update(@header ifMatch: string): void; // headerName: if-match +``` + +### `@includeInapplicableMetadataInPayload` {#@TypeSpec.Http.includeInapplicableMetadataInPayload} + +Specify if inapplicable metadata should be included in the payload for the given entity. + +```typespec +@TypeSpec.Http.includeInapplicableMetadataInPayload(value: valueof boolean) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ----- | ------------------------ | --------------------------------------------------------------- | +| value | `valueof scalar boolean` | If true, inapplicable metadata will be included in the payload. | + +### `@patch` {#@TypeSpec.Http.patch} + +Specify the HTTP verb for the target operation to be `PATCH`. + +```typespec +@TypeSpec.Http.patch +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@patch op update(pet: Pet): void; +``` + +### `@path` {#@TypeSpec.Http.path} + +Explicitly specify that this property is to be interpolated as a path parameter. + +```typespec +@TypeSpec.Http.path(paramName?: valueof string) +``` + +#### Target + +`ModelProperty` + +#### Parameters + +| Name | Type | Description | +| --------- | ----------------------- | --------------------------------------------------- | +| paramName | `valueof scalar string` | Optional name of the parameter in the url template. | + +#### Examples + +```typespec +@route("/read/{explicit}/things/{implicit}") +op read(@path explicit: string, implicit: string): void; +``` + +### `@post` {#@TypeSpec.Http.post} + +Specify the HTTP verb for the target operation to be `POST`. + +```typespec +@TypeSpec.Http.post +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@post op create(pet: Pet): void; +``` + +### `@put` {#@TypeSpec.Http.put} + +Specify the HTTP verb for the target operation to be `PUT`. + +```typespec +@TypeSpec.Http.put +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@put op set(pet: Pet): void; +``` + +### `@query` {#@TypeSpec.Http.query} + +Specify this property is to be sent as a query parameter. + +```typespec +@TypeSpec.Http.query(queryNameOrOptions?: string | TypeSpec.Http.QueryOptions) +``` + +#### Target + +`ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ------------------ | -------------------------------------------- | ------------------------------------------------------------------------------- | +| queryNameOrOptions | `union string \| TypeSpec.Http.QueryOptions` | Optional name of the query when included in the url or query parameter options. | + +#### Examples + +```typespec +op read(@query select: string, @query("order-by") orderBy: string): void; +op list( + @query({ + name: "id", + format: "multi", + }) + ids: string[], +): void; +``` + +### `@route` {#@TypeSpec.Http.route} + +Defines the relative route URI for the target operation + +The first argument should be a URI fragment that may contain one or more path parameter fields. +If the namespace or interface that contains the operation is also marked with a `@route` decorator, +it will be used as a prefix to the route URI of the operation. + +`@route` can only be applied to operations, namespaces, and interfaces. + +```typespec +@TypeSpec.Http.route(path: valueof string, options?: (anonymous model)) +``` + +#### Target + +`union Namespace | Interface | Operation` + +#### Parameters + +| Name | Type | Description | +| ------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | +| path | `valueof scalar string` | Relative route path. Cannot include query parameters. | +| options | `model (anonymous model)` | Set of parameters used to configure the route. Supports `{shared: true}` which indicates that the route may be shared by several operations. | + +#### Examples + +```typespec +@route("/widgets") +op getWidget(@path id: string): Widget; +``` + +### `@server` {#@TypeSpec.Http.server} + +Specify the endpoint for this service. + +```typespec +@TypeSpec.Http.server(url: valueof string, description: valueof string, parameters?: Record) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| ----------- | ----------------------- | ------------------------------------------------------- | +| url | `valueof scalar string` | Server endpoint | +| description | `valueof scalar string` | Description of the endpoint | +| parameters | `model Record` | Optional set of parameters used to interpolate the url. | + +#### Examples + +```typespec +@service +@server("https://example.com", "Single server endpoint") +namespace PetStore; +``` + +##### parameterized + +```typespec +@server("https://{region}.foo.com", "Regional endpoint", { +@doc("Region name") +region?: string = "westus", +}) +``` + +### `@sharedRoute` {#@TypeSpec.Http.sharedRoute} + +`@sharedRoute` marks the operation as sharing a route path with other operations. + +When an operation is marked with `@sharedRoute`, it enables other operations to share the same +route path as long as those operations are also marked with `@sharedRoute`. + +`@sharedRoute` can only be applied directly to operations. + +```typespec +@sharedRoute +@route("/widgets") +op getWidget(@path id: string): Widget; +``` + +```typespec +@TypeSpec.Http.sharedRoute +``` + +#### Target + +`Operation` + +#### Parameters + +None + +### `@statusCode` {#@TypeSpec.Http.statusCode} + +Specify the status code for this response. Property type must be a status code integer or a union of status code integer. + +```typespec +@TypeSpec.Http.statusCode +``` + +#### Target + +`ModelProperty` + +#### Parameters + +None + +#### Examples + +```typespec +op read(): {@statusCode: 200, @body pet: Pet} +op create(): {@statusCode: 201 | 202} +``` + +### `@useAuth` {#@TypeSpec.Http.useAuth} + +Specify this service authentication. See the [documentation in the Http library](https://microsoft.github.io/typespec/standard-library/http/authentication) for full details. + +```typespec +@TypeSpec.Http.useAuth(auth: {} | Union | {}[]) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| ---- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| auth | `union {} \| Union \| {}[]` | Authentication configuration. Can be a single security scheme, a union(either option is valid authentication) or a tuple(Must use all authentication together) | + +#### Examples + +```typespec +@service +@useAuth(BasicAuth) +namespace PetStore; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/index.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/index.md new file mode 100644 index 0000000000..725b01bad4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/index.md @@ -0,0 +1,81 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec HTTP protocol binding + +## Install + + + + +```bash +npm install @typespec/http +``` + + + + +```bash +npm install --save-peer @typespec/http +``` + + + + +## TypeSpec.Http + +### Decorators + +- [`@body`](./decorators.md#@TypeSpec.Http.body) +- [`@delete`](./decorators.md#@TypeSpec.Http.delete) +- [`@get`](./decorators.md#@TypeSpec.Http.get) +- [`@head`](./decorators.md#@TypeSpec.Http.head) +- [`@header`](./decorators.md#@TypeSpec.Http.header) +- [`@includeInapplicableMetadataInPayload`](./decorators.md#@TypeSpec.Http.includeInapplicableMetadataInPayload) +- [`@patch`](./decorators.md#@TypeSpec.Http.patch) +- [`@path`](./decorators.md#@TypeSpec.Http.path) +- [`@post`](./decorators.md#@TypeSpec.Http.post) +- [`@put`](./decorators.md#@TypeSpec.Http.put) +- [`@query`](./decorators.md#@TypeSpec.Http.query) +- [`@route`](./decorators.md#@TypeSpec.Http.route) +- [`@server`](./decorators.md#@TypeSpec.Http.server) +- [`@sharedRoute`](./decorators.md#@TypeSpec.Http.sharedRoute) +- [`@statusCode`](./decorators.md#@TypeSpec.Http.statusCode) +- [`@useAuth`](./decorators.md#@TypeSpec.Http.useAuth) + +### Models + +- [`AcceptedResponse`](./data-types.md#TypeSpec.Http.AcceptedResponse) +- [`ApiKeyAuth`](./data-types.md#TypeSpec.Http.ApiKeyAuth) +- [`AuthorizationCodeFlow`](./data-types.md#TypeSpec.Http.AuthorizationCodeFlow) +- [`BadRequestResponse`](./data-types.md#TypeSpec.Http.BadRequestResponse) +- [`BasicAuth`](./data-types.md#TypeSpec.Http.BasicAuth) +- [`BearerAuth`](./data-types.md#TypeSpec.Http.BearerAuth) +- [`Body`](./data-types.md#TypeSpec.Http.Body) +- [`ClientCredentialsFlow`](./data-types.md#TypeSpec.Http.ClientCredentialsFlow) +- [`ConflictResponse`](./data-types.md#TypeSpec.Http.ConflictResponse) +- [`CreatedResponse`](./data-types.md#TypeSpec.Http.CreatedResponse) +- [`ForbiddenResponse`](./data-types.md#TypeSpec.Http.ForbiddenResponse) +- [`HeaderOptions`](./data-types.md#TypeSpec.Http.HeaderOptions) +- [`ImplicitFlow`](./data-types.md#TypeSpec.Http.ImplicitFlow) +- [`LocationHeader`](./data-types.md#TypeSpec.Http.LocationHeader) +- [`MovedResponse`](./data-types.md#TypeSpec.Http.MovedResponse) +- [`NoContentResponse`](./data-types.md#TypeSpec.Http.NoContentResponse) +- [`NotFoundResponse`](./data-types.md#TypeSpec.Http.NotFoundResponse) +- [`NotModifiedResponse`](./data-types.md#TypeSpec.Http.NotModifiedResponse) +- [`OAuth2Auth`](./data-types.md#TypeSpec.Http.OAuth2Auth) +- [`OkResponse`](./data-types.md#TypeSpec.Http.OkResponse) +- [`PasswordFlow`](./data-types.md#TypeSpec.Http.PasswordFlow) +- [`PlainData`](./data-types.md#TypeSpec.Http.PlainData) +- [`QueryOptions`](./data-types.md#TypeSpec.Http.QueryOptions) +- [`Response`](./data-types.md#TypeSpec.Http.Response) +- [`UnauthorizedResponse`](./data-types.md#TypeSpec.Http.UnauthorizedResponse) diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/enumerations/Visibility.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/enumerations/Visibility.md new file mode 100644 index 0000000000..c78bd9f91c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/enumerations/Visibility.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[E] Visibility" + +--- +Flags enum representation of well-known visibilities that are used in +REST API. + +## Enumeration Members + +| Member | Value | Description | +| :------ | :------ | :------ | +| `All` | `31` | - | +| `Create` | `2` | - | +| `Delete` | `8` | - | +| `Item` | `1048576` | Additional flag to indicate when something is nested in a collection
and therefore no metadata is applicable. | +| `None` | `0` | - | +| `Patch` | `2097152` | Additional flag to indicate when the verb is path and therefore
will have fields made optional if request visibility includes update. | +| `Query` | `16` | - | +| `Read` | `1` | - | +| `Update` | `4` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$body.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$body.md new file mode 100644 index 0000000000..08f4597c71 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$body.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $body" + +--- +```ts +$body(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$delete.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$delete.md new file mode 100644 index 0000000000..9d1cbc7d2d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$delete.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $delete" + +--- +```ts +$delete(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$get.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$get.md new file mode 100644 index 0000000000..81fd259857 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$get.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $get" + +--- +```ts +$get(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$head.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$head.md new file mode 100644 index 0000000000..2759bf9991 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$head.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $head" + +--- +```ts +$head(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$header.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$header.md new file mode 100644 index 0000000000..d5f560f5de --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$header.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $header" + +--- +```ts +$header( + context, + entity, + headerNameOrOptions?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` | +| `headerNameOrOptions`? | `StringLiteral` \| `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$includeInapplicableMetadataInPayload.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$includeInapplicableMetadataInPayload.md new file mode 100644 index 0000000000..4797ed6bbe --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$includeInapplicableMetadataInPayload.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] $includeInapplicableMetadataInPayload" + +--- +```ts +$includeInapplicableMetadataInPayload( + context, + entity, + value): void +``` + +Specifies if inapplicable metadata should be included in the payload for +the given entity. This is true by default unless changed by this +decorator. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | `DecoratorContext` | - | +| `entity` | `Type` | Target model, namespace, or model property. If applied to a
model or namespace, applies recursively to child models,
namespaces, and model properties unless overridden by
applying this decorator to a child. | +| `value` | `boolean` | `true` to include inapplicable metadata in payload, false to
exclude it. | + +## Returns + +## See + +isApplicableMetadata diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$onValidate.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$onValidate.md new file mode 100644 index 0000000000..df5dda0051 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$onValidate.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] $onValidate" + +--- +```ts +$onValidate(program): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$patch.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$patch.md new file mode 100644 index 0000000000..a9555a332f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$patch.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $patch" + +--- +```ts +$patch(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$path.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$path.md new file mode 100644 index 0000000000..50616f10c8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$path.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $path" + +--- +```ts +$path( + context, + entity, + paramName?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` | +| `paramName`? | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$plainData.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$plainData.md new file mode 100644 index 0000000000..f2ffd4286e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$plainData.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $plainData" + +--- +```ts +$plainData(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$post.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$post.md new file mode 100644 index 0000000000..d2b97129dc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$post.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $post" + +--- +```ts +$post(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$put.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$put.md new file mode 100644 index 0000000000..a8011177d0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$put.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $put" + +--- +```ts +$put(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$query.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$query.md new file mode 100644 index 0000000000..2f8f230b95 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$query.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $query" + +--- +```ts +$query( + context, + entity, + queryNameOrOptions?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` | +| `queryNameOrOptions`? | `StringLiteral` \| `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$route.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$route.md new file mode 100644 index 0000000000..a70fe4adb5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$route.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] $route" + +--- +```ts +$route( + context, + entity, + path, + parameters?): void +``` + +`@route` defines the relative route URI for the target operation + +The first argument should be a URI fragment that may contain one or more path parameter fields. +If the namespace or interface that contains the operation is also marked with a `@route` decorator, +it will be used as a prefix to the route URI of the operation. + +`@route` can only be applied to operations, namespaces, and interfaces. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Type` | +| `path` | `string` | +| `parameters`? | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$server.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$server.md new file mode 100644 index 0000000000..4456caa306 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$server.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[F] $server" + +--- +```ts +$server( + context, + target, + url, + description, + parameters?): void +``` + +Configure the server url for the service. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | `DecoratorContext` | Decorator context | +| `target` | `Namespace` | Decorator target(Must be a namespace) | +| `url` | `string` | - | +| `description` | `string` | Description for this server. | +| `parameters`? | `Model` | | + +## Returns + +## Optional + +Parameters to interpolate in the server url. diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$sharedRoute.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$sharedRoute.md new file mode 100644 index 0000000000..c0e11dd7dd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$sharedRoute.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[F] $sharedRoute" + +--- +```ts +$sharedRoute(context, entity): void +``` + +`@sharedRoute` marks the operation as sharing a route path with other operations. + +When an operation is marked with `@sharedRoute`, it enables other operations to share the same +route path as long as those operations are also marked with `@sharedRoute`. + +`@sharedRoute` can only be applied directly to operations. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$statusCode.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$statusCode.md new file mode 100644 index 0000000000..cfbc299977 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$statusCode.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $statusCode" + +--- +```ts +$statusCode(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$useAuth.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$useAuth.md new file mode 100644 index 0000000000..c9be7e0c30 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/$useAuth.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $useAuth" + +--- +```ts +$useAuth( + context, + serviceNamespace, + authConfig): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `serviceNamespace` | `Namespace` | +| `authConfig` | `Model` \| `Tuple` \| `Union` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/DefaultRouteProducer.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/DefaultRouteProducer.md new file mode 100644 index 0000000000..c3baa9cc3f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/DefaultRouteProducer.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] DefaultRouteProducer" + +--- +```ts +DefaultRouteProducer( + program, + operation, + parentSegments, + overloadBase, +options): DiagnosticResult +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | +| `parentSegments` | `string`[] | +| `overloadBase` | `undefined` \| [`HttpOperation`](../interfaces/HttpOperation.md) | +| `options` | [`RouteOptions`](../interfaces/RouteOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/createMetadataInfo.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/createMetadataInfo.md new file mode 100644 index 0000000000..fc9c4b7c80 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/createMetadataInfo.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] createMetadataInfo" + +--- +```ts +createMetadataInfo(program, options?): MetadataInfo +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `options`? | [`MetadataInfoOptions`](../interfaces/MetadataInfoOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/gatherMetadata.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/gatherMetadata.md new file mode 100644 index 0000000000..ddecacfe31 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/gatherMetadata.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[F] gatherMetadata" + +--- +```ts +gatherMetadata( + program, + diagnostics, + type, + visibility, + isMetadataCallback, +rootMapOut?): Set +``` + +Walks the given type and collects all applicable metadata and `@body` +properties recursively. + +## Parameters + +| Parameter | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `program` | `Program` | `undefined` | - | +| `diagnostics` | `DiagnosticCollector` | `undefined` | - | +| `type` | `Type` | `undefined` | - | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | `undefined` | - | +| `isMetadataCallback` | (`program`, `property`) => `boolean` | `isMetadata` | - | +| `rootMapOut`? | `Map`<`ModelProperty`, `ModelProperty`\> | `undefined` | If provided, the map will be populated to link
nested metadata properties to their root properties. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getAllHttpServices.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getAllHttpServices.md new file mode 100644 index 0000000000..63f1e62d6d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getAllHttpServices.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getAllHttpServices" + +--- +```ts +getAllHttpServices(program, options?): [HttpService[], readonly Diagnostic[]] +``` + +Returns all the services defined. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `options`? | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getAllRoutes.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getAllRoutes.md new file mode 100644 index 0000000000..4b4588af1e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getAllRoutes.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getAllRoutes" + +--- +```ts +getAllRoutes(program, options?): [HttpOperation[], readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `options`? | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | + +## Returns + +## Deprecated + +use `getAllHttpServices` instead diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getAuthentication.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getAuthentication.md new file mode 100644 index 0000000000..972a1ae8e8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getAuthentication.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getAuthentication" + +--- +```ts +getAuthentication(program, namespace): ServiceAuthentication | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getContentTypes.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getContentTypes.md new file mode 100644 index 0000000000..b72f3b5765 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getContentTypes.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[F] getContentTypes" + +--- +```ts +getContentTypes(property): [string[], readonly Diagnostic[]] +``` + +Resolve the content types from a model property by looking at the value. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `property` | `ModelProperty` | Model property | + +## Returns + +List of contnet types and any diagnostics if there was an issue. diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHeaderFieldName.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHeaderFieldName.md new file mode 100644 index 0000000000..524de93e36 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHeaderFieldName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getHeaderFieldName" + +--- +```ts +getHeaderFieldName(program, entity): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHeaderFieldOptions.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHeaderFieldOptions.md new file mode 100644 index 0000000000..96ee40708c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHeaderFieldOptions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getHeaderFieldOptions" + +--- +```ts +getHeaderFieldOptions(program, entity): HeaderFieldOptions +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHttpOperation.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHttpOperation.md new file mode 100644 index 0000000000..6e53c0d77e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHttpOperation.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getHttpOperation" + +--- +```ts +getHttpOperation( + program, + operation, + options?): [HttpOperation, readonly Diagnostic[]] +``` + +Return the Http Operation details for a given TypeSpec operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | - | +| `operation` | `Operation` | Operation | +| `options`? | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | Optional option on how to resolve the http details. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHttpService.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHttpService.md new file mode 100644 index 0000000000..281ee897be --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getHttpService.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getHttpService" + +--- +```ts +getHttpService( + program, + serviceNamespace, + options?): [HttpService, readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `serviceNamespace` | `Namespace` | +| `options`? | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getOperationParameters.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getOperationParameters.md new file mode 100644 index 0000000000..48bb22851b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getOperationParameters.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getOperationParameters" + +--- +```ts +getOperationParameters( + program, + operation, + overloadBase?, + knownPathParamNames?, + options?): [HttpOperationParameters, readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `program` | `Program` | `undefined` | +| `operation` | `Operation` | `undefined` | +| `overloadBase`? | [`HttpOperation`](../interfaces/HttpOperation.md) | `undefined` | +| `knownPathParamNames`? | `string`[] | `[]` | +| `options`? | [`OperationParameterOptions`](../interfaces/OperationParameterOptions.md) | `{}` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getOperationVerb.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getOperationVerb.md new file mode 100644 index 0000000000..20d663b6b8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getOperationVerb.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getOperationVerb" + +--- +```ts +getOperationVerb(program, entity): HttpVerb | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getPathParamName.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getPathParamName.md new file mode 100644 index 0000000000..e5e188999f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getPathParamName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getPathParamName" + +--- +```ts +getPathParamName(program, entity): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getPathParamOptions.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getPathParamOptions.md new file mode 100644 index 0000000000..d15be02de9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getPathParamOptions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getPathParamOptions" + +--- +```ts +getPathParamOptions(program, entity): PathParameterOptions +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getQueryParamName.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getQueryParamName.md new file mode 100644 index 0000000000..696a31c9dd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getQueryParamName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getQueryParamName" + +--- +```ts +getQueryParamName(program, entity): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getQueryParamOptions.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getQueryParamOptions.md new file mode 100644 index 0000000000..785bc543a6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getQueryParamOptions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getQueryParamOptions" + +--- +```ts +getQueryParamOptions(program, entity): QueryParameterOptions +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRequestVisibility.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRequestVisibility.md new file mode 100644 index 0000000000..6da65bcb1b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRequestVisibility.md @@ -0,0 +1,30 @@ +--- +jsApi: true +title: "[F] getRequestVisibility" + +--- +```ts +getRequestVisibility(verb): Visibility +``` + +Determines the visibility to use for a request with the given verb. + +- GET | HEAD => Visibility.Query +- POST => Visibility.Create +- PATCH => Visibility.Update +- PUT => Visibility.Create | Update +- DELETE => Visibility.Delete + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `verb` | [`HttpVerb`](../type-aliases/HttpVerb.md) | The HTTP verb for the operation. | + +## Returns + +The applicable parameter visibility or visibilities for the request. + +## Deprecated + +Use `resolveRequestVisibility` instead, or if you only want the default visibility for a verb, `getDefaultVisibilityForVerb`. diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getResponsesForOperation.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getResponsesForOperation.md new file mode 100644 index 0000000000..6b262563a5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getResponsesForOperation.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getResponsesForOperation" + +--- +```ts +getResponsesForOperation(program, operation): [HttpOperationResponse[], readonly Diagnostic[]] +``` + +Get the responses for a given operation. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRouteOptionsForNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRouteOptionsForNamespace.md new file mode 100644 index 0000000000..73f28e58b8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRouteOptionsForNamespace.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getRouteOptionsForNamespace" + +--- +```ts +getRouteOptionsForNamespace(program, namespace): RouteOptions | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRoutePath.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRoutePath.md new file mode 100644 index 0000000000..47013e291f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRoutePath.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getRoutePath" + +--- +```ts +getRoutePath(program, entity): RoutePath | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Interface` \| `Namespace` \| `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRouteProducer.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRouteProducer.md new file mode 100644 index 0000000000..dfd2808edd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getRouteProducer.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getRouteProducer" + +--- +```ts +getRouteProducer(program, operation): RouteProducer +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getServers.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getServers.md new file mode 100644 index 0000000000..5209b6a692 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getServers.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getServers" + +--- +```ts +getServers(program, type): HttpServer[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getStatusCodeDescription.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getStatusCodeDescription.md new file mode 100644 index 0000000000..7af635a291 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getStatusCodeDescription.md @@ -0,0 +1,33 @@ +--- +jsApi: true +title: "[F] getStatusCodeDescription" + +--- +```ts +getStatusCodeDescription(statusCode): + | undefined + | "Informational" + | "Successful" + | "Redirection" + | "Client error" + | "Server error" + | "The request has succeeded." + | "The request has succeeded and a new resource has been created as a result." + | "The request has been accepted for processing, but processing has not yet completed." + | "There is no content to send for this request, but the headers may be useful. " + | "The URL of the requested resource has been changed permanently. The new URL is given in the response." + | "The client has made a conditional request and the resource has not been modified." + | "The server could not understand the request due to invalid syntax." + | "Access is unauthorized." + | "Access is forbidden" + | "The server cannot find the requested resource." + | "The request conflicts with the current state of the server." + | "Precondition failed." + | "Service unavailable." +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `statusCode` | `string` \| `number` \| [`HttpStatusCodeRange`](../interfaces/HttpStatusCodeRange.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getStatusCodes.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getStatusCodes.md new file mode 100644 index 0000000000..839f283fbe --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getStatusCodes.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getStatusCodes" + +--- +```ts +getStatusCodes(program, entity): HttpStatusCodes +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getStatusCodesWithDiagnostics.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getStatusCodesWithDiagnostics.md new file mode 100644 index 0000000000..befc459194 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getStatusCodesWithDiagnostics.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getStatusCodesWithDiagnostics" + +--- +```ts +getStatusCodesWithDiagnostics(program, type): [HttpStatusCodes, readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getVisibilitySuffix.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getVisibilitySuffix.md new file mode 100644 index 0000000000..4cdda1001e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/getVisibilitySuffix.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] getVisibilitySuffix" + +--- +```ts +getVisibilitySuffix(visibility, canonicalVisibility): string +``` + +Provides a naming suffix to create a unique name for a type with this +visibility. + +The canonical visibility (default Visibility.Read) gets empty suffix, +otherwise visibilities are joined in pascal-case with `Or`. And `Item` is +if `Visibility.Item` is produced. + +Examples (with canonicalVisibility = Visibility.Read): + - Visibility.Read => "" + - Visibility.Update => "Update" + - Visibility.Create | Visibility.Update => "CreateOrUpdate" + - Visibility.Create | Visibility.Item => "CreateItem" + - Visibility.Create | Visibility.Update | Visibility.Item => "CreateOrUpdateItem" + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | `undefined` | +| `canonicalVisibility` | `undefined` \| [`Visibility`](../enumerations/Visibility.md) | `Visibility.None` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/includeInapplicableMetadataInPayload2.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/includeInapplicableMetadataInPayload2.md new file mode 100644 index 0000000000..30af155e4e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/includeInapplicableMetadataInPayload2.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] includeInapplicableMetadataInPayload" +--- + +```ts +includeInapplicableMetadataInPayload(program, property): boolean +``` + +Determines if the given model property should be included in the payload if it is +inapplicable metadata. + +## Parameters + +| Parameter | Type | +| :--------- | :-------------- | +| `program` | `Program` | +| `property` | `ModelProperty` | + +## Returns + +## See + +- isApplicableMetadata +- $includeInapplicableMetadataInPayload diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/includeInterfaceRoutesInNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/includeInterfaceRoutesInNamespace.md new file mode 100644 index 0000000000..ab7e3e2f8e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/includeInterfaceRoutesInNamespace.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] includeInterfaceRoutesInNamespace" + +--- +```ts +includeInterfaceRoutesInNamespace( + program, + target, + sourceInterface): void +``` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | Program | +| `target` | `Namespace` | Target namespace | +| `sourceInterface` | `string` | Interface that should be included in namespace. | + +## Returns + +## Deprecated + +DO NOT USE. For internal use only as a workaround. diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isApplicableMetadata.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isApplicableMetadata.md new file mode 100644 index 0000000000..d67080497b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isApplicableMetadata.md @@ -0,0 +1,30 @@ +--- +jsApi: true +title: "[F] isApplicableMetadata" + +--- +```ts +isApplicableMetadata( + program, + property, + visibility, + isMetadataCallback): boolean +``` + +Determines if the given property is metadata that is applicable with the +given visibility. + +- No metadata is applicable with Visibility.Item present. +- If only Visibility.Read is present, then only `@header` and `@status` + properties are applicable. +- If Visibility.Read is not present, all metadata properties other than + `@statusCode` are applicable. + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `program` | `Program` | `undefined` | +| `property` | `ModelProperty` | `undefined` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | `undefined` | +| `isMetadataCallback` | (`program`, `property`) => `boolean` | `isMetadata` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isApplicableMetadataOrBody.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isApplicableMetadataOrBody.md new file mode 100644 index 0000000000..0766374972 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isApplicableMetadataOrBody.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] isApplicableMetadataOrBody" + +--- +```ts +isApplicableMetadataOrBody( + program, + property, + visibility, + isMetadataCallback): boolean +``` + +Determines if the given property is metadata or marked `@body` and +applicable with the given visibility. + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `program` | `Program` | `undefined` | +| `property` | `ModelProperty` | `undefined` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | `undefined` | +| `isMetadataCallback` | (`program`, `property`) => `boolean` | `isMetadata` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isBody.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isBody.md new file mode 100644 index 0000000000..ba6a93bb59 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isBody.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isBody" + +--- +```ts +isBody(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isContentTypeHeader.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isContentTypeHeader.md new file mode 100644 index 0000000000..f4601f390f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isContentTypeHeader.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isContentTypeHeader" + +--- +```ts +isContentTypeHeader(program, property): boolean +``` + +Check if the given model property is the content type header. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | Program | +| `property` | `ModelProperty` | Model property. | + +## Returns + +True if the model property is marked as a header and has the name `content-type`(case insensitive.) diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isHeader.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isHeader.md new file mode 100644 index 0000000000..e45fcf8309 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isHeader.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isHeader" + +--- +```ts +isHeader(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isMetadata.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isMetadata.md new file mode 100644 index 0000000000..3222e3c661 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isMetadata.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[F] isMetadata" + +--- +```ts +isMetadata(program, property): boolean +``` + +Determines if a property is metadata. A property is defined to be +metadata if it is marked `@header`, `@query`, `@path`, or `@statusCode`. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `property` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isOverloadSameEndpoint.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isOverloadSameEndpoint.md new file mode 100644 index 0000000000..55c0a6446f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isOverloadSameEndpoint.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isOverloadSameEndpoint" + +--- +```ts +isOverloadSameEndpoint(overload): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `overload` | [`HttpOperation`](../interfaces/HttpOperation.md) & `object` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isPathParam.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isPathParam.md new file mode 100644 index 0000000000..56ed9917c3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isPathParam.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isPathParam" + +--- +```ts +isPathParam(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isQueryParam.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isQueryParam.md new file mode 100644 index 0000000000..20917a8cef --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isQueryParam.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isQueryParam" + +--- +```ts +isQueryParam(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isSharedRoute.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isSharedRoute.md new file mode 100644 index 0000000000..2aab23560f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isSharedRoute.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isSharedRoute" + +--- +```ts +isSharedRoute(program, operation): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isStatusCode.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isStatusCode.md new file mode 100644 index 0000000000..6d2c3dbd78 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isStatusCode.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isStatusCode" + +--- +```ts +isStatusCode(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isVisible.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isVisible.md new file mode 100644 index 0000000000..bf10fe75fe --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/isVisible.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isVisible" + +--- +```ts +isVisible( + program, + property, + visibility): boolean +``` + +Determines if the given property is visible with the given visibility. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `property` | `ModelProperty` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/listHttpOperationsIn.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/listHttpOperationsIn.md new file mode 100644 index 0000000000..4d726d7d73 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/listHttpOperationsIn.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] listHttpOperationsIn" + +--- +```ts +listHttpOperationsIn( + program, + container, + options?): [HttpOperation[], readonly Diagnostic[]] +``` + +Get all the Http Operation in the given container. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | Program | +| `container` | [`OperationContainer`](../type-aliases/OperationContainer.md) | Namespace or interface containing operations | +| `options`? | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | Resolution options | + +## Returns diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/reportIfNoRoutes.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/reportIfNoRoutes.md new file mode 100644 index 0000000000..1f91975eeb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/reportIfNoRoutes.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] reportIfNoRoutes" + +--- +```ts +reportIfNoRoutes(program, routes): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `routes` | [`HttpOperation`](../interfaces/HttpOperation.md)[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/resolvePathAndParameters.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/resolvePathAndParameters.md new file mode 100644 index 0000000000..94c273380e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/resolvePathAndParameters.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] resolvePathAndParameters" + +--- +```ts +resolvePathAndParameters( + program, + operation, + overloadBase, +options): DiagnosticResult +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | +| `overloadBase` | `undefined` \| [`HttpOperation`](../interfaces/HttpOperation.md) | +| `options` | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/resolveRequestVisibility.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/resolveRequestVisibility.md new file mode 100644 index 0000000000..a186cc04ad --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/resolveRequestVisibility.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[F] resolveRequestVisibility" + +--- +```ts +resolveRequestVisibility( + program, + operation, + verb): Visibility +``` + +Returns the applicable parameter visibility or visibilities for the request if `@requestVisibility` was used. +Otherwise, returns the default visibility based on the HTTP verb for the operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | - | +| `operation` | `Operation` | The TypeSpec Operation for the request. | +| `verb` | [`HttpVerb`](../type-aliases/HttpVerb.md) | The HTTP verb for the operation. | + +## Returns + +The applicable parameter visibility or visibilities for the request. diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setAuthentication.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setAuthentication.md new file mode 100644 index 0000000000..95b1e8cd32 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setAuthentication.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] setAuthentication" + +--- +```ts +setAuthentication( + program, + serviceNamespace, + auth): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `serviceNamespace` | `Namespace` | +| `auth` | [`ServiceAuthentication`](../interfaces/ServiceAuthentication.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setRoute.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setRoute.md new file mode 100644 index 0000000000..ee3af48db7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setRoute.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] setRoute" + +--- +```ts +setRoute( + context, + entity, + details): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Type` | +| `details` | [`RoutePath`](../interfaces/RoutePath.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setRouteOptionsForNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setRouteOptionsForNamespace.md new file mode 100644 index 0000000000..320776737e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setRouteOptionsForNamespace.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] setRouteOptionsForNamespace" + +--- +```ts +setRouteOptionsForNamespace( + program, + namespace, + options): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | +| `options` | [`RouteOptions`](../interfaces/RouteOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setRouteProducer.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setRouteProducer.md new file mode 100644 index 0000000000..3cb9e47bc8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setRouteProducer.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] setRouteProducer" + +--- +```ts +setRouteProducer( + program, + operation, + routeProducer): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | +| `routeProducer` | [`RouteProducer`](../type-aliases/RouteProducer.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setSharedRoute.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setSharedRoute.md new file mode 100644 index 0000000000..d922723c21 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setSharedRoute.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] setSharedRoute" + +--- +```ts +setSharedRoute(program, operation): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setStatusCode.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setStatusCode.md new file mode 100644 index 0000000000..aa7246eb1b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/setStatusCode.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] setStatusCode" + +--- +```ts +setStatusCode( + program, + entity, + codes): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Model` \| `ModelProperty` | +| `codes` | `string`[] | + +## Returns + +## Deprecated + +DO NOT USE, for internal use only. diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/validateRouteUnique.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/validateRouteUnique.md new file mode 100644 index 0000000000..c9779ec6a9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/functions/validateRouteUnique.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] validateRouteUnique" + +--- +```ts +validateRouteUnique( + program, + diagnostics, + operations): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `diagnostics` | `DiagnosticCollector` | +| `operations` | [`HttpOperation`](../interfaces/HttpOperation.md)[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/index.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/index.md new file mode 100644 index 0000000000..ccaa57f7ed --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/index.md @@ -0,0 +1,137 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Enumerations + +- [Visibility](enumerations/Visibility.md) + +### Interfaces + +- [ApiKeyAuth](interfaces/ApiKeyAuth.md) +- [AuthenticationOption](interfaces/AuthenticationOption.md) +- [AuthorizationCodeFlow](interfaces/AuthorizationCodeFlow.md) +- [BasicAuth](interfaces/BasicAuth.md) +- [BearerAuth](interfaces/BearerAuth.md) +- [ClientCredentialsFlow](interfaces/ClientCredentialsFlow.md) +- [HeaderFieldOptions](interfaces/HeaderFieldOptions.md) +- [HttpAuthBase](interfaces/HttpAuthBase.md) +- [HttpOperation](interfaces/HttpOperation.md) +- [HttpOperationBody](interfaces/HttpOperationBody.md) +- [HttpOperationParameters](interfaces/HttpOperationParameters.md) +- [HttpOperationRequestBody](interfaces/HttpOperationRequestBody.md) +- [HttpOperationResponse](interfaces/HttpOperationResponse.md) +- [HttpOperationResponseContent](interfaces/HttpOperationResponseContent.md) +- [HttpServer](interfaces/HttpServer.md) +- [HttpService](interfaces/HttpService.md) +- [HttpStatusCodeRange](interfaces/HttpStatusCodeRange.md) +- [ImplicitFlow](interfaces/ImplicitFlow.md) +- [MetadataInfo](interfaces/MetadataInfo.md) +- [MetadataInfoOptions](interfaces/MetadataInfoOptions.md) +- [OAuth2Scope](interfaces/OAuth2Scope.md) +- [Oauth2Auth](interfaces/Oauth2Auth.md) +- [OperationParameterOptions](interfaces/OperationParameterOptions.md) +- [PasswordFlow](interfaces/PasswordFlow.md) +- [PathParameterOptions](interfaces/PathParameterOptions.md) +- [QueryParameterOptions](interfaces/QueryParameterOptions.md) +- [RouteOptions](interfaces/RouteOptions.md) +- [RoutePath](interfaces/RoutePath.md) +- [RouteProducerResult](interfaces/RouteProducerResult.md) +- [RouteResolutionOptions](interfaces/RouteResolutionOptions.md) +- [ServiceAuthentication](interfaces/ServiceAuthentication.md) + +### Type Aliases + +- [HttpAuth](type-aliases/HttpAuth.md) +- [HttpOperationParameter](type-aliases/HttpOperationParameter.md) +- [HttpStatusCodes](type-aliases/HttpStatusCodes.md) +- [HttpStatusCodesEntry](type-aliases/HttpStatusCodesEntry.md) +- [HttpVerb](type-aliases/HttpVerb.md) +- [OAuth2Flow](type-aliases/OAuth2Flow.md) +- [OAuth2FlowType](type-aliases/OAuth2FlowType.md) +- [OperationContainer](type-aliases/OperationContainer.md) +- [OperationDetails](type-aliases/OperationDetails.md) +- [OperationVerbSelector](type-aliases/OperationVerbSelector.md) +- [RouteProducer](type-aliases/RouteProducer.md) +- [StatusCode](type-aliases/StatusCode.md) + +### Variables + +- [$lib](variables/$lib.md) +- [namespace](variables/namespace.md) + +### Functions + +- [$body](functions/$body.md) +- [$delete](functions/$delete.md) +- [$get](functions/$get.md) +- [$head](functions/$head.md) +- [$header](functions/$header.md) +- [$includeInapplicableMetadataInPayload](functions/$includeInapplicableMetadataInPayload.md) +- [$onValidate](functions/$onValidate.md) +- [$patch](functions/$patch.md) +- [$path](functions/$path.md) +- [$plainData](functions/$plainData.md) +- [$post](functions/$post.md) +- [$put](functions/$put.md) +- [$query](functions/$query.md) +- [$route](functions/$route.md) +- [$server](functions/$server.md) +- [$sharedRoute](functions/$sharedRoute.md) +- [$statusCode](functions/$statusCode.md) +- [$useAuth](functions/$useAuth.md) +- [DefaultRouteProducer](functions/DefaultRouteProducer.md) +- [createMetadataInfo](functions/createMetadataInfo.md) +- [gatherMetadata](functions/gatherMetadata.md) +- [getAllHttpServices](functions/getAllHttpServices.md) +- [getAllRoutes](functions/getAllRoutes.md) +- [getAuthentication](functions/getAuthentication.md) +- [getContentTypes](functions/getContentTypes.md) +- [getHeaderFieldName](functions/getHeaderFieldName.md) +- [getHeaderFieldOptions](functions/getHeaderFieldOptions.md) +- [getHttpOperation](functions/getHttpOperation.md) +- [getHttpService](functions/getHttpService.md) +- [getOperationParameters](functions/getOperationParameters.md) +- [getOperationVerb](functions/getOperationVerb.md) +- [getPathParamName](functions/getPathParamName.md) +- [getPathParamOptions](functions/getPathParamOptions.md) +- [getQueryParamName](functions/getQueryParamName.md) +- [getQueryParamOptions](functions/getQueryParamOptions.md) +- [getRequestVisibility](functions/getRequestVisibility.md) +- [getResponsesForOperation](functions/getResponsesForOperation.md) +- [getRouteOptionsForNamespace](functions/getRouteOptionsForNamespace.md) +- [getRoutePath](functions/getRoutePath.md) +- [getRouteProducer](functions/getRouteProducer.md) +- [getServers](functions/getServers.md) +- [getStatusCodeDescription](functions/getStatusCodeDescription.md) +- [getStatusCodes](functions/getStatusCodes.md) +- [getStatusCodesWithDiagnostics](functions/getStatusCodesWithDiagnostics.md) +- [getVisibilitySuffix](functions/getVisibilitySuffix.md) +- [includeInapplicableMetadataInPayload](functions/includeInapplicableMetadataInPayload.md) +- [includeInterfaceRoutesInNamespace](functions/includeInterfaceRoutesInNamespace.md) +- [isApplicableMetadata](functions/isApplicableMetadata.md) +- [isApplicableMetadataOrBody](functions/isApplicableMetadataOrBody.md) +- [isBody](functions/isBody.md) +- [isContentTypeHeader](functions/isContentTypeHeader.md) +- [isHeader](functions/isHeader.md) +- [isMetadata](functions/isMetadata.md) +- [isOverloadSameEndpoint](functions/isOverloadSameEndpoint.md) +- [isPathParam](functions/isPathParam.md) +- [isQueryParam](functions/isQueryParam.md) +- [isSharedRoute](functions/isSharedRoute.md) +- [isStatusCode](functions/isStatusCode.md) +- [isVisible](functions/isVisible.md) +- [listHttpOperationsIn](functions/listHttpOperationsIn.md) +- [reportIfNoRoutes](functions/reportIfNoRoutes.md) +- [resolvePathAndParameters](functions/resolvePathAndParameters.md) +- [resolveRequestVisibility](functions/resolveRequestVisibility.md) +- [setAuthentication](functions/setAuthentication.md) +- [setRoute](functions/setRoute.md) +- [setRouteOptionsForNamespace](functions/setRouteOptionsForNamespace.md) +- [setRouteProducer](functions/setRouteProducer.md) +- [setSharedRoute](functions/setSharedRoute.md) +- [setStatusCode](functions/setStatusCode.md) +- [validateRouteUnique](functions/validateRouteUnique.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ApiKeyAuth.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ApiKeyAuth.md new file mode 100644 index 0000000000..a7f2719fa1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ApiKeyAuth.md @@ -0,0 +1,44 @@ +--- +jsApi: true +title: "[I] ApiKeyAuth" + +--- +An API key is a token that a client provides when making API calls. The key can be sent in the query string: +``` +GET /something?api_key=abcdef12345 +``` + +or as a request header + +``` +GET /something HTTP/1.1 +X-API-Key: abcdef12345 +``` + +or as a cookie + +``` +GET /something HTTP/1.1 +Cookie: X-API-KEY=abcdef12345 +``` + +## Extends + +- [`HttpAuthBase`](HttpAuthBase.md) + +## Type parameters + +| Parameter | +| :------ | +| `TLocation` extends `ApiKeyLocation` | +| `TName` extends `string` | + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `description?` | `string` | Optional description. | [`HttpAuthBase`](HttpAuthBase.md).`description` | +| `id` | `string` | Id of the authentication scheme. | [`HttpAuthBase`](HttpAuthBase.md).`id` | +| `in` | `TLocation` | - | - | +| `name` | `TName` | - | - | +| `type` | `"apiKey"` | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/AuthenticationOption.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/AuthenticationOption.md new file mode 100644 index 0000000000..02df8838ac --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/AuthenticationOption.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] AuthenticationOption" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `schemes` | [`HttpAuth`](../type-aliases/HttpAuth.md)[] | For this authentication option all the given auth have to be used together. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/AuthorizationCodeFlow.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/AuthorizationCodeFlow.md new file mode 100644 index 0000000000..8d08d57e88 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/AuthorizationCodeFlow.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[I] AuthorizationCodeFlow" + +--- +Authorization Code flow + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `authorizationUrl` | `string` | - | +| `refreshUrl?` | `string` | - | +| `scopes` | [`OAuth2Scope`](OAuth2Scope.md)[] | - | +| `tokenUrl` | `string` | - | +| `type` | `"authorizationCode"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/BasicAuth.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/BasicAuth.md new file mode 100644 index 0000000000..64ab64df50 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/BasicAuth.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] BasicAuth" + +--- +Basic authentication is a simple authentication scheme built into the HTTP protocol. +The client sends HTTP requests with the Authorization header that contains the word Basic word followed by a space and a base64-encoded string username:password. +For example, to authorize as demo / p@55w0rd the client would send +``` + Authorization: Basic ZGVtbzpwQDU1dzByZA== +``` + +## Extends + +- [`HttpAuthBase`](HttpAuthBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `description?` | `string` | Optional description. | [`HttpAuthBase`](HttpAuthBase.md).`description` | +| `id` | `string` | Id of the authentication scheme. | [`HttpAuthBase`](HttpAuthBase.md).`id` | +| `scheme` | `"basic"` | - | - | +| `type` | `"http"` | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/BearerAuth.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/BearerAuth.md new file mode 100644 index 0000000000..93a3cecf47 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/BearerAuth.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] BearerAuth" + +--- +Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. +The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. +The client must send this token in the Authorization header when making requests to protected resources: +``` + Authorization: Bearer +``` + +## Extends + +- [`HttpAuthBase`](HttpAuthBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `description?` | `string` | Optional description. | [`HttpAuthBase`](HttpAuthBase.md).`description` | +| `id` | `string` | Id of the authentication scheme. | [`HttpAuthBase`](HttpAuthBase.md).`id` | +| `scheme` | `"bearer"` | - | - | +| `type` | `"http"` | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ClientCredentialsFlow.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ClientCredentialsFlow.md new file mode 100644 index 0000000000..5f2581ad8b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ClientCredentialsFlow.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] ClientCredentialsFlow" + +--- +Client credentials flow + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `refreshUrl?` | `string` | - | +| `scopes` | [`OAuth2Scope`](OAuth2Scope.md)[] | - | +| `tokenUrl` | `string` | - | +| `type` | `"clientCredentials"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HeaderFieldOptions.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HeaderFieldOptions.md new file mode 100644 index 0000000000..837614e712 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HeaderFieldOptions.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] HeaderFieldOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `format?` | \| `"csv"` \| `"multi"` \| `"ssv"` \| `"tsv"` \| `"pipes"` \| `"simple"` \| `"form"` | The string format of the array. "csv" and "simple" are used interchangeably, as are
"multi" and "form". | +| `name` | `string` | - | +| `type` | `"header"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpAuthBase.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpAuthBase.md new file mode 100644 index 0000000000..a0f47d0f33 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpAuthBase.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[I] HttpAuthBase" + +--- +## Extended By + +- [`BasicAuth`](BasicAuth.md) +- [`BearerAuth`](BearerAuth.md) +- [`ApiKeyAuth`](ApiKeyAuth.md) +- [`Oauth2Auth`](Oauth2Auth.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description?` | `string` | Optional description. | +| `id` | `string` | Id of the authentication scheme. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperation.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperation.md new file mode 100644 index 0000000000..54b3006633 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperation.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[I] HttpOperation" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `container` | [`OperationContainer`](../type-aliases/OperationContainer.md) | Parent type being the interface, namespace or global namespace. | +| `operation` | `Operation` | Operation type reference. | +| `overloading?` | [`HttpOperation`](HttpOperation.md) | Overload this operation | +| `overloads?` | [`HttpOperation`](HttpOperation.md)[] | List of operations that overloads this one. | +| `parameters` | [`HttpOperationParameters`](HttpOperationParameters.md) | Parameters. | +| `path` | `string` | Route path | +| `pathSegments` | `string`[] | Path segments | +| `responses` | [`HttpOperationResponse`](HttpOperationResponse.md)[] | Responses. | +| `verb` | [`HttpVerb`](../type-aliases/HttpVerb.md) | Route verb. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationBody.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationBody.md new file mode 100644 index 0000000000..177aa96c62 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationBody.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] HttpOperationBody" + +--- +## Extended By + +- [`HttpOperationRequestBody`](HttpOperationRequestBody.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `contentTypes` | `string`[] | Content types. | +| `type` | `Type` | Type of the operation body. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationParameters.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationParameters.md new file mode 100644 index 0000000000..46ee03bfa2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationParameters.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] HttpOperationParameters" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `body?` | [`HttpOperationRequestBody`](HttpOperationRequestBody.md) | - | +| `bodyParameter?` | `ModelProperty` | **Deprecated**

use body.parameter | +| `bodyType?` | `Type` | **Deprecated**

use body.type | +| `parameters` | [`HttpOperationParameter`](../type-aliases/HttpOperationParameter.md)[] | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationRequestBody.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationRequestBody.md new file mode 100644 index 0000000000..2a9975009b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationRequestBody.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] HttpOperationRequestBody" + +--- +Represent the body information for an http request. + +## Note + +the `type` must be a `Model` if the content type is multipart. + +## Extends + +- [`HttpOperationBody`](HttpOperationBody.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `contentTypes` | `string`[] | Content types. | [`HttpOperationBody`](HttpOperationBody.md).`contentTypes` | +| `parameter?` | `ModelProperty` | If the body was explicitly set as a property. Correspond to the property with `@body` | - | +| `type` | `Type` | Type of the operation body. | [`HttpOperationBody`](HttpOperationBody.md).`type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationResponse.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationResponse.md new file mode 100644 index 0000000000..0696432090 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationResponse.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] HttpOperationResponse" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description?` | `string` | Response description. | +| `responses` | [`HttpOperationResponseContent`](HttpOperationResponseContent.md)[] | Responses contents. | +| `statusCode` | [`StatusCode`](../type-aliases/StatusCode.md) | **Deprecated**

use [statusCodes](HttpOperationResponse.md) | +| `statusCodes` | `number` \| `"*"` \| [`HttpStatusCodeRange`](HttpStatusCodeRange.md) | Status code or range of status code for the response. | +| `type` | `Type` | Response typespec type. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationResponseContent.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationResponseContent.md new file mode 100644 index 0000000000..09b3215d45 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpOperationResponseContent.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] HttpOperationResponseContent" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `body?` | [`HttpOperationBody`](HttpOperationBody.md) | - | +| `headers?` | `Record`<`string`, `ModelProperty`\> | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpServer.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpServer.md new file mode 100644 index 0000000000..aa04851859 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpServer.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] HttpServer" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description` | `string` | - | +| `parameters` | `Map`<`string`, `ModelProperty`\> | - | +| `url` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpService.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpService.md new file mode 100644 index 0000000000..53d2857318 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpService.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] HttpService" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `namespace` | `Namespace` | - | +| `operations` | [`HttpOperation`](HttpOperation.md)[] | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpStatusCodeRange.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpStatusCodeRange.md new file mode 100644 index 0000000000..24f8700bf3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/HttpStatusCodeRange.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] HttpStatusCodeRange" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `end` | `number` | - | +| `start` | `number` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ImplicitFlow.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ImplicitFlow.md new file mode 100644 index 0000000000..ea657e4562 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ImplicitFlow.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] ImplicitFlow" + +--- +Implicit flow + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `authorizationUrl` | `string` | - | +| `refreshUrl?` | `string` | - | +| `scopes` | [`OAuth2Scope`](OAuth2Scope.md)[] | - | +| `type` | `"implicit"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/MetadataInfo.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/MetadataInfo.md new file mode 100644 index 0000000000..0903bf3af8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/MetadataInfo.md @@ -0,0 +1,107 @@ +--- +jsApi: true +title: "[I] MetadataInfo" + +--- +Provides information about changes that happen to a data type's payload +when inapplicable metadata is added or invisible properties are removed. + +Results are computed on demand and expensive computations are memoized. + +## Methods + +### getEffectivePayloadType() + +```ts +getEffectivePayloadType(type, visibility): Type +``` + +If type is an anonymous model, tries to find a named model that has the +same set of properties when non-payload properties are excluded. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `Type` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | + +*** + +### isEmptied() + +```ts +isEmptied(type, visibility): boolean +``` + +Determines if the given type is a model that becomes empty once +applicable metadata is removed and visibility is applied. + +Note that a model is not considered emptied if it was already empty in +the first place, or has a base model or indexer. + +When the type of a property is emptied by visibility, the property +itself is also removed. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `undefined` \| `Type` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | + +*** + +### isOptional() + +```ts +isOptional(property, visibility): boolean +``` + +Determines if the given property is optional in the request or +response payload for the given visibility. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | `ModelProperty` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | + +*** + +### isPayloadProperty() + +```ts +isPayloadProperty(property, visibility): boolean +``` + +Determines if the given property is part of the request or response +payload and not applicable metadata [isApplicableMetadata](../functions/isApplicableMetadata.md) or +filtered out by the given visibility. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | `ModelProperty` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | + +*** + +### isTransformed() + +```ts +isTransformed(type, visibility): boolean +``` + +Determines if the given type is transformed by applying the given +visibility and removing invisible properties or adding inapplicable +metadata properties. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `undefined` \| `Type` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/MetadataInfoOptions.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/MetadataInfoOptions.md new file mode 100644 index 0000000000..d31ce48a8d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/MetadataInfoOptions.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[I] MetadataInfoOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `canonicalVisibility?` | [`Visibility`](../enumerations/Visibility.md) | The visibility to be used as the baseline against which
[MetadataInfo.isEmptied](MetadataInfo.md#isemptied) and [MetadataInfo.isTransformed](MetadataInfo.md#istransformed)
are computed. If not specified, [Visibility.None](../enumerations/Visibility.md) is used, which
will consider that any model that has fields that are only visible to
some visibilities as transformed. | + +## Methods + +### canShareProperty() + +```ts +optional canShareProperty(property): boolean +``` + +Optional callback to indicate that a property can be shared with the +canonical representation even for visibilities where it is not visible. + +This is used, for example, in OpenAPI emit where a property can be +marked `readOnly: true` to represent @visibility("read") without +creating a separate schema schema for [Visibility.Read](../enumerations/Visibility.md). + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/OAuth2Scope.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/OAuth2Scope.md new file mode 100644 index 0000000000..58030f0a1f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/OAuth2Scope.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] OAuth2Scope" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description?` | `string` | - | +| `value` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/Oauth2Auth.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/Oauth2Auth.md new file mode 100644 index 0000000000..1e23a42405 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/Oauth2Auth.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[I] Oauth2Auth" + +--- +OAuth 2.0 is an authorization protocol that gives an API client limited access to user data on a web server. +OAuth relies on authentication scenarios called flows, which allow the resource owner (user) to share the protected content from the resource server without sharing their credentials. +For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner. +For more information about OAuth 2.0, see oauth.net and RFC 6749. + +## Extends + +- [`HttpAuthBase`](HttpAuthBase.md) + +## Type parameters + +| Parameter | +| :------ | +| `TFlows` extends [`OAuth2Flow`](../type-aliases/OAuth2Flow.md)[] | + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `description?` | `string` | Optional description. | [`HttpAuthBase`](HttpAuthBase.md).`description` | +| `flows` | `TFlows` | - | - | +| `id` | `string` | Id of the authentication scheme. | [`HttpAuthBase`](HttpAuthBase.md).`id` | +| `type` | `"oauth2"` | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/OperationParameterOptions.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/OperationParameterOptions.md new file mode 100644 index 0000000000..796a441838 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/OperationParameterOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] OperationParameterOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `verbSelector?` | [`OperationVerbSelector`](../type-aliases/OperationVerbSelector.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/PasswordFlow.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/PasswordFlow.md new file mode 100644 index 0000000000..4c0ba57d72 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/PasswordFlow.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] PasswordFlow" + +--- +Resource Owner Password flow + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `authorizationUrl` | `string` | - | +| `refreshUrl?` | `string` | - | +| `scopes` | [`OAuth2Scope`](OAuth2Scope.md)[] | - | +| `type` | `"password"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/PathParameterOptions.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/PathParameterOptions.md new file mode 100644 index 0000000000..105e571681 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/PathParameterOptions.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] PathParameterOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | - | +| `type` | `"path"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/QueryParameterOptions.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/QueryParameterOptions.md new file mode 100644 index 0000000000..7ac6b91f02 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/QueryParameterOptions.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] QueryParameterOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `format?` | \| `"csv"` \| `"multi"` \| `"ssv"` \| `"tsv"` \| `"pipes"` \| `"simple"` \| `"form"` | The string format of the array. "csv" and "simple" are used interchangeably, as are
"multi" and "form". | +| `name` | `string` | - | +| `type` | `"query"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RouteOptions.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RouteOptions.md new file mode 100644 index 0000000000..6f88a4d2cb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RouteOptions.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[I] RouteOptions" + +--- +## Extended By + +- [`RouteResolutionOptions`](RouteResolutionOptions.md) + +## Indexable + + \[`prop`: `string`\]: `any` + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `paramOptions?` | [`OperationParameterOptions`](OperationParameterOptions.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RoutePath.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RoutePath.md new file mode 100644 index 0000000000..7829364bb6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RoutePath.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] RoutePath" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | - | +| `shared` | `boolean` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RouteProducerResult.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RouteProducerResult.md new file mode 100644 index 0000000000..688453edb2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RouteProducerResult.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] RouteProducerResult" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `parameters` | [`HttpOperationParameters`](HttpOperationParameters.md) | - | +| `segments` | `string`[] | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RouteResolutionOptions.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RouteResolutionOptions.md new file mode 100644 index 0000000000..6731e98e36 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/RouteResolutionOptions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] RouteResolutionOptions" + +--- +## Extends + +- [`RouteOptions`](RouteOptions.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `listOptions?` | `ListOperationOptions` | - | - | +| `paramOptions?` | [`OperationParameterOptions`](OperationParameterOptions.md) | - | [`RouteOptions`](RouteOptions.md).`paramOptions` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ServiceAuthentication.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ServiceAuthentication.md new file mode 100644 index 0000000000..0245bf7799 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/interfaces/ServiceAuthentication.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] ServiceAuthentication" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `options` | [`AuthenticationOption`](AuthenticationOption.md)[] | Either one of those options can be used independently to authenticate. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpAuth.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpAuth.md new file mode 100644 index 0000000000..06bb976461 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpAuth.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] HttpAuth" + +--- +```ts +type HttpAuth: BasicAuth | BearerAuth | ApiKeyAuth | Oauth2Auth; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpOperationParameter.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpOperationParameter.md new file mode 100644 index 0000000000..d6a790a219 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpOperationParameter.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] HttpOperationParameter" + +--- +```ts +type HttpOperationParameter: HeaderFieldOptions | QueryParameterOptions | PathParameterOptions & object; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `param` | `ModelProperty` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpStatusCodes.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpStatusCodes.md new file mode 100644 index 0000000000..8420e0f83e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpStatusCodes.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] HttpStatusCodes" + +--- +```ts +type HttpStatusCodes: HttpStatusCodesEntry[]; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpStatusCodesEntry.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpStatusCodesEntry.md new file mode 100644 index 0000000000..717df4a69d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpStatusCodesEntry.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] HttpStatusCodesEntry" + +--- +```ts +type HttpStatusCodesEntry: HttpStatusCodeRange | number | "*"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpVerb.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpVerb.md new file mode 100644 index 0000000000..e8c878b690 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/HttpVerb.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] HttpVerb" + +--- +```ts +type HttpVerb: + | "get" + | "put" + | "post" + | "patch" + | "delete" + | "head"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OAuth2Flow.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OAuth2Flow.md new file mode 100644 index 0000000000..5d4664957e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OAuth2Flow.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] OAuth2Flow" + +--- +```ts +type OAuth2Flow: AuthorizationCodeFlow | ImplicitFlow | PasswordFlow | ClientCredentialsFlow; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OAuth2FlowType.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OAuth2FlowType.md new file mode 100644 index 0000000000..599818333a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OAuth2FlowType.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] OAuth2FlowType" + +--- +```ts +type OAuth2FlowType: OAuth2Flow["type"]; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OperationContainer.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OperationContainer.md new file mode 100644 index 0000000000..b349f604c9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OperationContainer.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] OperationContainer" + +--- +```ts +type OperationContainer: Namespace | Interface; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OperationDetails.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OperationDetails.md new file mode 100644 index 0000000000..43a0fed1f2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OperationDetails.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] OperationDetails" + +--- +```ts +type OperationDetails: HttpOperation; +``` + +## Deprecated + +use `HttpOperation`. To remove in November 2022 release. diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OperationVerbSelector.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OperationVerbSelector.md new file mode 100644 index 0000000000..d8815ecd75 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/OperationVerbSelector.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] OperationVerbSelector" + +--- +```ts +type OperationVerbSelector: (program, operation) => HttpVerb | undefined; +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/RouteProducer.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/RouteProducer.md new file mode 100644 index 0000000000..336a0c4b25 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/RouteProducer.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[T] RouteProducer" + +--- +```ts +type RouteProducer: (program, operation, parentSegments, overloadBase, options) => DiagnosticResult; +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | +| `parentSegments` | `string`[] | +| `overloadBase` | [`HttpOperation`](../interfaces/HttpOperation.md) \| `undefined` | +| `options` | [`RouteOptions`](../interfaces/RouteOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/StatusCode.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/StatusCode.md new file mode 100644 index 0000000000..a51f7c07c0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/type-aliases/StatusCode.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] StatusCode" + +--- +```ts +type StatusCode: \${number}\ | "*"; +``` + +## Deprecated + +Use `HttpStatusCodesEntry` instead. diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/variables/$lib.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/variables/$lib.md new file mode 100644 index 0000000000..3da9627f33 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/variables/$lib.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] $lib" + +--- +```ts +const $lib: TypeSpecLibrary>; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..7b486f6f90 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/http/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.Http" = "TypeSpec.Http"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/data-types.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/data-types.md new file mode 100644 index 0000000000..e07738cf02 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/data-types.md @@ -0,0 +1,32 @@ +--- +title: "Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Data types + +## TypeSpec.JsonSchema + +### `Json` {#TypeSpec.JsonSchema.Json} + +Specify that the provided template argument should be emitted as raw JSON or YAML +as opposed to a schema. Use in combination with the + +```typespec +model TypeSpec.JsonSchema.Json +``` + +#### Template Parameters + +| Name | Description | +| ---- | ------------------------------- | +| T | the type to convert to raw JSON | + +### `Format` {#TypeSpec.JsonSchema.Format} + +Well-known JSON Schema formats. + +```typespec +enum TypeSpec.JsonSchema.Format +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/decorators.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/decorators.md new file mode 100644 index 0000000000..d039d2027f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/decorators.md @@ -0,0 +1,293 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.JsonSchema + +### `@baseUri` {#@TypeSpec.JsonSchema.baseUri} + +Set the base URI for any schemas emitted from types within this namespace. + +```typespec +@TypeSpec.JsonSchema.baseUri(baseUri: valueof string) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| ------- | ----------------------- | ------------------------------------------------------------------------ | +| baseUri | `valueof scalar string` | the base URI. Schema IDs inside this namespace are relative to this URI. | + +### `@contains` {#@TypeSpec.JsonSchema.contains} + +Specify that the array must contain at least one instance of the provided type. +Use `@minContains` and `@maxContains` to customize how many instances to expect. + +```typespec +@TypeSpec.JsonSchema.contains(value: unknown) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | --------------------- | -------------------------------- | +| value | `(intrinsic) unknown` | The type the array must contain. | + +### `@contentEncoding` {#@TypeSpec.JsonSchema.contentEncoding} + +Specify the encoding used for the contents of a string. + +```typespec +@TypeSpec.JsonSchema.contentEncoding(value: valueof string) +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------------- | ----------- | +| value | `valueof scalar string` |
| + +### `@contentMediaType` {#@TypeSpec.JsonSchema.contentMediaType} + +Specify the content type of content stored in a string. + +```typespec +@TypeSpec.JsonSchema.contentMediaType(value: valueof string) +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------------- | ------------------------------------- | +| value | `valueof scalar string` | the media type of the string contents | + +### `@contentSchema` {#@TypeSpec.JsonSchema.contentSchema} + +Specify the schema for the contents of a string when interpreted according to the content's +media type and encoding. + +```typespec +@TypeSpec.JsonSchema.contentSchema(value: unknown) +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | --------------------- | --------------------------------- | +| value | `(intrinsic) unknown` | the schema of the string contents | + +### `@extension` {#@TypeSpec.JsonSchema.extension} + +Specify a custom property to add to the emitted schema. Useful for adding custom keywords +and other vendor-specific extensions. The value will be converted to a schema unless the parameter +is wrapped in the `Json` template. For example, `@extension("x-schema", { x: "value" })` will +emit a JSON schema value for `x-schema`, whereas `@extension("x-schema", Json<{x: "value"}>)` will +emit the raw JSON code `{x: "value"}`. + +```typespec +@TypeSpec.JsonSchema.extension(key: valueof string, value: unknown) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------------- | ------------------------------------------------------------------------------------ | +| key | `valueof scalar string` | the name of the keyword of vendor extension, e.g. `x-custom`. | +| value | `(intrinsic) unknown` | the value of the keyword. Will be converted to a schema unless wrapped in `Json`. | + +### `@id` {#@TypeSpec.JsonSchema.id} + +Specify the JSON Schema id. If this model or a parent namespace has a base URI, +the provided ID will be relative to that base URI. + +By default, the id will be constructed based on the declaration's name. + +```typespec +@TypeSpec.JsonSchema.id(id: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ---- | ----------------------- | ----------------------------------------------- | +| id | `valueof scalar string` | the id of the JSON schema for this declaration. | + +### `@jsonSchema` {#@TypeSpec.JsonSchema.jsonSchema} + +Add to namespaces to emit models within that namespace to JSON schema. +Add to another declaration to emit that declaration to JSON schema. + +Optionally, for namespaces, you can provide a baseUri, and for other declarations, +you can provide the id. + +```typespec +@TypeSpec.JsonSchema.jsonSchema(baseUri?: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | ----------------------- | --------------------------------------------------- | +| baseUri | `valueof scalar string` | Schema IDs are interpreted as relative to this URI. | + +### `@maxContains` {#@TypeSpec.JsonSchema.maxContains} + +Specify that the array must contain at most some number of the types provided +by the contains decorator. + +```typespec +@TypeSpec.JsonSchema.maxContains(value: valueof int32) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ---------------------- | ------------------------------------------------------ | +| value | `valueof scalar int32` | The maximum number of instances the array must contain | + +### `@maxProperties` {#@TypeSpec.JsonSchema.maxProperties} + +Specify the maximum number of properties this object can have. + +```typespec +@TypeSpec.JsonSchema.maxProperties(value: valueof int32) +``` + +#### Target + +`union Record | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ---------------------- | ------------------------------------------------------ | +| value | `valueof scalar int32` | The maximum number of properties this object can have. | + +### `@minContains` {#@TypeSpec.JsonSchema.minContains} + +Specify that the array must contain at least some number of the types provided +by the contains decorator. + +```typespec +@TypeSpec.JsonSchema.minContains(value: valueof int32) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ---------------------- | ------------------------------------------------------ | +| value | `valueof scalar int32` | The minimum number of instances the array must contain | + +### `@minProperties` {#@TypeSpec.JsonSchema.minProperties} + +Specify the minimum number of properties this object can have. + +```typespec +@TypeSpec.JsonSchema.minProperties(value: valueof int32) +``` + +#### Target + +`union Record | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ---------------------- | ------------------------------------------------------ | +| value | `valueof scalar int32` | The minimum number of properties this object can have. | + +### `@multipleOf` {#@TypeSpec.JsonSchema.multipleOf} + +Specify that the numeric type must be a multiple of some numeric value. + +```typespec +@TypeSpec.JsonSchema.multipleOf(value: valueof numeric) +``` + +#### Target + +`union numeric | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ------------------------ | -------------------------------------------------- | +| value | `valueof scalar numeric` | The numeric type must be a multiple of this value. | + +### `@prefixItems` {#@TypeSpec.JsonSchema.prefixItems} + +Specify that the target array must begin with the provided types. + +```typespec +@TypeSpec.JsonSchema.prefixItems(value: unknown[]) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------- | --------------------------------------------------------------------------- | +| value | `model unknown[]` | a tuple containing the types that must be present at the start of the array | + +### `@uniqueItems` {#@TypeSpec.JsonSchema.uniqueItems} + +Specify that every item in the array must be unique. + +```typespec +@TypeSpec.JsonSchema.uniqueItems +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters + +None diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/emitter.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/emitter.md new file mode 100644 index 0000000000..a9d77988db --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/emitter.md @@ -0,0 +1,57 @@ +--- +title: "Emitter usage" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Emitter + +## Usage + +1. Via the command line + +```bash +tsp compile . --emit=@typespec/json-schema +``` + +2. Via the config + +```yaml +emit: + - "@typespec/json-schema" +``` + +## Emitter options + +### `file-type` + +**Type:** `"yaml" | "json"` + +Serialize the schema as either yaml or json. + +### `int64-strategy` + +**Type:** `"string" | "number"` + +How to handle 64 bit integers on the wire. Options are: + +- string: serialize as a string (widely interoperable) +- number: serialize as a number (not widely interoperable) + +### `bundleId` + +**Type:** `string` + +When provided, bundle all the schemas into a single json schema document with schemas under $defs. The provided id is the id of the root document and is also used for the file name. + +### `emitAllModels` + +**Type:** `boolean` + +When true, emit all model declarations to JSON Schema without requiring the @jsonSchema decorator. + +### `emitAllRefs` + +**Type:** `boolean` + +When true, emit all references as json schema files, even if the referenced type does not have the `@jsonSchema` decorator or is not within a namespace with the `@jsonSchema` decorator. diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/index.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/index.md new file mode 100644 index 0000000000..bbc10f06d4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/index.md @@ -0,0 +1,60 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec library for emitting TypeSpec to JSON Schema and converting JSON Schema to TypeSpec + +## Install + + + + +```bash +npm install @typespec/json-schema +``` + + + + +```bash +npm install --save-peer @typespec/json-schema +``` + + + + +## Emitter usage + +[See documentation](./emitter.md) + +## TypeSpec.JsonSchema + +### Decorators + +- [`@baseUri`](./decorators.md#@TypeSpec.JsonSchema.baseUri) +- [`@contains`](./decorators.md#@TypeSpec.JsonSchema.contains) +- [`@contentEncoding`](./decorators.md#@TypeSpec.JsonSchema.contentEncoding) +- [`@contentMediaType`](./decorators.md#@TypeSpec.JsonSchema.contentMediaType) +- [`@contentSchema`](./decorators.md#@TypeSpec.JsonSchema.contentSchema) +- [`@extension`](./decorators.md#@TypeSpec.JsonSchema.extension) +- [`@id`](./decorators.md#@TypeSpec.JsonSchema.id) +- [`@jsonSchema`](./decorators.md#@TypeSpec.JsonSchema.jsonSchema) +- [`@maxContains`](./decorators.md#@TypeSpec.JsonSchema.maxContains) +- [`@maxProperties`](./decorators.md#@TypeSpec.JsonSchema.maxProperties) +- [`@minContains`](./decorators.md#@TypeSpec.JsonSchema.minContains) +- [`@minProperties`](./decorators.md#@TypeSpec.JsonSchema.minProperties) +- [`@multipleOf`](./decorators.md#@TypeSpec.JsonSchema.multipleOf) +- [`@prefixItems`](./decorators.md#@TypeSpec.JsonSchema.prefixItems) +- [`@uniqueItems`](./decorators.md#@TypeSpec.JsonSchema.uniqueItems) + +### Models + +- [`Json`](./data-types.md#TypeSpec.JsonSchema.Json) diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/classes/JsonSchemaEmitter.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/classes/JsonSchemaEmitter.md new file mode 100644 index 0000000000..34e4a1e707 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/classes/JsonSchemaEmitter.md @@ -0,0 +1,1789 @@ +--- +jsApi: true +title: "[C] JsonSchemaEmitter" + +--- +## Extends + +- `TypeEmitter`<`Record`<`string`, `any`\>, [`JSONSchemaEmitterOptions`](../interfaces/JSONSchemaEmitterOptions.md)\> + +## Constructors + +### new JsonSchemaEmitter(emitter) + +```ts +new JsonSchemaEmitter(emitter): JsonSchemaEmitter +``` + +Constructs a TypeEmitter. Do not use this constructor directly, instead +call `createAssetEmitter` on the emitter context object. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `emitter` | `AssetEmitter`<`Record`<`string`, `any`\>, [`JSONSchemaEmitterOptions`](../interfaces/JSONSchemaEmitterOptions.md)\> | The asset emitter | + +#### Inherited from + +TypeEmitter, JSONSchemaEmitterOptions\>.constructor + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `private` | `#refToDecl` | `Map`<`string`, `Declaration`<`Record`<`string`, `unknown`\>\>\> | - | - | +| `private` | `#seenIds` | `Set`<`unknown`\> | - | - | +| `private` | `#typeForSourceFile` | `Map`<`SourceFile`<`any`\>, [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md)\> | - | - | +| `public` | `emitter` | `AssetEmitter`<`Record`<`string`, `any`\>, [`JSONSchemaEmitterOptions`](../interfaces/JSONSchemaEmitterOptions.md)\> | - | TypeEmitter.emitter | + +## Methods + +### #applyConstraints() + +```ts +private #applyConstraints(type, schema): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | \| `Model` \| `ModelProperty` \| `Scalar` \| `Enum` \| `Union` | +| `schema` | `ObjectBuilder`<`unknown`\> | + +*** + +### #checkForDuplicateId() + +```ts +private #checkForDuplicateId(id): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `id` | `string` | + +*** + +### #createDeclaration() + +```ts +private #createDeclaration( + type, + name, +schema): Declaration> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | +| `name` | `string` | +| `schema` | `ObjectBuilder`<`unknown`\> | + +*** + +### #fileExtension() + +```ts +private #fileExtension(): "json" | "yaml" +``` + +*** + +### #getCurrentSourceFile() + +```ts +private #getCurrentSourceFile(): SourceFile +``` + +*** + +### #getDeclId() + +```ts +private #getDeclId(type, name): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | +| `name` | `string` | + +*** + +### #isStdType() + +```ts +private #isStdType(type): boolean +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `Type` | + +*** + +### #newFileScope() + +```ts +private #newFileScope(type): object +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | + +#### Returns + +> | Member | Type | Description | +> | :------ | :------ | :------ | +> | `scope` | `Scope`<`Record`<`string`, `any`\>\> | - | +> + +*** + +### #requiredModelProperties() + +```ts +private #requiredModelProperties(model): undefined | string[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | + +*** + +### #scalarBuiltinBaseType() + +```ts +private #scalarBuiltinBaseType(scalar): null | Scalar +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `scalar` | `Scalar` | + +*** + +### arrayDeclaration() + +```ts +arrayDeclaration( + array, + name, +elementType): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | +| `name` | `string` | +| `elementType` | `Type` | + +#### Overrides + +TypeEmitter.arrayDeclaration + +*** + +### arrayDeclarationContext() + +```ts +arrayDeclarationContext(array): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | + +#### Overrides + +TypeEmitter.arrayDeclarationContext + +*** + +### arrayDeclarationReferenceContext() + +```ts +arrayDeclarationReferenceContext( + array, + name, + elementType): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | +| `name` | `string` | +| `elementType` | `Type` | + +#### Inherited from + +TypeEmitter.arrayDeclarationReferenceContext + +*** + +### arrayLiteral() + +```ts +arrayLiteral(array, elementType): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | +| `elementType` | `Type` | + +#### Overrides + +TypeEmitter.arrayLiteral + +*** + +### arrayLiteralContext() + +```ts +arrayLiteralContext(array, elementType): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | +| `elementType` | `Type` | + +#### Inherited from + +TypeEmitter.arrayLiteralContext + +*** + +### arrayLiteralReferenceContext() + +```ts +arrayLiteralReferenceContext(array, elementType): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | +| `elementType` | `Type` | + +#### Inherited from + +TypeEmitter.arrayLiteralReferenceContext + +*** + +### booleanLiteral() + +```ts +booleanLiteral(boolean): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `boolean` | `BooleanLiteral` | + +#### Overrides + +TypeEmitter.booleanLiteral + +*** + +### booleanLiteralContext() + +```ts +booleanLiteralContext(boolean): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `boolean` | `BooleanLiteral` | + +#### Inherited from + +TypeEmitter.booleanLiteralContext + +*** + +### declarationName() + +```ts +declarationName(declarationType): undefined | string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `declarationType` | `TypeSpecDeclaration` | + +#### Inherited from + +TypeEmitter.declarationName + +*** + +### enumDeclaration() + +```ts +enumDeclaration(en, name): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `en` | `Enum` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.enumDeclaration + +*** + +### enumDeclarationContext() + +```ts +enumDeclarationContext(en): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `en` | `Enum` | + +#### Overrides + +TypeEmitter.enumDeclarationContext + +*** + +### enumMember() + +```ts +enumMember(member): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `member` | `EnumMember` | + +#### Inherited from + +TypeEmitter.enumMember + +*** + +### enumMemberContext() + +```ts +enumMemberContext(member): object +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `member` | `EnumMember` | + +#### Inherited from + +TypeEmitter.enumMemberContext + +*** + +### enumMemberReference() + +```ts +enumMemberReference(member): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `member` | `EnumMember` | + +#### Overrides + +TypeEmitter.enumMemberReference + +*** + +### enumMembers() + +```ts +enumMembers(en): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `en` | `Enum` | + +#### Inherited from + +TypeEmitter.enumMembers + +*** + +### enumMembersContext() + +```ts +enumMembersContext(en): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `en` | `Enum` | + +#### Inherited from + +TypeEmitter.enumMembersContext + +*** + +### interfaceDeclaration() + +```ts +interfaceDeclaration(iface, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceDeclaration + +*** + +### interfaceDeclarationContext() + +```ts +interfaceDeclarationContext(iface, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceDeclarationContext + +*** + +### interfaceDeclarationOperations() + +```ts +interfaceDeclarationOperations(iface): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | + +#### Inherited from + +TypeEmitter.interfaceDeclarationOperations + +*** + +### interfaceDeclarationOperationsContext() + +```ts +interfaceDeclarationOperationsContext(iface): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | + +#### Inherited from + +TypeEmitter.interfaceDeclarationOperationsContext + +*** + +### interfaceDeclarationOperationsReferenceContext() + +```ts +interfaceDeclarationOperationsReferenceContext(iface): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | + +#### Inherited from + +TypeEmitter.interfaceDeclarationOperationsReferenceContext + +*** + +### interfaceDeclarationReferenceContext() + +```ts +interfaceDeclarationReferenceContext(iface, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceDeclarationReferenceContext + +*** + +### interfaceOperationDeclaration() + +```ts +interfaceOperationDeclaration(operation, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceOperationDeclaration + +*** + +### interfaceOperationDeclarationContext() + +```ts +interfaceOperationDeclarationContext(operation, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceOperationDeclarationContext + +*** + +### interfaceOperationDeclarationReferenceContext() + +```ts +interfaceOperationDeclarationReferenceContext(operation, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceOperationDeclarationReferenceContext + +*** + +### intrinsic() + +```ts +intrinsic(intrinsic, name): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `intrinsic` | `IntrinsicType` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.intrinsic + +*** + +### intrinsicContext() + +```ts +intrinsicContext(intrinsic, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `intrinsic` | `IntrinsicType` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.intrinsicContext + +*** + +### modelDeclaration() + +```ts +modelDeclaration(model, name): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.modelDeclaration + +*** + +### modelDeclarationContext() + +```ts +modelDeclarationContext(model, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.modelDeclarationContext + +*** + +### modelDeclarationReferenceContext() + +```ts +modelDeclarationReferenceContext(model, name): Context +``` + +Set reference context for a model declaration. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `model` | `Model` | | +| `name` | `string` | - | + +#### Inherited from + +TypeEmitter.modelDeclarationReferenceContext + +*** + +### modelInstantiation() + +```ts +modelInstantiation(model, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | +| `name` | `undefined` \| `string` | + +#### Overrides + +TypeEmitter.modelInstantiation + +*** + +### modelInstantiationContext() + +```ts +modelInstantiationContext(model, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | +| `name` | `undefined` \| `string` | + +#### Overrides + +TypeEmitter.modelInstantiationContext + +*** + +### modelInstantiationReferenceContext() + +```ts +modelInstantiationReferenceContext(model, name): Context +``` + +Set reference context for a model declaration. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `model` | `Model` | | +| `name` | `undefined` \| `string` | - | + +#### Inherited from + +TypeEmitter.modelInstantiationReferenceContext + +*** + +### modelLiteral() + +```ts +modelLiteral(model): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | + +#### Overrides + +TypeEmitter.modelLiteral + +*** + +### modelLiteralContext() + +```ts +modelLiteralContext(model): Context +``` + +Set lexical context for a model literal. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `model` | `Model` | | + +#### Inherited from + +TypeEmitter.modelLiteralContext + +*** + +### modelLiteralReferenceContext() + +```ts +modelLiteralReferenceContext(model): Context +``` + +Set reference context for a model literal. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `model` | `Model` | | + +#### Inherited from + +TypeEmitter.modelLiteralReferenceContext + +*** + +### modelProperties() + +```ts +modelProperties(model): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | + +#### Overrides + +TypeEmitter.modelProperties + +*** + +### modelPropertiesContext() + +```ts +modelPropertiesContext(model): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | + +#### Inherited from + +TypeEmitter.modelPropertiesContext + +*** + +### modelPropertiesReferenceContext() + +```ts +modelPropertiesReferenceContext(model): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | + +#### Inherited from + +TypeEmitter.modelPropertiesReferenceContext + +*** + +### modelPropertyLiteral() + +```ts +modelPropertyLiteral(property): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | `ModelProperty` | + +#### Overrides + +TypeEmitter.modelPropertyLiteral + +*** + +### modelPropertyLiteralContext() + +```ts +modelPropertyLiteralContext(property): Context +``` + +Set lexical context for a property of a model. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `property` | `ModelProperty` | | + +#### Inherited from + +TypeEmitter.modelPropertyLiteralContext + +*** + +### modelPropertyLiteralReferenceContext() + +```ts +modelPropertyLiteralReferenceContext(property): Context +``` + +Set reference context for a property of a model. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `property` | `ModelProperty` | | + +#### Inherited from + +TypeEmitter.modelPropertyLiteralReferenceContext + +*** + +### modelPropertyReference() + +```ts +modelPropertyReference(property): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | `ModelProperty` | + +#### Overrides + +TypeEmitter.modelPropertyReference + +*** + +### namespace() + +```ts +namespace(namespace): EmitterOutput> +``` + +Emit a namespace + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `namespace` | `Namespace` | | + +#### Returns + +Emitter output + +#### Inherited from + +TypeEmitter.namespace + +*** + +### namespaceContext() + +```ts +namespaceContext(namespace): Context +``` + +Set lexical context for a namespace + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `namespace` | `Namespace` | | + +#### Inherited from + +TypeEmitter.namespaceContext + +*** + +### namespaceReferenceContext() + +```ts +namespaceReferenceContext(namespace): Context +``` + +Set reference context for a namespace. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `namespace` | `Namespace` | | + +#### Inherited from + +TypeEmitter.namespaceReferenceContext + +*** + +### numericLiteral() + +```ts +numericLiteral(number): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `number` | `NumericLiteral` | + +#### Overrides + +TypeEmitter.numericLiteral + +*** + +### numericLiteralContext() + +```ts +numericLiteralContext(number): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `number` | `NumericLiteral` | + +#### Inherited from + +TypeEmitter.numericLiteralContext + +*** + +### operationDeclaration() + +```ts +operationDeclaration(operation, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.operationDeclaration + +*** + +### operationDeclarationContext() + +```ts +operationDeclarationContext(operation, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.operationDeclarationContext + +*** + +### operationDeclarationReferenceContext() + +```ts +operationDeclarationReferenceContext(operation, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.operationDeclarationReferenceContext + +*** + +### operationParameters() + +```ts +operationParameters(operation, parameters): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `parameters` | `Model` | + +#### Inherited from + +TypeEmitter.operationParameters + +*** + +### operationParametersContext() + +```ts +operationParametersContext(operation, parameters): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `parameters` | `Model` | + +#### Inherited from + +TypeEmitter.operationParametersContext + +*** + +### operationParametersReferenceContext() + +```ts +operationParametersReferenceContext(operation, parameters): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `parameters` | `Model` | + +#### Inherited from + +TypeEmitter.operationParametersReferenceContext + +*** + +### operationReturnType() + +```ts +operationReturnType(operation, returnType): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `returnType` | `Type` | + +#### Inherited from + +TypeEmitter.operationReturnType + +*** + +### operationReturnTypeContext() + +```ts +operationReturnTypeContext(operation, returnType): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `returnType` | `Type` | + +#### Inherited from + +TypeEmitter.operationReturnTypeContext + +*** + +### operationReturnTypeReferenceContext() + +```ts +operationReturnTypeReferenceContext(operation, returnType): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `returnType` | `Type` | + +#### Inherited from + +TypeEmitter.operationReturnTypeReferenceContext + +*** + +### programContext() + +```ts +programContext(program): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | + +#### Overrides + +TypeEmitter.programContext + +*** + +### reference() + +```ts +reference( + targetDeclaration, + pathUp, + pathDown, +commonScope): object | EmitEntity> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `targetDeclaration` | `Declaration`<`Record`<`string`, `unknown`\>\> | +| `pathUp` | `Scope`<`Record`<`string`, `unknown`\>\>[] | +| `pathDown` | `Scope`<`Record`<`string`, `unknown`\>\>[] | +| `commonScope` | `null` \| `Scope`<`Record`<`string`, `unknown`\>\> | + +#### Overrides + +TypeEmitter.reference + +*** + +### scalarDeclaration() + +```ts +scalarDeclaration(scalar, name): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `scalar` | `Scalar` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.scalarDeclaration + +*** + +### scalarDeclarationContext() + +```ts +scalarDeclarationContext(scalar): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `scalar` | `Scalar` | + +#### Overrides + +TypeEmitter.scalarDeclarationContext + +*** + +### scalarInstantiation() + +```ts +scalarInstantiation(scalar, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `scalar` | `Scalar` | +| `name` | `undefined` \| `string` | + +#### Inherited from + +TypeEmitter.scalarInstantiation + +*** + +### scalarInstantiationContext() + +```ts +scalarInstantiationContext(scalar, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `scalar` | `Scalar` | +| `name` | `undefined` \| `string` | + +#### Inherited from + +TypeEmitter.scalarInstantiationContext + +*** + +### sourceFile() + +```ts +sourceFile(sourceFile): EmittedSourceFile +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `sourceFile` | `SourceFile`<`object`\> | + +#### Overrides + +TypeEmitter.sourceFile + +*** + +### stringLiteral() + +```ts +stringLiteral(string): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `string` | `StringLiteral` | + +#### Overrides + +TypeEmitter.stringLiteral + +*** + +### stringLiteralContext() + +```ts +stringLiteralContext(string): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `string` | `StringLiteral` | + +#### Inherited from + +TypeEmitter.stringLiteralContext + +*** + +### tupleLiteral() + +```ts +tupleLiteral(tuple): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `tuple` | `Tuple` | + +#### Inherited from + +TypeEmitter.tupleLiteral + +*** + +### tupleLiteralContext() + +```ts +tupleLiteralContext(tuple): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `tuple` | `Tuple` | + +#### Inherited from + +TypeEmitter.tupleLiteralContext + +*** + +### tupleLiteralReferenceContext() + +```ts +tupleLiteralReferenceContext(tuple): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `tuple` | `Tuple` | + +#### Inherited from + +TypeEmitter.tupleLiteralReferenceContext + +*** + +### tupleLiteralValues() + +```ts +tupleLiteralValues(tuple): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `tuple` | `Tuple` | + +#### Inherited from + +TypeEmitter.tupleLiteralValues + +*** + +### unionDeclaration() + +```ts +unionDeclaration(union, name): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.unionDeclaration + +*** + +### unionDeclarationContext() + +```ts +unionDeclarationContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Overrides + +TypeEmitter.unionDeclarationContext + +*** + +### unionDeclarationReferenceContext() + +```ts +unionDeclarationReferenceContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Inherited from + +TypeEmitter.unionDeclarationReferenceContext + +*** + +### unionInstantiation() + +```ts +unionInstantiation(union, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.unionInstantiation + +*** + +### unionInstantiationContext() + +```ts +unionInstantiationContext(union, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.unionInstantiationContext + +*** + +### unionInstantiationReferenceContext() + +```ts +unionInstantiationReferenceContext(union, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.unionInstantiationReferenceContext + +*** + +### unionLiteral() + +```ts +unionLiteral(union): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Overrides + +TypeEmitter.unionLiteral + +*** + +### unionLiteralContext() + +```ts +unionLiteralContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Inherited from + +TypeEmitter.unionLiteralContext + +*** + +### unionLiteralReferenceContext() + +```ts +unionLiteralReferenceContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Inherited from + +TypeEmitter.unionLiteralReferenceContext + +*** + +### unionVariant() + +```ts +unionVariant(variant): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `variant` | `UnionVariant` | + +#### Overrides + +TypeEmitter.unionVariant + +*** + +### unionVariantContext() + +```ts +unionVariantContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Inherited from + +TypeEmitter.unionVariantContext + +*** + +### unionVariantReferenceContext() + +```ts +unionVariantReferenceContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Inherited from + +TypeEmitter.unionVariantReferenceContext + +*** + +### unionVariants() + +```ts +unionVariants(union): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Overrides + +TypeEmitter.unionVariants + +*** + +### unionVariantsContext() + +```ts +unionVariantsContext(): Context +``` + +#### Inherited from + +TypeEmitter.unionVariantsContext + +*** + +### unionVariantsReferenceContext() + +```ts +unionVariantsReferenceContext(): Context +``` + +#### Inherited from + +TypeEmitter.unionVariantsReferenceContext + +*** + +### writeOutput() + +```ts +writeOutput(sourceFiles): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `sourceFiles` | `SourceFile`<`Record`<`string`, `any`\>\>[] | + +#### Overrides + +TypeEmitter.writeOutput diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$baseUri.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$baseUri.md new file mode 100644 index 0000000000..4fb6ee2ccd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$baseUri.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $baseUri" + +--- +```ts +$baseUri( + context, + target, + baseUri): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Namespace` | +| `baseUri` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contains.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contains.md new file mode 100644 index 0000000000..77d35d5d4e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contains.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $contains" + +--- +```ts +$contains( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contentEncoding.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contentEncoding.md new file mode 100644 index 0000000000..2dcef7681d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contentEncoding.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $contentEncoding" + +--- +```ts +$contentEncoding( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `StringLiteral` \| `ModelProperty` | +| `value` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contentMediaType.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contentMediaType.md new file mode 100644 index 0000000000..efdd8b2caf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contentMediaType.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $contentMediaType" + +--- +```ts +$contentMediaType( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `StringLiteral` \| `ModelProperty` | +| `value` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contentSchema.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contentSchema.md new file mode 100644 index 0000000000..e0ea17ecb7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$contentSchema.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $contentSchema" + +--- +```ts +$contentSchema( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `StringLiteral` \| `ModelProperty` | +| `value` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$extension.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$extension.md new file mode 100644 index 0000000000..62fa25355f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$extension.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $extension" + +--- +```ts +$extension( + context, + target, + key, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Type` | +| `key` | `string` | +| `value` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$id.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$id.md new file mode 100644 index 0000000000..a9a22c68e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$id.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $id" + +--- +```ts +$id( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `Scalar` \| `Enum` \| `Union` | +| `value` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$jsonSchema.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$jsonSchema.md new file mode 100644 index 0000000000..d71d8272f1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$jsonSchema.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $jsonSchema" + +--- +```ts +$jsonSchema( + context, + target, + baseUriOrId?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Namespace` \| [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | +| `baseUriOrId`? | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$maxContains.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$maxContains.md new file mode 100644 index 0000000000..b6433ac379 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$maxContains.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxContains" + +--- +```ts +$maxContains( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$maxProperties.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$maxProperties.md new file mode 100644 index 0000000000..3797b6ed0a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$maxProperties.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxProperties" + +--- +```ts +$maxProperties( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$minContains.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$minContains.md new file mode 100644 index 0000000000..aa8d6c5779 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$minContains.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minContains" + +--- +```ts +$minContains( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$minProperties.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$minProperties.md new file mode 100644 index 0000000000..7220726f9e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$minProperties.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minProperties" + +--- +```ts +$minProperties( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$multipleOf.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$multipleOf.md new file mode 100644 index 0000000000..29df2c371b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$multipleOf.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $multipleOf" + +--- +```ts +$multipleOf( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` | +| `value` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$onEmit.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$onEmit.md new file mode 100644 index 0000000000..c8d2de9fb2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$onEmit.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] $onEmit" + +--- +```ts +$onEmit(context): Promise +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `EmitContext`<[`JSONSchemaEmitterOptions`](../interfaces/JSONSchemaEmitterOptions.md)\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$prefixItems.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$prefixItems.md new file mode 100644 index 0000000000..efe0c3c814 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$prefixItems.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $prefixItems" + +--- +```ts +$prefixItems( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `Tuple` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$uniqueItems.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$uniqueItems.md new file mode 100644 index 0000000000..d1e815ecfc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$uniqueItems.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $uniqueItems" + +--- +```ts +$uniqueItems(context, target): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$validatesRawJson.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$validatesRawJson.md new file mode 100644 index 0000000000..2b38c02950 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/$validatesRawJson.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $validatesRawJson" + +--- +```ts +$validatesRawJson( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` | +| `value` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/findBaseUri.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/findBaseUri.md new file mode 100644 index 0000000000..8278960d03 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/findBaseUri.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] findBaseUri" + +--- +```ts +findBaseUri(program, target): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Namespace` \| [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getBaseUri.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getBaseUri.md new file mode 100644 index 0000000000..dd83a9c6c9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getBaseUri.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getBaseUri" + +--- +```ts +getBaseUri(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContains.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContains.md new file mode 100644 index 0000000000..17ffcc61ec --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContains.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getContains" + +--- +```ts +getContains(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContentEncoding.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContentEncoding.md new file mode 100644 index 0000000000..efff65e2a2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContentEncoding.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getContentEncoding" + +--- +```ts +getContentEncoding(program, target): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContentMediaType.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContentMediaType.md new file mode 100644 index 0000000000..774f13f7bf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContentMediaType.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getContentMediaType" + +--- +```ts +getContentMediaType(program, target): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContentSchema.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContentSchema.md new file mode 100644 index 0000000000..2ed8dd9350 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getContentSchema.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getContentSchema" + +--- +```ts +getContentSchema(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getExtensions.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getExtensions.md new file mode 100644 index 0000000000..d254dde711 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getExtensions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getExtensions" + +--- +```ts +getExtensions(program, target): ExtensionRecord[] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getId.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getId.md new file mode 100644 index 0000000000..468b2321a9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getId.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getId" + +--- +```ts +getId(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getJsonSchema.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getJsonSchema.md new file mode 100644 index 0000000000..39392a1288 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getJsonSchema.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getJsonSchema" + +--- +```ts +getJsonSchema(program, target): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getJsonSchemaTypes.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getJsonSchemaTypes.md new file mode 100644 index 0000000000..6dc439ba2f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getJsonSchemaTypes.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] getJsonSchemaTypes" + +--- +```ts +getJsonSchemaTypes(program): (Namespace | Model)[] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMaxContains.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMaxContains.md new file mode 100644 index 0000000000..1bd1d037a9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMaxContains.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxContains" + +--- +```ts +getMaxContains(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMaxProperties.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMaxProperties.md new file mode 100644 index 0000000000..b7fadc390d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMaxProperties.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxProperties" + +--- +```ts +getMaxProperties(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMinContains.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMinContains.md new file mode 100644 index 0000000000..44059475b4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMinContains.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinContains" + +--- +```ts +getMinContains(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMinProperties.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMinProperties.md new file mode 100644 index 0000000000..5ab738c867 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMinProperties.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinProperties" + +--- +```ts +getMinProperties(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMultipleOf.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMultipleOf.md new file mode 100644 index 0000000000..f312718da3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getMultipleOf.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMultipleOf" + +--- +```ts +getMultipleOf(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getPrefixItems.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getPrefixItems.md new file mode 100644 index 0000000000..ea9a32b3d6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getPrefixItems.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getPrefixItems" + +--- +```ts +getPrefixItems(program, target): Tuple | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getUniqueItems.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getUniqueItems.md new file mode 100644 index 0000000000..7a516e1991 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/getUniqueItems.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getUniqueItems" + +--- +```ts +getUniqueItems(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/isJsonSchemaDeclaration.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/isJsonSchemaDeclaration.md new file mode 100644 index 0000000000..8d6cd648bd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/functions/isJsonSchemaDeclaration.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isJsonSchemaDeclaration" + +--- +```ts +isJsonSchemaDeclaration(program, target): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/index.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/index.md new file mode 100644 index 0000000000..4848588ac1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/index.md @@ -0,0 +1,67 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Namespaces + +- [$validatesRawJson](namespaces/$validatesRawJson/index.md) + +### Classes + +- [JsonSchemaEmitter](classes/JsonSchemaEmitter.md) + +### Interfaces + +- [ExtensionRecord](interfaces/ExtensionRecord.md) +- [JSONSchemaEmitterOptions](interfaces/JSONSchemaEmitterOptions.md) + +### Type Aliases + +- [JsonSchemaDeclaration](type-aliases/JsonSchemaDeclaration.md) + +### Variables + +- [$lib](variables/$lib.md) +- [EmitterOptionsSchema](variables/EmitterOptionsSchema.md) +- [namespace](variables/namespace.md) + +### Functions + +- [$baseUri](functions/$baseUri.md) +- [$contains](functions/$contains.md) +- [$contentEncoding](functions/$contentEncoding.md) +- [$contentMediaType](functions/$contentMediaType.md) +- [$contentSchema](functions/$contentSchema.md) +- [$extension](functions/$extension.md) +- [$id](functions/$id.md) +- [$jsonSchema](functions/$jsonSchema.md) +- [$maxContains](functions/$maxContains.md) +- [$maxProperties](functions/$maxProperties.md) +- [$minContains](functions/$minContains.md) +- [$minProperties](functions/$minProperties.md) +- [$multipleOf](functions/$multipleOf.md) +- [$onEmit](functions/$onEmit.md) +- [$prefixItems](functions/$prefixItems.md) +- [$uniqueItems](functions/$uniqueItems.md) +- [$validatesRawJson](functions/$validatesRawJson.md) +- [findBaseUri](functions/findBaseUri.md) +- [getBaseUri](functions/getBaseUri.md) +- [getContains](functions/getContains.md) +- [getContentEncoding](functions/getContentEncoding.md) +- [getContentMediaType](functions/getContentMediaType.md) +- [getContentSchema](functions/getContentSchema.md) +- [getExtensions](functions/getExtensions.md) +- [getId](functions/getId.md) +- [getJsonSchema](functions/getJsonSchema.md) +- [getJsonSchemaTypes](functions/getJsonSchemaTypes.md) +- [getMaxContains](functions/getMaxContains.md) +- [getMaxProperties](functions/getMaxProperties.md) +- [getMinContains](functions/getMinContains.md) +- [getMinProperties](functions/getMinProperties.md) +- [getMultipleOf](functions/getMultipleOf.md) +- [getPrefixItems](functions/getPrefixItems.md) +- [getUniqueItems](functions/getUniqueItems.md) +- [isJsonSchemaDeclaration](functions/isJsonSchemaDeclaration.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/interfaces/ExtensionRecord.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/interfaces/ExtensionRecord.md new file mode 100644 index 0000000000..ab1f993a6e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/interfaces/ExtensionRecord.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ExtensionRecord" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `key` | `string` | - | +| `value` | `Type` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/interfaces/JSONSchemaEmitterOptions.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/interfaces/JSONSchemaEmitterOptions.md new file mode 100644 index 0000000000..2c8423baa5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/interfaces/JSONSchemaEmitterOptions.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] JSONSchemaEmitterOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `bundleId?` | `string` | When provided, bundle all the schemas into a single json schema document
with schemas under $defs. The provided id is the id of the root document
and is also used for the file name. | +| `emitAllModels?` | `boolean` | When true, emit all model declarations to JSON Schema without requiring
the

**Json Schema**

decorator. | +| `emitAllRefs?` | `boolean` | When true, emit all references as json schema files, even if the referenced
type does not have the `@jsonSchema` decorator or is not within a namespace
with the `@jsonSchema` decorator. | +| `file-type?` | `FileType` | Serialize the schema as either yaml or json.

**Default**

yaml, it not specified infer from the `output-file` extension | +| `int64-strategy?` | `Int64Strategy` | How to handle 64 bit integers on the wire. Options are:

* string: serialize as a string (widely interoperable)
* number: serialize as a number (not widely interoperable) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/index.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/index.md new file mode 100644 index 0000000000..9f710c9c49 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/index.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[N] $validatesRawJson" + +--- +## Index + +### Variables + +- [namespace](variables/namespace.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/variables/namespace.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/variables/namespace.md new file mode 100644 index 0000000000..ef9b0531d5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +namespace: string; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/type-aliases/JsonSchemaDeclaration.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/type-aliases/JsonSchemaDeclaration.md new file mode 100644 index 0000000000..7d5536527f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/type-aliases/JsonSchemaDeclaration.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] JsonSchemaDeclaration" + +--- +```ts +type JsonSchemaDeclaration: Model | Union | Enum | Scalar; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/variables/$lib.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/variables/$lib.md new file mode 100644 index 0000000000..5743d59edd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/variables/$lib.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] $lib" + +--- +```ts +const $lib: TypeSpecLibrary; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/variables/EmitterOptionsSchema.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/variables/EmitterOptionsSchema.md new file mode 100644 index 0000000000..7a97c4e8cb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/variables/EmitterOptionsSchema.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] EmitterOptionsSchema" + +--- +```ts +const EmitterOptionsSchema: JSONSchemaType; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..1787cce0cc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/json-schema/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.JsonSchema" = "TypeSpec.JsonSchema"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/data-types.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/data-types.md new file mode 100644 index 0000000000..0a0fd0d0b5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/data-types.md @@ -0,0 +1,33 @@ +--- +title: "Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Data types + +## TypeSpec.OpenAPI + +### `AdditionalInfo` {#TypeSpec.OpenAPI.AdditionalInfo} + +Additional information for the OpenAPI document. + +```typespec +model TypeSpec.OpenAPI.AdditionalInfo +``` + +### `Contact` {#TypeSpec.OpenAPI.Contact} + +Contact information for the exposed API. + +```typespec +model TypeSpec.OpenAPI.Contact +``` + +### `License` {#TypeSpec.OpenAPI.License} + +License information for the exposed API. + +```typespec +model TypeSpec.OpenAPI.License +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/decorators.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/decorators.md new file mode 100644 index 0000000000..44ae2d91da --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/decorators.md @@ -0,0 +1,140 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.OpenAPI + +### `@defaultResponse` {#@TypeSpec.OpenAPI.defaultResponse} + +Specify that this model is to be treated as the OpenAPI `default` response. +This differs from the compiler built-in `@error` decorator as this does not necessarily represent an error. + +```typespec +@TypeSpec.OpenAPI.defaultResponse +``` + +#### Target + +`Model` + +#### Parameters + +None + +#### Examples + +```typespec +@defaultResponse +model PetStoreResponse is object; + +op listPets(): Pet[] | PetStoreResponse; +``` + +### `@extension` {#@TypeSpec.OpenAPI.extension} + +Attach some custom data to the OpenAPI element generated from this type. + +```typespec +@TypeSpec.OpenAPI.extension(key: valueof string, value: unknown) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------------- | ----------------------------------- | +| key | `valueof scalar string` | Extension key. Must start with `x-` | +| value | `(intrinsic) unknown` | Extension value. | + +#### Examples + +```typespec +@extension("x-custom", "My value") +@extension( + "x-pageable", + { + nextLink: "x-next-link", + } +) +op read(): string; +``` + +### `@externalDocs` {#@TypeSpec.OpenAPI.externalDocs} + +Specify the OpenAPI `externalDocs` property for this type. + +```typespec +@TypeSpec.OpenAPI.externalDocs(url: valueof string, description?: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ----------- | ----------------------- | ----------------------- | +| url | `valueof scalar string` | Url to the docs | +| description | `valueof scalar string` | Description of the docs | + +#### Examples + +```typespec +@externalDocs( + "https://example.com/detailed.md", + "Detailed information on how to use this operation" +) +op listPets(): Pet[]; +``` + +### `@info` {#@TypeSpec.OpenAPI.info} + +Specify OpenAPI additional information. +The service `title` and `version` are already specified using `@service`. + +```typespec +@TypeSpec.OpenAPI.info(additionalInfo: TypeSpec.OpenAPI.AdditionalInfo) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| -------------- | --------------------------------------- | ---------------------- | +| additionalInfo | `model TypeSpec.OpenAPI.AdditionalInfo` | Additional information | + +### `@operationId` {#@TypeSpec.OpenAPI.operationId} + +Specify the OpenAPI `operationId` property for this operation. + +```typespec +@TypeSpec.OpenAPI.operationId(operationId: valueof string) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ----------- | ----------------------- | ------------------- | +| operationId | `valueof scalar string` | Operation id value. | + +#### Examples + +```typespec +@operationId("download") +op read(): string; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/index.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/index.md new file mode 100644 index 0000000000..7626cf0bda --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/index.md @@ -0,0 +1,48 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec library providing OpenAPI concepts + +## Install + + + + +```bash +npm install @typespec/openapi +``` + + + + +```bash +npm install --save-peer @typespec/openapi +``` + + + + +## TypeSpec.OpenAPI + +### Decorators + +- [`@defaultResponse`](./decorators.md#@TypeSpec.OpenAPI.defaultResponse) +- [`@extension`](./decorators.md#@TypeSpec.OpenAPI.extension) +- [`@externalDocs`](./decorators.md#@TypeSpec.OpenAPI.externalDocs) +- [`@info`](./decorators.md#@TypeSpec.OpenAPI.info) +- [`@operationId`](./decorators.md#@TypeSpec.OpenAPI.operationId) + +### Models + +- [`AdditionalInfo`](./data-types.md#TypeSpec.OpenAPI.AdditionalInfo) +- [`Contact`](./data-types.md#TypeSpec.OpenAPI.Contact) +- [`License`](./data-types.md#TypeSpec.OpenAPI.License) diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$defaultResponse.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$defaultResponse.md new file mode 100644 index 0000000000..f8a37538b8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$defaultResponse.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $defaultResponse" + +--- +```ts +$defaultResponse(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$extension.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$extension.md new file mode 100644 index 0000000000..8dcc3b8258 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$extension.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $extension" + +--- +```ts +$extension( + context, + entity, + extensionName, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Type` | +| `extensionName` | `string` | +| `value` | `TypeSpecValue` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$externalDocs.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$externalDocs.md new file mode 100644 index 0000000000..68ad6f4ee0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$externalDocs.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] $externalDocs" + +--- +```ts +$externalDocs( + context, + target, + url, + description?): void +``` + +Allows referencing an external resource for extended documentation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | `DecoratorContext` | - | +| `target` | `Type` | - | +| `url` | `string` | The URL for the target documentation. Value MUST be in the format of a URL. | +| `description`? | `string` | - | + +## Returns + +## Optional + +description A short description of the target documentation. diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$info.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$info.md new file mode 100644 index 0000000000..0141b98e84 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$info.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $info" + +--- +```ts +$info( + context, + entity, + model): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Namespace` | +| `model` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$operationId.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$operationId.md new file mode 100644 index 0000000000..30665d8f6b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/$operationId.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $operationId" + +--- +```ts +$operationId( + context, + entity, + opId): void +``` + +Set a specific operation ID. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | `DecoratorContext` | Decorator Context | +| `entity` | `Operation` | Decorator target | +| `opId` | `string` | Operation ID. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/checkDuplicateTypeName.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/checkDuplicateTypeName.md new file mode 100644 index 0000000000..94f42f3be8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/checkDuplicateTypeName.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] checkDuplicateTypeName" + +--- +```ts +checkDuplicateTypeName( + program, + type, + name, + existing): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | +| `name` | `string` | +| `existing` | `undefined` \| `Record`<`string`, `unknown`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getExtensions.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getExtensions.md new file mode 100644 index 0000000000..ea291e3d14 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getExtensions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getExtensions" + +--- +```ts +getExtensions(program, entity): ReadonlyMap +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getExternalDocs.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getExternalDocs.md new file mode 100644 index 0000000000..cbe57a38f1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getExternalDocs.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getExternalDocs" + +--- +```ts +getExternalDocs(program, entity): ExternalDocs | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getInfo.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getInfo.md new file mode 100644 index 0000000000..11cb22187d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getInfo.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getInfo" + +--- +```ts +getInfo(program, entity): AdditionalInfo | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getOpenAPITypeName.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getOpenAPITypeName.md new file mode 100644 index 0000000000..0cd33dcdf5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getOpenAPITypeName.md @@ -0,0 +1,30 @@ +--- +jsApi: true +title: "[F] getOpenAPITypeName" + +--- +```ts +getOpenAPITypeName( + program, + type, + options, + existing?): string +``` + +Gets the name of a type to be used in OpenAPI. + +For inlined types: this is the TypeSpec-native name written to `x-typespec-name`. + +For non-inlined types: this is either the friendly name or the TypeSpec-native name. + +TypeSpec-native names are shortened to exclude root `TypeSpec` namespace and service +namespace using the provided `TypeNameOptions`. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | +| `options` | `TypeNameOptions` | +| `existing`? | `Record`<`string`, `any`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getOperationId.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getOperationId.md new file mode 100644 index 0000000000..296f2bba76 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getOperationId.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getOperationId" + +--- +```ts +getOperationId(program, entity): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Operation` | + +## Returns + +operationId set via the + +## Operation Id + +decorator or `undefined` diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getParameterKey.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getParameterKey.md new file mode 100644 index 0000000000..67521629ca --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/getParameterKey.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] getParameterKey" + +--- +```ts +getParameterKey( + program, + property, + newParam, + existingParams, + options): string +``` + +Gets the key that is used to define a parameter in OpenAPI. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `property` | `ModelProperty` | +| `newParam` | `unknown` | +| `existingParams` | `Record`<`string`, `unknown`\> | +| `options` | `TypeNameOptions` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/isDefaultResponse.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/isDefaultResponse.md new file mode 100644 index 0000000000..0c5f649df4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/isDefaultResponse.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isDefaultResponse" + +--- +```ts +isDefaultResponse(program, entity): boolean +``` + +Check if the given model has been mark as a default response. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | TypeSpec Program | +| `entity` | `Type` | Model to check. | + +## Returns + +boolean. diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/isReadonlyProperty.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/isReadonlyProperty.md new file mode 100644 index 0000000000..64ca698c3d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/isReadonlyProperty.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[F] isReadonlyProperty" + +--- +```ts +isReadonlyProperty(program, property): boolean +``` + +Determines if a property is read-only, which is defined as being +decorated `@visibility("read")`. + +If there is more than 1 `@visibility` argument, then the property is not +read-only. For example, `@visibility("read", "update")` does not +designate a read-only property. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `property` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/resolveOperationId.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/resolveOperationId.md new file mode 100644 index 0000000000..eb42f6d1b2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/resolveOperationId.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[F] resolveOperationId" + +--- +```ts +resolveOperationId(program, operation): string +``` + +Resolve the OpenAPI operation ID for the given operation using the following logic: +- If + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | TypeSpec Program | +| `operation` | `Operation` | Operation | + +## Returns + +Operation ID in this format `` or `_` + +## Operation Id + +was specified use that value +- If operation is defined at the root or under the service namespace return `` +- Otherwise(operation is under another namespace or interface) return `_` diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/setExtension.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/setExtension.md new file mode 100644 index 0000000000..71e5b0c5ea --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/setExtension.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] setExtension" + +--- +```ts +setExtension( + program, + entity, + extensionName, + data): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | +| `extensionName` | \`x-${string}\` | +| `data` | `unknown` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/shouldInline.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/shouldInline.md new file mode 100644 index 0000000000..295054eeb8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/functions/shouldInline.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] shouldInline" + +--- +```ts +shouldInline(program, type): boolean +``` + +Determines whether a type will be inlined in OpenAPI rather than defined +as a schema and referenced. + +All anonymous types (anonymous models, arrays, tuples, etc.) are inlined. + +Template instantiations are inlined unless they have a friendly name. + +A friendly name can be provided by the user using `@friendlyName` +decorator, or chosen by default in simple cases. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/index.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/index.md new file mode 100644 index 0000000000..a3de3658a4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/index.md @@ -0,0 +1,41 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Interfaces + +- [AdditionalInfo](interfaces/AdditionalInfo.md) +- [Contact](interfaces/Contact.md) +- [ExternalDocs](interfaces/ExternalDocs.md) +- [License](interfaces/License.md) + +### Type Aliases + +- [ExtensionKey](type-aliases/ExtensionKey.md) + +### Variables + +- [namespace](variables/namespace.md) + +### Functions + +- [$defaultResponse](functions/$defaultResponse.md) +- [$extension](functions/$extension.md) +- [$externalDocs](functions/$externalDocs.md) +- [$info](functions/$info.md) +- [$operationId](functions/$operationId.md) +- [checkDuplicateTypeName](functions/checkDuplicateTypeName.md) +- [getExtensions](functions/getExtensions.md) +- [getExternalDocs](functions/getExternalDocs.md) +- [getInfo](functions/getInfo.md) +- [getOpenAPITypeName](functions/getOpenAPITypeName.md) +- [getOperationId](functions/getOperationId.md) +- [getParameterKey](functions/getParameterKey.md) +- [isDefaultResponse](functions/isDefaultResponse.md) +- [isReadonlyProperty](functions/isReadonlyProperty.md) +- [resolveOperationId](functions/resolveOperationId.md) +- [setExtension](functions/setExtension.md) +- [shouldInline](functions/shouldInline.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/AdditionalInfo.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/AdditionalInfo.md new file mode 100644 index 0000000000..ecaf31b41b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/AdditionalInfo.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] AdditionalInfo" + +--- +OpenAPI additional information + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `contact?` | [`Contact`](Contact.md) | The contact information for the exposed API. | +| `license?` | [`License`](License.md) | The license information for the exposed API. | +| `termsOfService?` | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/Contact.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/Contact.md new file mode 100644 index 0000000000..c50d5c3dee --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/Contact.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] Contact" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `email?` | `string` | The email address of the contact person/organization. MUST be in the format of an email address. | +| `name?` | `string` | The identifying name of the contact person/organization. | +| `url?` | `string` | The URL pointing to the contact information. MUST be in the format of a URL. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/ExternalDocs.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/ExternalDocs.md new file mode 100644 index 0000000000..debe31f244 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/ExternalDocs.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ExternalDocs" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description?` | `string` | - | +| `url` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/License.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/License.md new file mode 100644 index 0000000000..785a5aa31c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/interfaces/License.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] License" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | The license name used for the API. | +| `url?` | `string` | A URL to the license used for the API. MUST be in the format of a URL. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/type-aliases/ExtensionKey.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/type-aliases/ExtensionKey.md new file mode 100644 index 0000000000..e5249ff81c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/type-aliases/ExtensionKey.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] ExtensionKey" + +--- +```ts +type ExtensionKey: \x-${string}\; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..b13059d83c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.OpenAPI" = "TypeSpec.OpenAPI"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/diagnostics.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/diagnostics.md new file mode 100644 index 0000000000..a35f352f0f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/diagnostics.md @@ -0,0 +1,68 @@ +--- +title: Diagnostics +--- + +# Diagnostics + +The OpenAPI emitter may produce any of the following diagnostic messages. + + + +## duplicate-header + +This diagnostic is issued when a response header is defined more than once for a response of a specific status code. + +How to fix ??? + +## duplicate-type-name + +This diagnostic is issued when a schema or parameter name is a duplicate of another schema or parameter. +This generally happens when a model or parameter is renamed with the `@friendlyName` decorator. + +To fix this issue, change the name or friendly-name of one of the models or parameters. + +## inline-cycle + +??? + +## invalid-default + +??? + +## invalid-extension-key + +This diagnostic is issued by the `@extension` decorator when the extension key does not start with "x-" as +required by the OpenAPI v3 specification. + +To fix this issue, change the extension name to start with "x-". + +## invalid-schema + +??? + +## invalid-server-variable + +This diagnostic is issued when the a variable in the `@server` decorator is not defined as a string type. +Since server variables are substituted into the server URL which is a string, all variables must have string values. + +To fix this issue, make sure all server variables are string type. + +## path-query + +This diagnostic is issued when the OpenAPI emitter finds an `@route` decorator that specifies a path that contains a query parameter. +This is not permitted by the OpenAPI v3 specification. + +To fix this issue, redesign the API to only use paths without query parameters. + +## union-null + +This diagnostic is issued when the result of model composition is effectively a `null` schema which cannot be +represented in OpenAPI. + +To fix this issue, correct the composition to produce a valid schema or remove it altogether. + +## union-unsupported + +This diagnostic is issued when the OpenAPI emitter finds a union of two incompatible types. + +To fix this issue, correct the composition to produce a valid schema or remove it altogether. diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/openapi.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/openapi.md new file mode 100644 index 0000000000..b7d9f23ae1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/openapi.md @@ -0,0 +1,312 @@ +--- +title: Emitter operation +--- + +# How the OpenAPI emitter works + +The OpenAPI emitter converts TypeSpec language elements into their natural OpenAPI expression as described below. + +## Servers + +If the TypeSpec file contains an [(Http) `@server` decorator](../rest/reference/decorators.md#@TypeSpec.Http.server) +the OpenAPI emitter will generate a `servers` object with the server URL, description, and variables specified in the decorator. + +You can specify multiple `@server` decorators to obtain multiple entries in the `servers` object. + +## Operations + +Each TypeSpec operation becomes an OpenAPI operation. + +The HTTP method for the operation is either explicitly specified with an [(Http) `@get`, `@post`, `@put`, `@patch`, or `@delete` decorator][http-verb-decorators] on the operation or it is inferred from the operation name and signature. + +The path for the operation comes from the [(Http) `@route` decorator][http-route-decorator] on the operation. +The `@route` decorator can also be specified on a namespace and/or an interface (group of operations). +When specified, the route for the enclosing namespace(s) and interface are prefixed to the operation route. + +[http-verb-decorators]: ../rest/reference/decorators.md +[http-route-decorator]: ../rest/reference/decorators.md#@TypeSpec.Http.route + +The fields of the [OpenAPI Operation object][] are set as described below. + +[openapi operation object]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#operationObject + +### description + +The description field is set from the [(built-in) `@doc` decorator][doc-decorator] on the TypeSpec operation, and omitted when `@doc` is not present. + +[doc-decorator]: ../built-in-decorators.md#doc + +### summary + +The summary field is set from the [(built-in) `@summary` decorator][summary-decorator] on the TypeSpec operation, and omitted when `@summary` is not present. + +[summary-decorator]: ../built-in-decorators.md#summary + +### operationId + +The operationId can be explicitly specified with the [(OpenAPI) `@operationId` decorator][openapi-operationid-decorator], +and otherwise is simple the operation name, prefixed with "*" when the operation is within an interface. + +[openapi-operationid-decorator]: ../built-in-decorators.md#operationId + +### parameters and requestBody + +The parameters of the TypeSpec operation are translated into the parameter list and requestBody for the OpenAPI operation. + +The `in` field of a parameter is specified with an [(Http) `@query`, `@header`, or `@path` decorator][http-parameter-decorators]. +A parameter without one of these decorators is assumed to be passed in the request body. + +The request body parameter can also be explicitly decorated with an [(Http) `@body` decorator][http-body-decorator]. +In the absence of explicit `@body`, the set of parameters that are not marked `@header`, `@query`, or `@path` form the request body +and this request body is defined as required. If the request body should be optional, the body must be declared as +optional property with the `@body` decorator. + +[http-parameter-decorators]: ../rest/reference/decorators.md#data-types +[http-body-decorator]: ../rest/reference/decorators.md#@TypeSpec.Http.body + +The content of a (built-in) `@doc` decorator on a parameter will be set in the description. + +The TypeSpec parameter type will be translated into an appropriate OpenAPI schema for the parameter. + +Likewise, the type of the body parameter(s) will be translated into an appropriate OpenAPI schema for the requestBody. +The request body will use the "application/json" media type unless the body model includes an explicit `content-type` +header. + +See also [metadata](../http/operations.md#metadata) for more advanced details. + +### responses + +The return type(s) of the TypeSpec operation are translated into responses for the OpenAPI operation. +The status code for a response can be specified as a property in the return type model with the [(Http) `@statusCode` decorator][http-statuscode-decorator] (the property name is ignored). +If the [(built-in) `@error` decorator][error-decorator] is specified on a return type, this return type becomes the "default" response for the operation. +The media type for a response will be "application/json" unless the return type model includes an explicit `content-type` +header. +Models with different status codes and/or media types can be unioned together to describe complex response designs. + +When a return type model has a property explicitly decorated with an [(Http) `@body` decorator][http-body-decorator], this +is taken as the response body. +In the absence of explicit `@body`, the properties that are not marked `@statusCode` or `@header` form the response body. + +[http-statuscode-decorator]: ../rest/reference/decorators.md#@TypeSpec.Http.statuscode +[error-decorator]: ../built-in-decorators.md#error + +See also [metadata](../http/operations.md#metadata) for more advanced details. + +### tags + +Any tags specified with the [(built-in) `@tag` decorator][tag-decorator] on the operation, interface, or +enclosing namespace(s) are included in the OpenAPI operation's tags array. + +[tag-decorator]: ../built-in-decorators.md#tag + +### deprecated + +If the [(built-in) `#deprecated` directive][deprecated-decorator] is specified on the operation, then the operation's +deprecated field is set to true. + +[deprecated-decorator]: ../built-in-decorators.md#deprecated + +### externalDocs + +If the TypeSpec operation has an [(OpenAPI) `@externalDocs` decorator](../openapi/reference/decorators.md#@OpenAPI.externaldocs) this will produce +an externalDocs field in the OpenAPI operation. + +### Specification extensions + +Any extensions specified on the TypeSpec operation with the [(OpenAPI) `@extension` decorator](../openapi/reference/decorators.md#OpenAPI.extension) +are included in the emitted OpenAPI operation. + +## Models and enums + +Models and enums are converted into schemas in the generated OpenAPI definition. Intrinsic types in TypeSpec are represented +with a JSON Schema type that most closely matches the semantics of the TypeSpec type. + +Models defined inline will result in an inline schema. Explicitly declared models will be defined in the `components/schemas` +section with the TypeSpec name qualified by any enclosing namespaces. + +A special case is an instantiation of a model template, it is treated as an inline model unless the model template has +a [(built-in) `@friendlyName` decorator][friendlyname], in which case the schema is defined in `components/schemas` with the friendly-name. + +[friendlyname]: ../built-in-decorators.md#friendlyname + +The following table shows how TypeSpec types are translated to JSON Schema types: + +| TypeSpec type | OpenAPI `type`/`format` | Notes | +| ---------------- | --------------------------------- | ------------------------------------------------------------------------- | +| `int32` | `type: integer, format: int32` | | +| `int64` | `type: integer, format: int64` | | +| `float32` | `type: number, format: float` | | +| `float64` | `type: number, format: double` | | +| `string` | `type: string` | | +| `bytes` | `type: string, format: byte` | for content-type == 'application/json' or 'text/plain' | +| `bytes` | `type: string, format: binary` | for "binary" content types, e.g. 'application/octet-stream', 'image/jpeg' | +| `boolean` | `type: boolean` | | +| `plainDate` | `type: string, format: date` | | +| `utcDateTime` | `type: string, format: date-time` | RFC 3339 date in coordinated universal time (UTC) | +| `offsetDateTime` | `type: string, format: date-time` | RFC 3339 date with timezone offset | + +[See encoding and format](#encoding-and-formats) for other way to encode those types. + +There are a variety of decorators that can modify or add metadata to the definitions produced in the generated OpenAPI. + +For a numeric element (integer or float): + +| Decorator | Library | OpenAPI/JSON Schema keyword | Notes | +| ------------------ | -------- | --------------------------- | ----- | +| `@minValue(value)` | built-in | `minimum: value` | | +| `@maxValue(value)` | built-in | `maximum: value` | | + +For any element defined as a `string` or a type that extends from `string`: + +| Decorator | Library | OpenAPI/JSON Schema keyword | Notes | +| ------------------- | -------- | --------------------------- | ---------------------------------------------------------- | +| `@format(name)` | built-in | `format: name` | When format is not determined by type or another decorator | +| `@minLength(value)` | built-in | `minLength: value` | | +| `@maxLength(value)` | built-in | `maxLength: value` | | +| `@pattern(regex)` | built-in | `pattern: regex` | | +| `@secret` | built-in | `format: password` | | + +For an array type: + +| Decorator | Library | OpenAPI/JSON Schema keyword | Notes | +| ------------------ | -------- | --------------------------- | ----- | +| `@minItems(value)` | built-in | `minItems: value` | | +| `@maxItems(value)` | built-in | `maxItems: value` | | + +The OpenAPI emitter provides an [`@useRef` decorator](../openapi/reference/decorators.md#@OpenAPI.useref) which will replace the TypeSpec model type in emitter output +with a reference to a pre-existing named OpenAPI schema. This can be useful for "common" schemas. + +Example: + +```typespec +@useRef("common.json#/components/schemas/Sku") +model Sku { +... +} +``` + +Enums can be defined in TypeSpec with the [`enum` statement](../../language-basics/enums.md), e.g.: + +```typespec +enum Color { + Red: "red", + Blue: "blue", + Green: "green", +} +``` + +The union operator can also be used to define the enum values inline, e.g.: + +```typespec +status: "Running" | "Stopped" | "Failed" +``` + +The OpenAPI emitter converts both of these into a schema definition containing an "enum" with the list of defined values. + +### Model composition + +TypeSpec has several mechanisms for model composition and extension. The following describes how these are handled in the OpenAPI emitter. + +#### Spread + +The spread operator does not convey any semantic relationship between the source and target models so the OpenAPI emitter +treats this as if the properties of the source model were explicitly included in the target model at the position where the +spread appears. + +#### Extends + +When one model extends another model, this is intended to convey and inheritance relationship. While OpenAPI has no formal +construct for inheritance, the OpenAPI emitter represents this form of composition with an `allOf` in the schema of the child model +that references the schema for the parent model. + +##### Extends with discriminator + +The OpenAPI emitter supports the `@discriminator(propertyName)` decorator on a `model`. This will produce a `discriminator` object +with the named property in the schema for this model. + +Models that extend this model must define this property with a literal string value, and these values must be distinct across all the +models that extend this model. These values are used to construct a `mapping` for the discriminator. + +The `@discriminator` decorator can be used to create multi-level discriminated inheritance but must use a different discriminated property at each level. + +#### Is + +The `is` keyword provides a form of composition similar to the spread operator, where no semantic relationship is conveyed between +the source and target models. The OpenAPI emitter represents this form of composition with an independent schema that contains +all the same properties as the model named by the `is` keyword, plus any properties defined directly on the model. + +#### Union + +Unions are another form of model composition. + +Unions can be defined in two different ways in TypeSpec. One way is with +[the union type operator](../../language-basics/unions.md#union-expressions), `|`: + +```typespec +alias GoodBreed = Beagle | GermanShepherd | GoldenRetriever; +``` + +The second way is with [the `union` statement](../../language-basics/unions.md#named-unions) +which not only declares the variant models but also assigns a name for each. + +```typespec +union GoodBreed { + beagle: Beagle, + shepherd: GermanShepherd, + retriever: GoldenRetriever, +} +``` + +The OpenAPI emitter represents either form of union with an `anyOf` with an element for each option of the union. +The OpenAPI emitter ignores the "names" for variants in named unions. + +The OpenAPI emitter also defines the[`@oneOf` decorator](../openapi/reference/decorators.md#OpenAPI.oneof) which can be specified on a `union` statement to indicate +that a union should be emitted as a `oneOf` rather than `anyOf`. + +## Encoding and formats + +When working with the `@encode` decorator the rule is as follow. Given the 3 values `encoding`, `encodeAs` and `realType` where `@encode(encoding, encodeAs) _: realType`: + +1. If `realType` is `utcDateTime` or `offsetDateTime`: + - `encoding` of `rfc3339` will produce `type: string, format: date-time` + - `encoding` of `rfc7231` will produce `type: string, format: http-date` +1. If `realType` is `utcDateTime` and `encoding` is `unixTimestamp`: + - `encodeAs` of any integer type will produce `type: integer, format: unixtime` +1. If the schema of encodeAs produces a `format` use it (e.g. encoding as `int32` will produce an `type: integer, format: integer` ) +1. Otherwise use the `encoding` as the format + +**Summary table** + +| encoding | Openapi3 | Swagger 2.0 (autorest) | +| ------------------------------------------------ | --------------------------------- | --------------------------------- | +| `@encode("seconds", int32) _: duration` | `type: integer, format: int32` | `type: integer, format: int32` | +| `@encode("seconds", float32) _: duration` | `type: number, format: float32` | `type: number, format: float32` | +| `@encode("ISO8601") _: duration` | `type: number, format: duration` | `type: number, format: duration` | +| `@encode("unixTimestamp", int32) _: utcDateTime` | `type: integer, format: unixtime` | `type: integer, format: unixtime` | +| `@encode("unixTimestamp", int64) _: utcDateTime` | `type: integer, format: unixtime` | `type: integer, format: unixtime` | +| `@encode("rfc3339") _: utcDateTime` | `type: string, format: date-time` | `type: string, format: date-time` | +| `@encode("rfc7231") _: utcDateTime` | `type: string, format: http-date` | `type: string, format: http-date` | +| `@encode("http-date") _: utcDateTime` | `type: string, format: http-date` | `type: string, format: http-date` | + +## Security Definitions + +The OpenAPI emitter takes the [(http) `@useAuth` decorator](../rest/reference/decorators.md#@TypeSpec.Http.useauth) + +### Examples + +The following example shows how to define a security scheme for Azure Active Directory authentication: + +```typespec +@useAuth(AADToken) +namespace Contoso.WidgetManager; +@doc("The Azure Active Directory OAuth2 Flow") +model AADToken + is OAuth2Auth<[ + { + type: OAuth2FlowType.authorizationCode; + authorizationUrl: "https://api.example.com/oauth2/authorize"; + tokenUrl: "https://api.example.com/oauth2/token"; + scopes: ["https://management.azure.com/read", "https://management.azure.com/write"]; + } + ]>; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/decorators.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/decorators.md new file mode 100644 index 0000000000..eefd6469cc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/decorators.md @@ -0,0 +1,43 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.OpenAPI + +### `@oneOf` {#@TypeSpec.OpenAPI.oneOf} + +Specify that `oneOf` should be used instead of `anyOf` for that union. + +```typespec +@TypeSpec.OpenAPI.oneOf +``` + +#### Target + +`union Union | ModelProperty` + +#### Parameters + +None + +### `@useRef` {#@TypeSpec.OpenAPI.useRef} + +Specify an external reference that should be used inside of emitting this type. + +```typespec +@TypeSpec.OpenAPI.useRef(ref: valueof string) +``` + +#### Target + +`union Model | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ---- | ----------------------- | -------------------------------------------------------------------- | +| ref | `valueof scalar string` | External reference(e.g. "../../common.json#/components/schemas/Foo") | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/emitter.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/emitter.md new file mode 100644 index 0000000000..bd89797990 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/emitter.md @@ -0,0 +1,83 @@ +--- +title: "Emitter usage" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Emitter + +## Usage + +1. Via the command line + +```bash +tsp compile . --emit=@typespec/openapi3 +``` + +2. Via the config + +```yaml +emit: + - "@typespec/openapi3" +``` + +## Emitter options + +### `file-type` + +**Type:** `"yaml" | "json"` + +If the content should be serialized as YAML or JSON. Default 'yaml', it not specified infer from the `output-file` extension + +### `output-file` + +**Type:** `string` + +Name of the output file. +Output file will interpolate the following values: + +- service-name: Name of the service if multiple +- version: Version of the service if multiple + +Default: `{service-name}.{version}.openapi.yaml` or `.json` if `file-type` is `"json"` + +Example Single service no versioning + +- `openapi.yaml` + +Example Multiple services no versioning + +- `openapi.Org1.Service1.yaml` +- `openapi.Org1.Service2.yaml` + +Example Single service with versioning + +- `openapi.v1.yaml` +- `openapi.v2.yaml` + +Example Multiple service with versioning + +- `openapi.Org1.Service1.v1.yaml` +- `openapi.Org1.Service1.v2.yaml` +- `openapi.Org1.Service2.v1.0.yaml` +- `openapi.Org1.Service2.v1.1.yaml` + +### `new-line` + +**Type:** `"crlf" | "lf"` + +Set the newline character for emitting files. + +### `omit-unreachable-types` + +**Type:** `boolean` + +Omit unreachable types. +By default all types declared under the service namespace will be included. With this flag on only types references in an operation will be emitted. + +### `include-x-typespec-name` + +**Type:** `"inline-only" | "never"` + +If the generated openapi types should have the `x-typespec-name` extension set with the name of the TypeSpec type that created it. +This extension is meant for debugging and should not be depended on. diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/index.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/index.md new file mode 100644 index 0000000000..712b79d863 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/index.md @@ -0,0 +1,43 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec library for emitting OpenAPI 3.0 from the TypeSpec REST protocol binding + +## Install + + + + +```bash +npm install @typespec/openapi3 +``` + + + + +```bash +npm install --save-peer @typespec/openapi3 +``` + + + + +## Emitter usage + +[See documentation](./emitter.md) + +## TypeSpec.OpenAPI + +### Decorators + +- [`@oneOf`](./decorators.md#@TypeSpec.OpenAPI.oneOf) +- [`@useRef`](./decorators.md#@TypeSpec.OpenAPI.useRef) diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/$onEmit.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/$onEmit.md new file mode 100644 index 0000000000..50fae6e43c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/$onEmit.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] $onEmit" + +--- +```ts +$onEmit(context): Promise +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `EmitContext`<`OpenAPI3EmitterOptions`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/$oneOf.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/$oneOf.md new file mode 100644 index 0000000000..459a442ef7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/$oneOf.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $oneOf" + +--- +```ts +$oneOf(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` \| `Union` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/$useRef.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/$useRef.md new file mode 100644 index 0000000000..7529f0ea27 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/$useRef.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $useRef" + +--- +```ts +$useRef( + context, + entity, + refUrl): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` \| `ModelProperty` | +| `refUrl` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/getOneOf.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/getOneOf.md new file mode 100644 index 0000000000..81127ca863 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/getOneOf.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getOneOf" + +--- +```ts +getOneOf(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/getRef.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/getRef.md new file mode 100644 index 0000000000..9a9b91c704 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/getRef.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getRef" + +--- +```ts +getRef(program, entity): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/resolveOptions.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/resolveOptions.md new file mode 100644 index 0000000000..9f16f99c4d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/functions/resolveOptions.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] resolveOptions" + +--- +```ts +resolveOptions(context): ResolvedOpenAPI3EmitterOptions +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `EmitContext`<`OpenAPI3EmitterOptions`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/index.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/index.md new file mode 100644 index 0000000000..19aca6efba --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/index.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Interfaces + +- [ResolvedOpenAPI3EmitterOptions](interfaces/ResolvedOpenAPI3EmitterOptions.md) + +### Variables + +- [$lib](variables/$lib.md) +- [namespace](variables/namespace.md) + +### Functions + +- [$onEmit](functions/$onEmit.md) +- [$oneOf](functions/$oneOf.md) +- [$useRef](functions/$useRef.md) +- [getOneOf](functions/getOneOf.md) +- [getRef](functions/getRef.md) +- [resolveOptions](functions/resolveOptions.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/interfaces/ResolvedOpenAPI3EmitterOptions.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/interfaces/ResolvedOpenAPI3EmitterOptions.md new file mode 100644 index 0000000000..7f745c8b1d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/interfaces/ResolvedOpenAPI3EmitterOptions.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] ResolvedOpenAPI3EmitterOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `fileType` | `FileType` | - | +| `includeXTypeSpecName` | `"never"` \| `"inline-only"` | - | +| `newLine` | `NewLine` | - | +| `omitUnreachableTypes` | `boolean` | - | +| `outputFile` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/variables/$lib.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/variables/$lib.md new file mode 100644 index 0000000000..85fb7e0518 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/variables/$lib.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] $lib" + +--- +```ts +const $lib: TypeSpecLibrary; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..b13059d83c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/openapi3/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.OpenAPI" = "TypeSpec.OpenAPI"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/projected-names.md b/packages/website-astro/src/content/docs/current/standard-library/projected-names.md new file mode 100644 index 0000000000..a97d31a3a4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/projected-names.md @@ -0,0 +1,142 @@ +--- +id: projected-names +title: Projected names +--- + +# Projected Names + +There is some cases where the name you have in TypeSpec might differ from the name over the wire or for a certain language. + +## Known targets + +List of known targets. + +- Wire: + - `json`: Configure JSON representation of data + - `xml`: Configure XML representation of data +- Language: + - `csharp`: Configure C# generated code + - `java`: Configure Java generated code + - `python`: Configure python generated code + - `javascript`: Configure javascript generated code + - `swift` : Configure swift generated code + - `c` : Configure C generated code +- Type: + - `client`: Configure output for the client + - `server`: Configure output for the server + +## Update name for a given target + +### With decorator + +To update the name of a TypeSpec entity you can use the `@projectedName` decorator. This decorator takes 2 parameters: + +- `string` target name. See [known targets](#known-targets) +- `string` projected name. Whatever the name should be in the given target. + +Example: + +```typespec +model Foo { + // Specify that when serializing to JSON `expireAt` property should be named `exp` + @projectedName("json", "exp") + expireAt: string; +} +``` + +### With projection + +The decorator is just a syntax sugar for the `target` projection behind the scenes. In more complex cases you might want to just implement the projection manually. + +```typespec +model Foo { + expireAt: string; +} + +projection Foo#target { + to(targetName) { + if targetName == "json" { + self::rename("exp"); + }; + } +} +``` + +## Example + +```typespec +model CertificateAttributes { + @projectedName("json", "nbf") + @projectedName("csharp", "ValidAfter") + notBefore: int32; + + @projectedName("json", "exp") + expires: int32; + + @projectedName("client", "createdAt") + created: int32; + + updated: int32; +} +``` + + + + + + + + + + + + + + + + + + + + +
JsonTypescriptCSharp
When serialized to Json property use the json projected nameTypescript didn't provide any projected name so it keep the model as it is.Model uses the `csharp` projected names and keeps the reference to the JSON name in JsonProperty
+ +```json +{ + "nbf": 1430344421, + "exp": 2208988799, + "created": 1493938289, + "updated": 1493938291 +} +``` + + + +```ts +interface Attributes { + notBefore: number; + expires: number; + createdAt: number; + updated: number; +} +``` + + + +```cs +class CertificateAttributes +{ + [JsonProperty("nbf")] + public int ValidAfter {get; set;} + + [JsonProperty("exp")] + public int Expires {get; set;} + + [JsonProperty("created")] + public int CreatedAt {get; set;} + + public int Updated {get; set;} +} +``` + +
diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/guide.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/guide.md new file mode 100644 index 0000000000..daf6e4eda7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/guide.md @@ -0,0 +1,176 @@ +--- +title: Guide +--- + +# The Protobuf Emitter guide + +TypeSpec provides an emitter (`@typespec/protobuf`) that generates Protocol Buffers specifications from TypeSpec sources as part of its standard library. The resulting Protobuf files may be used as inputs for creating gRPC services or any other tools compatible with Protocol Buffers. + +**Note**: The Protobuf emitter uses Protocol Buffers 3 (proto3) syntax. Your workflow (`protoc` version, etc.) must support proto3 to utilize this emitter. + +## Core concepts + +The Protobuf emitter enables you to write TypeSpec and convert it into equivalent Protocol Buffers for use with Protobuf-enabled systems (such as gRPC). Your TypeSpec models and interfaces must adhere to certain requirements and restrictions in order for the emitter to convert them to Protobuf. + +### Packages + +A protobuf package is defined by the [`TypeSpec.Protobuf.package` decorator][protobuf-package], which applies to a TypeSpec namespace. A package essentially defines a `.proto` file, and everything within the decorated namespace will be emitted to a single file. + +The following TypeSpec namespace results in a Protobuf file named `main.proto` that contains the contents of the `Test` namespace converted into Protobuf. + +```typespec +@package +namespace Test { +// ... + +} +``` + +Package names may be provided using the optional `PackageDetails` argument to the `@package` decorator. The following TypeSpec namespace will result in a file `com/example/test.proto` that has the line `package com.example.test;` within it: + +```typespec +@package({ + name: "com.example.test", +}) +namespace Test { +// ... + +} +``` + +TypeSpec objects (models, enums, etc.) are converted to Protobuf declarations within their nearest ancestor that has a package annotation. As a result, unlike in Protobuf, TypeSpec declarations of packages may be nested arbitrarily.p + +### Messages + +TypeSpec models are converted into Protobuf messages. The following TypeSpec model: + +```typespec +model TestMessage { + @field(1) n: int32; +} +``` + +will be converted into the following Protobuf message: + +```proto3 +message TestMessage { + int32 n = 1; +} +``` + +Models are converted into messages and included in the Protobuf file if any of the following conditions are met: + +- The model is explicitly annotated with the [`TypeSpec.Protobuf.message` decorator][protobuf-message]. +- The model is referenced by any service operation (see [Services](#services) below). +- The model is a direct child of a [package namespace](#packages) and has _every_ field annotated with the [`TypeSpec.Protobuf.field` decorator][protobuf-field]. + +#### Field indices + +Protobuf requires that the offset of each field within a Protobuf message be manually specified. In TypeSpec, the field indices are specified using the [`TypeSpec.Protobuf.field` decorator][protobuf-field]. All fields within a model must have an attached `@field` decorator to be converted into a Protobuf message. + +The following TypeSpec model: + +```typespec +model TestMessage { + @field(1) n: int32; +} +``` + +will be converted into the following Protobuf message: + +```proto3 +message TestMessage { + int32 n = 1; +} +``` + +### Services + +TypeSpec has a concept of a "service" defined by the [`TypeSpec.service` decorator][native-service], but the Protobuf concept of a "service" is different and is indicated by the [`TypeSpec.Protobuf.service` decorator][protobuf-service]. + +When using the Protobuf emitter, a Protobuf service designation is applied to an _interface_ within a package. For example, the following TypeSpec: + +```typespec +@package +namespace Example { + @Protobuf.service + interface Test { + // ... + } +} +``` + +will yield the following Protobuf file (named `example.proto`): + +```proto3 +syntax = "proto3"; + +package example; + +service Test { + // ... +} +``` + +#### Operations + +Within a [service interface](#services), TypeSpec operations represent Protobuf service methods. Each operation in the service interface is converted into an equivalent Protobuf method declaration. For example, the following specification: + +```typespec +model Input { + @field(1) exampleField: string; +} + +model Output { + @field(1) parsed: uint32; +} + +@Protobuf.service +interface Example { + testOperation(...Input): Output; +} +``` + +Results in the following `.proto` file: + +```proto3 +message Input { + string exampleField = 1; +} + +message Output { + uint32 parsed = 1; +} + +service Example { + rpc TestOperation(Input) returns (Output); +} +``` + +#### Streams + +The Protobuf emitter supports declaring the streaming mode of an operation using the [`TypeSpec.Protobuf.stream` decorator][protobuf-stream]. The streaming mode is specified using the [`StreamMode`][protobuf-stream-mode] enum. An operation can have one of four streaming modes: + +- `None`: this is the default mode and indicates that neither the request nor response are streamed. + + Example: `rpc Example(In) returns (Out);` + +- `In`: indicates that the request is streamed, but the response is received synchronously. + + Example: `rpc Example(stream In) returns (Out);` + +- `Out`: indicates that the request is sent synchronously, but the response is streamed. + + Example: `rpc Example(In) returns (stream Out);` + +- `Duplex`: indicates that both the request and response are streamed. + + Example: `rpc Example(stream In) returns (stream Out);` + +[native-service]: ../built-in-decorators#service +[protobuf-service]: reference/decorators#@TypeSpec.Protobuf.service +[protobuf-package]: reference/decorators#@TypeSpec.Protobuf.package +[protobuf-field]: reference/decorators#@TypeSpec.Protobuf.field +[protobuf-stream]: reference/decorators#@TypeSpec.Protobuf.stream +[protobuf-stream-mode]: reference/data-types#TypeSpec.Protobuf.StreamMode +[protobuf-message]: reference/decorators#@TypeSpec.Protobuf.message diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/data-types.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/data-types.md new file mode 100644 index 0000000000..a354895162 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/data-types.md @@ -0,0 +1,197 @@ +--- +title: "Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Data types + +## TypeSpec.Protobuf + +### `Extern` {#TypeSpec.Protobuf.Extern} + +A model that represents an external Protobuf reference. This type can be used to import and utilize Protobuf +declarations that are not declared in TypeSpec within TypeSpec sources. When the emitter encounters an `Extern`, it +will insert an `import` statement for the corresponding `Path` and refer to the type by `Name`. + +#### Usage + +If you have a file called `test.proto` that declares a package named `test` and a message named `Widget`, you can +use the `Extern` type to declare a model in TypeSpec that refers to your external definition of `test.Widget`. See +the example below. + +When the TypeSpec definition of `Widget` is encountered, the Protobuf emitter will represent it as a reference to +`test.Widget` and insert an import for it, rather than attempt to convert the model to an equivalent message. + +```typespec +model TypeSpec.Protobuf.Extern +``` + +#### Template Parameters + +| Name | Description | +| ---- | ---------------------------------------------------------------------------------------- | +| Path | the relative path to a `.proto` file to import | +| Name | the fully-qualified reference to the type this model represents within the `.proto` file | + +#### Examples + +```typespec +model Widget is Extern<"path/to/test.proto", "test.Widget">; +``` + +### `Map` {#TypeSpec.Protobuf.Map} + +A type representing a Protobuf `map`. Instances of this type in models will be converted to the built-in `map` type +in Protobuf. + +The key type of a Protobuf `map` must be any integral type or `string`. The value type can be any type other than +another `Map`. + +```typespec +model TypeSpec.Protobuf.Map +``` + +#### Template Parameters + +| Name | Description | +| ---- | ------------------------------------------------ | +| K | the key type (any integral type or string) | +| V | the value type (any type other than another map) | + +### `PackageDetails` {#TypeSpec.Protobuf.PackageDetails} + +Details applied to a package definition by the [`@package`](./decorators# + +```typespec +model TypeSpec.Protobuf.PackageDetails +``` + +### `StreamMode` {#TypeSpec.Protobuf.StreamMode} + +The streaming mode of an operation. One of: + +- `Duplex`: both the input and output of the operation are streaming. +- `In`: the input of the operation is streaming. +- `Out`: the output of the operation is streaming. +- `None`: neither the input nor the output are streaming. + +See the [`@stream`](./decorators# + +```typespec +enum TypeSpec.Protobuf.StreamMode +``` + +### `fixed32` {#TypeSpec.Protobuf.fixed32} + +An unsigned 32-bit integer that will use the `fixed32` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Always four bytes. More efficient than `uint32` if values are often greater than 228. + +```typespec +scalar TypeSpec.Protobuf.fixed32 +``` + +### `fixed64` {#TypeSpec.Protobuf.fixed64} + +An unsigned 64-bit integer that will use the `fixed64` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Always eight bytes. More efficient than `uint64` if values are often greater than 256. + +```typespec +scalar TypeSpec.Protobuf.fixed64 +``` + +### `sfixed32` {#TypeSpec.Protobuf.sfixed32} + +A signed 32-bit integer that will use the `sfixed32` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Always four bytes. + +```typespec +scalar TypeSpec.Protobuf.sfixed32 +``` + +### `sfixed64` {#TypeSpec.Protobuf.sfixed64} + +A signed 64-bit integer that will use the `sfixed64` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Always eight bytes. + +```typespec +scalar TypeSpec.Protobuf.sfixed64 +``` + +### `sint32` {#TypeSpec.Protobuf.sint32} + +A signed 32-bit integer that will use the `sint32` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Uses variable-length encoding. These more efficiently encode negative numbers than regular int32s. + +```typespec +scalar TypeSpec.Protobuf.sint32 +``` + +### `sint64` {#TypeSpec.Protobuf.sint64} + +A signed 64-bit integer that will use the `sint64` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Uses variable-length encoding. These more efficiently encode negative numbers than regular `int64s`. + +```typespec +scalar TypeSpec.Protobuf.sint64 +``` + +## TypeSpec.Protobuf.WellKnown + +### `Any` {#TypeSpec.Protobuf.WellKnown.Any} + +Any value. + +This model references `google.protobuf.Any` from `google/protobuf/any.proto`. + +```typespec +model TypeSpec.Protobuf.WellKnown.Any +``` + +### `Empty` {#TypeSpec.Protobuf.WellKnown.Empty} + +An empty message. + +This model references `google.protobuf.Empty` from `google/protobuf/empty.proto`. + +```typespec +model TypeSpec.Protobuf.WellKnown.Empty +``` + +### `LatLng` {#TypeSpec.Protobuf.WellKnown.LatLng} + +A latitude and longitude. + +This model references `google.type.LatLng` from `google/type/latlng.proto`. + +```typespec +model TypeSpec.Protobuf.WellKnown.LatLng +``` + +### `Timestamp` {#TypeSpec.Protobuf.WellKnown.Timestamp} + +A timestamp. + +This model references `google.protobuf.Timestamp` from `google/protobuf/timestamp.proto`. + +```typespec +model TypeSpec.Protobuf.WellKnown.Timestamp +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/decorators.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/decorators.md new file mode 100644 index 0000000000..7ec642c0fe --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/decorators.md @@ -0,0 +1,179 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.Protobuf + +### `@field` {#@TypeSpec.Protobuf.field} + +Defines the field index of a model property for conversion to a Protobuf +message. + +The field index of a Protobuf message must: + +- fall between 1 and 229 - 1, inclusive. +- not fall within the implementation reserved range of 19000 to 19999, inclusive. +- not fall within any range that was [marked reserved](# + +```typespec +@TypeSpec.Protobuf.field(index: valueof uint32) +``` + +#### Target + +`ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------------- | ------------------------------------ | +| index | `valueof scalar uint32` | The whole-number index of the field. | + +#### Examples + +```typespec +model ExampleMessage { + @field(1) + test: string; +} +``` + +### `@message` {#@TypeSpec.Protobuf.message} + +Declares that a model is a Protobuf message. + +Messages can be detected automatically if either of the following two conditions are met: + +- The model has a `@field` annotation on all of its properties. +- The model is referenced by any service operation. + +This decorator will force the emitter to check and emit a model. + +```typespec +@TypeSpec.Protobuf.message +``` + +#### Target + +`model {}` + +#### Parameters + +None + +### `@package` {#@TypeSpec.Protobuf.package} + +Declares that a TypeSpec namespace constitutes a Protobuf package. The contents of the namespace will be emitted to a +single Protobuf file. + +```typespec +@TypeSpec.Protobuf.package(details?: TypeSpec.Protobuf.PackageDetails) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| ------- | ---------------------------------------- | ----------------------------------- | +| details | `model TypeSpec.Protobuf.PackageDetails` | the optional details of the package | + +### `@reserve` {#@TypeSpec.Protobuf.reserve} + +Reserve a field index, range, or name. If a field definition collides with a reservation, the emitter will produce +an error. + +This decorator accepts multiple reservations. Each reservation is one of the following: + +- a `string`, in which case the reservation refers to a field name. +- a `uint32`, in which case the reservation refers to a field index. +- a tuple `[uint32, uint32]`, in which case the reservation refers to a field range that is _inclusive_ of both ends. + +Unlike in Protobuf, where field name and index reservations must be separated, you can mix string and numeric field +reservations in a single `@reserve` call in TypeSpec. + +#### API Compatibility Note + +Field reservations prevent users of your Protobuf specification from using the given field names or indices. This can +be useful if a field is removed, as it will further prevent adding a new, incompatible field and will prevent users +from utilizing the field index at runtime in a way that may break compatibility with users of older specifications. + +See _[Protobuf Language Guide - Reserved Fields](https://protobuf.dev/programming-guides/proto3/#reserved)_ for more +information. + +```typespec +@TypeSpec.Protobuf.reserve(...reservations: valueof string | [uint32, uint32] | uint32[]) +``` + +#### Target + +`model {}` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------------------------------------------------------ | ---------------------------- | +| reservations | `valueof model string \| [uint32, uint32] \| uint32[]` | a list of field reservations | + +#### Examples + +```typespec +// Reserve the fields 8-15 inclusive, 100, and the field name "test" within a model. +@reserve([8, 15], 100, "test") +model Example { + // ... +} +``` + +### `@service` {#@TypeSpec.Protobuf.service} + +Declares that a TypeSpec interface constitutes a Protobuf service. The contents of the interface will be converted to +a `service` declaration in the resulting Protobuf file. + +```typespec +@TypeSpec.Protobuf.service +``` + +#### Target + +`Interface` + +#### Parameters + +None + +### `@stream` {#@TypeSpec.Protobuf.stream} + +Set the streaming mode of an operation. See [StreamMode](./data-types#TypeSpec.Protobuf.StreamMode) for more information. + +```typespec +@TypeSpec.Protobuf.stream(mode: TypeSpec.Protobuf.StreamMode) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ---- | ----------------------------------- | ---------------------------------------------- | +| mode | `enum TypeSpec.Protobuf.StreamMode` | The streaming mode to apply to this operation. | + +#### Examples + +```typespec +@stream(StreamMode.Out) +op logs(...LogsRequest): LogEvent; +``` + +```typespec +@stream(StreamMode.Duplex) +op connectToMessageService(...Message): Message; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/emitter.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/emitter.md new file mode 100644 index 0000000000..22e256a81b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/emitter.md @@ -0,0 +1,36 @@ +--- +title: "Emitter usage" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Emitter + +## Usage + +1. Via the command line + +```bash +tsp compile . --emit=@typespec/protobuf +``` + +2. Via the config + +```yaml +emit: + - "@typespec/protobuf" +``` + +## Emitter options + +### `noEmit` + +**Type:** `boolean` + +If set to `true`, this emitter will not write any files. It will still validate the TypeSpec sources to ensure they are compatible with Protobuf, but the files will simply not be written to the output directory. + +### `omit-unreachable-types` + +**Type:** `boolean` + +By default, the emitter will create `message` declarations for any models in a namespace decorated with `@package` that have an `@field` decorator on every property. If this option is set to true, this behavior will be disabled, and only messages that are explicitly decorated with `@message` or that are reachable from a service operation will be emitted. diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/index.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/index.md new file mode 100644 index 0000000000..3914200c66 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/index.md @@ -0,0 +1,62 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec library and emitter for Protobuf (gRPC) + +## Install + + + + +```bash +npm install @typespec/protobuf +``` + + + + +```bash +npm install --save-peer @typespec/protobuf +``` + + + + +## Emitter usage + +[See documentation](./emitter.md) + +## TypeSpec.Protobuf + +### Decorators + +- [`@field`](./decorators.md#@TypeSpec.Protobuf.field) +- [`@message`](./decorators.md#@TypeSpec.Protobuf.message) +- [`@package`](./decorators.md#@TypeSpec.Protobuf.package) +- [`@reserve`](./decorators.md#@TypeSpec.Protobuf.reserve) +- [`@service`](./decorators.md#@TypeSpec.Protobuf.service) +- [`@stream`](./decorators.md#@TypeSpec.Protobuf.stream) + +### Models + +- [`Extern`](./data-types.md#TypeSpec.Protobuf.Extern) +- [`Map`](./data-types.md#TypeSpec.Protobuf.Map) +- [`PackageDetails`](./data-types.md#TypeSpec.Protobuf.PackageDetails) + +## TypeSpec.Protobuf.WellKnown + +### Models + +- [`Any`](./data-types.md#TypeSpec.Protobuf.WellKnown.Any) +- [`Empty`](./data-types.md#TypeSpec.Protobuf.WellKnown.Empty) +- [`LatLng`](./data-types.md#TypeSpec.Protobuf.WellKnown.LatLng) +- [`Timestamp`](./data-types.md#TypeSpec.Protobuf.WellKnown.Timestamp) diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$externRef.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$externRef.md new file mode 100644 index 0000000000..fa39273374 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$externRef.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $externRef" + +--- +```ts +$externRef( + ctx, + target, + path, + name): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `ctx` | `DecoratorContext` | +| `target` | `Model` | +| `path` | `StringLiteral` | +| `name` | `StringLiteral` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$field.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$field.md new file mode 100644 index 0000000000..bc746fcc8c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$field.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] $field" + +--- +```ts +$field( + ctx, + target, + fieldIndex): void +``` + +Decorate a model property with a field index. Field indices are required for all fields of emitted messages. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `ctx` | `DecoratorContext` | - | +| `target` | `ModelProperty` | | +| `fieldIndex` | `number` | | + +## Returns diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$message.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$message.md new file mode 100644 index 0000000000..e5c6e41724 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$message.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $message" + +--- +```ts +$message(ctx, target): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `ctx` | `DecoratorContext` | +| `target` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$onEmit.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$onEmit.md new file mode 100644 index 0000000000..01e6dc7191 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$onEmit.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] $onEmit" + +--- +```ts +$onEmit(ctx): Promise +``` + +Emitter main function. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `ctx` | `EmitContext`<`ProtobufEmitterOptions`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$onValidate.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$onValidate.md new file mode 100644 index 0000000000..cc74dab946 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$onValidate.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] $onValidate" + +--- +```ts +$onValidate(program): Promise +``` + +Validation function + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$package.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$package.md new file mode 100644 index 0000000000..d9f5e7864f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$package.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $package" + +--- +```ts +$package( + ctx, + target, + details?): void +``` + +Declare a Protobuf package. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `ctx` | `DecoratorContext` | decorator context | +| `target` | `Namespace` | target decorator namespace | +| `details`? | `Model` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$reserve.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$reserve.md new file mode 100644 index 0000000000..0a12d36415 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$reserve.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $reserve" + +--- +```ts +$reserve( + ctx, + target, ... + reservations): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `ctx` | `DecoratorContext` | +| `target` | `Model` | +| ...`reservations` | readonly (`string` \| `number` \| `Type`)[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$service.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$service.md new file mode 100644 index 0000000000..7875c0597a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$service.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] $service" + +--- +```ts +$service(ctx, target): void +``` + +Decorate an interface as a service, indicating that it represents a Protobuf `service` declaration. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `ctx` | `DecoratorContext` | decorator context | +| `target` | `Interface` | the decorated interface | diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$stream.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$stream.md new file mode 100644 index 0000000000..8daf2a13d1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/$stream.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $stream" + +--- +```ts +$stream( + ctx, + target, + mode): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `ctx` | `DecoratorContext` | +| `target` | `Operation` | +| `mode` | `EnumMember` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/isMap.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/isMap.md new file mode 100644 index 0000000000..500f6c2fe9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/functions/isMap.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isMap" + +--- +```ts +isMap(program, m): boolean +``` + +Determines whether a type represents a Protobuf map. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | the program context | +| `m` | `Type` | the type to test | + +## Returns + +true if the internal representation of a Protobuf map is bound to this type. diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/index.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/index.md new file mode 100644 index 0000000000..2e166c36ae --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/index.md @@ -0,0 +1,33 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Interfaces + +- [PackageDetails](interfaces/PackageDetails.md) + +### Type Aliases + +- [Reservation](type-aliases/Reservation.md) + +### Variables + +- [$lib](variables/$lib.md) +- [PROTO\_FULL\_IDENT](variables/PROTO_FULL_IDENT.md) +- [namespace](variables/namespace.md) + +### Functions + +- [$externRef](functions/$externRef.md) +- [$field](functions/$field.md) +- [$message](functions/$message.md) +- [$onEmit](functions/$onEmit.md) +- [$onValidate](functions/$onValidate.md) +- [$package](functions/$package.md) +- [$reserve](functions/$reserve.md) +- [$service](functions/$service.md) +- [$stream](functions/$stream.md) +- [isMap](functions/isMap.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/interfaces/PackageDetails.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/interfaces/PackageDetails.md new file mode 100644 index 0000000000..1495e8a304 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/interfaces/PackageDetails.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] PackageDetails" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `name?` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/type-aliases/Reservation.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/type-aliases/Reservation.md new file mode 100644 index 0000000000..22298fc322 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/type-aliases/Reservation.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] Reservation" + +--- +```ts +type Reservation: string | number | [number, number] & object; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/variables/$lib.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/variables/$lib.md new file mode 100644 index 0000000000..d0b3766f7d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/variables/$lib.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] $lib" + +--- +```ts +const $lib: TypeSpecLibrary = TypeSpecProtobufLibrary; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/variables/PROTO_FULL_IDENT.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/variables/PROTO_FULL_IDENT.md new file mode 100644 index 0000000000..99c17b6e90 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/variables/PROTO_FULL_IDENT.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[V] PROTO_FULL_IDENT" + +--- +```ts +const PROTO_FULL_IDENT: RegExp; +``` + +Defined in the [ProtoBuf Language Spec](https://developers.google.com/protocol-buffers/docs/reference/proto3-spec#identifiers). + +ident = letter { letter | decimalDigit | "_" } +fullIdent = ident { "." ident } diff --git a/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..767743f38d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/protobuf/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.Protobuf" = "TypeSpec.Protobuf"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/DuplicateTracker.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/DuplicateTracker.md new file mode 100644 index 0000000000..a07892d33b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/DuplicateTracker.md @@ -0,0 +1,54 @@ +--- +jsApi: true +title: "[C] DuplicateTracker" + +--- +Helper class to track duplicate instance + +## Type parameters + +| Parameter | +| :------ | +| `K` | +| `V` | + +## Constructors + +### new DuplicateTracker() + +```ts +new DuplicateTracker(): DuplicateTracker +``` + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `private` | `#entries` | `Map`<`K`, `V`[]\> | - | + +## Methods + +### entries() + +```ts +entries(): Iterable<[K, V[]]> +``` + +Return iterator of all the duplicate entries. + +*** + +### track() + +```ts +track(k, v): void +``` + +Track usage of K. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `k` | `K` | key that is being checked for duplicate. | +| `v` | `V` | value that map to the key | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/EventEmitter.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/EventEmitter.md new file mode 100644 index 0000000000..af2e755c59 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/EventEmitter.md @@ -0,0 +1,66 @@ +--- +jsApi: true +title: "[C] EventEmitter" + +--- +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | + +## Constructors + +### new EventEmitter() + +```ts +new EventEmitter(): EventEmitter +``` + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `private` | `listeners` | `Map` `any`[]\> | - | + +## Methods + +### emit() + +```ts +emit(name, ...args): void +``` + +#### Type parameters + +| Parameter | +| :------ | +| `K` extends `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `K` | +| ...`args` | `Parameters`<`T`[`K`]\> | + +*** + +### on() + +```ts +on(name, listener): void +``` + +#### Type parameters + +| Parameter | +| :------ | +| `K` extends `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `K` | +| `listener` | (...`args`) => `any` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/InvalidEncodingError.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/InvalidEncodingError.md new file mode 100644 index 0000000000..6afd92b983 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/InvalidEncodingError.md @@ -0,0 +1,57 @@ +--- +jsApi: true +title: "[C] InvalidEncodingError" + +--- +## Extends + +- `Error` + +## Constructors + +### new InvalidEncodingError(encoding) + +```ts +new InvalidEncodingError(encoding): InvalidEncodingError +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `encoding` | `string` | + +#### Overrides + +Error.constructor + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `public` | `message` | `string` | - | Error.message | +| `public` | `name` | `string` | - | Error.name | +| `public` | `stack?` | `string` | - | Error.stack | +| `static` | `prepareStackTrace?` | (`err`, `stackTraces`) => `any` | - | Error.prepareStackTrace | +| `static` | `stackTraceLimit` | `number` | - | Error.stackTraceLimit | + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void +``` + +Create .stack property on a target object + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `targetObject` | `object` | +| `constructorOpt`? | `Function` | + +#### Inherited from + +Error.captureStackTrace diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/ProjectionError.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/ProjectionError.md new file mode 100644 index 0000000000..d2cb316c72 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/ProjectionError.md @@ -0,0 +1,59 @@ +--- +jsApi: true +title: "[C] ProjectionError" + +--- +Represents a failure while interpreting a projection. + +## Extends + +- `Error` + +## Constructors + +### new ProjectionError(message) + +```ts +new ProjectionError(message): ProjectionError +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | + +#### Overrides + +Error.constructor + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `public` | `message` | `string` | - | Error.message | +| `public` | `name` | `string` | - | Error.name | +| `public` | `stack?` | `string` | - | Error.stack | +| `static` | `prepareStackTrace?` | (`err`, `stackTraces`) => `any` | - | Error.prepareStackTrace | +| `static` | `stackTraceLimit` | `number` | - | Error.stackTraceLimit | + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void +``` + +Create .stack property on a target object + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `targetObject` | `object` | +| `constructorOpt`? | `Function` | + +#### Inherited from + +Error.captureStackTrace diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/Queue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/Queue.md new file mode 100644 index 0000000000..30d0da9ac1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/Queue.md @@ -0,0 +1,61 @@ +--- +jsApi: true +title: "[C] Queue" + +--- +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Constructors + +### new Queue(elements) + +```ts +new Queue(elements?): Queue +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `elements`? | `T`[] | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `private` | `#elements` | `T`[] | - | +| `private` | `#headIndex` | `number` | - | + +## Methods + +### dequeue() + +```ts +dequeue(): T +``` + +*** + +### enqueue() + +```ts +enqueue(...items): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| ...`items` | `T`[] | + +*** + +### isEmpty() + +```ts +isEmpty(): boolean +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/ResolveModuleError.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/ResolveModuleError.md new file mode 100644 index 0000000000..414168ec57 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/classes/ResolveModuleError.md @@ -0,0 +1,59 @@ +--- +jsApi: true +title: "[C] ResolveModuleError" + +--- +## Extends + +- `Error` + +## Constructors + +### new ResolveModuleError(code, message) + +```ts +new ResolveModuleError(code, message): ResolveModuleError +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `ResolveModuleErrorCode` | +| `message` | `string` | + +#### Overrides + +Error.constructor + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `public` | `code` | `ResolveModuleErrorCode` | - | - | +| `public` | `message` | `string` | - | Error.message | +| `public` | `name` | `string` | - | Error.name | +| `public` | `stack?` | `string` | - | Error.stack | +| `static` | `prepareStackTrace?` | (`err`, `stackTraces`) => `any` | - | Error.prepareStackTrace | +| `static` | `stackTraceLimit` | `number` | - | Error.stackTraceLimit | + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void +``` + +Create .stack property on a target object + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `targetObject` | `object` | +| `constructorOpt`? | `Function` | + +#### Inherited from + +Error.captureStackTrace diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/IdentifierKind.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/IdentifierKind.md new file mode 100644 index 0000000000..5c9ab67b62 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/IdentifierKind.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[E] IdentifierKind" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Declaration` | `4` | +| `Decorator` | `1` | +| `Function` | `2` | +| `Other` | `5` | +| `TypeReference` | `0` | +| `Using` | `3` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/ListenerFlow.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/ListenerFlow.md new file mode 100644 index 0000000000..62fdcb1826 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/ListenerFlow.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[E] ListenerFlow" + +--- +## Enumeration Members + +| Member | Value | Description | +| :------ | :------ | :------ | +| `NoRecursion` | `1` | Do not navigate any containing or referenced type. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/ModifierFlags.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/ModifierFlags.md new file mode 100644 index 0000000000..03ebdab22c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/ModifierFlags.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[E] ModifierFlags" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Extern` | `2` | +| `None` | `0` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/NodeFlags.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/NodeFlags.md new file mode 100644 index 0000000000..614d83eafd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/NodeFlags.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[E] NodeFlags" + +--- +## Enumeration Members + +| Member | Value | Description | +| :------ | :------ | :------ | +| `DescendantErrorsExamined` | `1` | If this is set, the DescendantHasError bit can be trusted. If this not set,
children need to be visited still to see if DescendantHasError should be
set.

Use the parser's `hasParseError` API instead of using this flag directly. | +| `DescendantHasError` | `4` | Indicates that a child of this node (or one of its children,
transitively) has a parse error.

Use the parser's `hasParseError` API instead of using this flag directly. | +| `None` | `0` | - | +| `Synthetic` | `8` | Indicates that a node was created synthetically and therefore may not be parented. | +| `ThisNodeHasError` | `2` | Indicates that a parse error was associated with this specific node.

Use the parser's `hasParseError` API instead of using this flag directly. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/SemanticTokenKind.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/SemanticTokenKind.md new file mode 100644 index 0000000000..16fea7ea07 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/SemanticTokenKind.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[E] SemanticTokenKind" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Class` | `2` | +| `Comment` | `16` | +| `DocCommentTag` | `21` | +| `Enum` | `3` | +| `EnumMember` | `10` | +| `Event` | `11` | +| `Function` | `12` | +| `Interface` | `4` | +| `Keyword` | `15` | +| `Macro` | `14` | +| `Method` | `13` | +| `Namespace` | `0` | +| `Number` | `18` | +| `Operator` | `20` | +| `Parameter` | `7` | +| `Property` | `9` | +| `Regexp` | `19` | +| `String` | `17` | +| `Struct` | `5` | +| `Type` | `1` | +| `TypeParameter` | `6` | +| `Variable` | `8` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/SymbolFlags.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/SymbolFlags.md new file mode 100644 index 0000000000..841114500d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/SymbolFlags.md @@ -0,0 +1,37 @@ +--- +jsApi: true +title: "[E] SymbolFlags" + +--- +## Enumeration Members + +| Member | Value | Description | +| :------ | :------ | :------ | +| `Alias` | `2048` | - | +| `Declaration` | `4194304` | - | +| `Decorator` | `16384` | - | +| `DuplicateUsing` | `1048576` | - | +| `Enum` | `32` | - | +| `EnumMember` | `64` | - | +| `ExportContainer` | `2101248` | - | +| `Function` | `131072` | - | +| `FunctionParameter` | `262144` | - | +| `Implementation` | `8388608` | - | +| `Interface` | `128` | - | +| `InterfaceMember` | `256` | - | +| `LateBound` | `16777216` | A symbol which was late-bound, in which case, the type referred to
by this symbol is stored directly in the symbol. | +| `Member` | `1348` | - | +| `MemberContainer` | `674` | Symbols whose members will be late bound (and stored on the type) | +| `Model` | `2` | - | +| `ModelProperty` | `4` | - | +| `Namespace` | `4096` | - | +| `None` | `0` | - | +| `Operation` | `16` | - | +| `Projection` | `8192` | - | +| `ProjectionParameter` | `65536` | - | +| `Scalar` | `8` | - | +| `SourceFile` | `2097152` | - | +| `TemplateParameter` | `32768` | - | +| `Union` | `512` | - | +| `UnionVariant` | `1024` | - | +| `Using` | `524288` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/SyntaxKind.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/SyntaxKind.md new file mode 100644 index 0000000000..1eb331c93e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/SyntaxKind.md @@ -0,0 +1,97 @@ +--- +jsApi: true +title: "[E] SyntaxKind" + +--- +AST types + +## Enumeration Members + +| Member | Value | Description | +| :------ | :------ | :------ | +| `AliasStatement` | `24` | - | +| `ArrayExpression` | `31` | - | +| `AugmentDecoratorStatement` | `4` | - | +| `BlockComment` | `46` | - | +| `BooleanLiteral` | `34` | - | +| `CadlScript` | `0` | **Deprecated**

Use TypeSpecScript | +| `DecoratorDeclarationStatement` | `25` | - | +| `DecoratorExpression` | `5` | - | +| `DirectiveExpression` | `6` | - | +| `Doc` | `47` | - | +| `DocErrorsTag` | `51` | - | +| `DocParamTag` | `49` | - | +| `DocReturnsTag` | `50` | - | +| `DocTemplateTag` | `52` | - | +| `DocText` | `48` | - | +| `DocUnknownTag` | `53` | - | +| `EmptyStatement` | `43` | - | +| `EnumMember` | `22` | - | +| `EnumSpreadMember` | `23` | - | +| `EnumStatement` | `21` | - | +| `ExternKeyword` | `35` | - | +| `FunctionDeclarationStatement` | `26` | - | +| `FunctionParameter` | `27` | - | +| `Identifier` | `3` | - | +| `ImportStatement` | `2` | - | +| `InterfaceStatement` | `18` | - | +| `IntersectionExpression` | `29` | - | +| `InvalidStatement` | `44` | - | +| `JsNamespaceDeclaration` | `84` | - | +| `JsSourceFile` | `1` | - | +| `LineComment` | `45` | - | +| `MemberExpression` | `7` | - | +| `ModelExpression` | `14` | - | +| `ModelProperty` | `15` | - | +| `ModelSpreadProperty` | `16` | - | +| `ModelStatement` | `13` | - | +| `NamespaceStatement` | `8` | - | +| `NeverKeyword` | `37` | - | +| `NumericLiteral` | `33` | - | +| `OperationSignatureDeclaration` | `11` | - | +| `OperationSignatureReference` | `12` | - | +| `OperationStatement` | `10` | - | +| `Projection` | `54` | - | +| `ProjectionArithmeticExpression` | `72` | - | +| `ProjectionBlockExpression` | `66` | - | +| `ProjectionCallExpression` | `73` | - | +| `ProjectionDecoratorReferenceExpression` | `82` | - | +| `ProjectionEnumMemberSelector` | `63` | - | +| `ProjectionEnumSelector` | `62` | - | +| `ProjectionEqualityExpression` | `69` | - | +| `ProjectionExpressionStatement` | `64` | - | +| `ProjectionIfExpression` | `65` | - | +| `ProjectionInterfaceSelector` | `61` | - | +| `ProjectionLambdaExpression` | `74` | - | +| `ProjectionLambdaParameterDeclaration` | `75` | - | +| `ProjectionLogicalExpression` | `68` | - | +| `ProjectionMemberExpression` | `67` | - | +| `ProjectionModelExpression` | `76` | - | +| `ProjectionModelProperty` | `77` | - | +| `ProjectionModelPropertySelector` | `57` | - | +| `ProjectionModelSelector` | `56` | - | +| `ProjectionModelSpreadProperty` | `78` | - | +| `ProjectionOperationSelector` | `58` | - | +| `ProjectionParameterDeclaration` | `55` | - | +| `ProjectionReference` | `41` | - | +| `ProjectionRelationalExpression` | `71` | - | +| `ProjectionSpreadProperty` | `79` | - | +| `ProjectionStatement` | `81` | - | +| `ProjectionTupleExpression` | `80` | - | +| `ProjectionUnaryExpression` | `70` | - | +| `ProjectionUnionSelector` | `59` | - | +| `ProjectionUnionVariantSelector` | `60` | - | +| `Return` | `83` | - | +| `ScalarStatement` | `17` | - | +| `StringLiteral` | `32` | - | +| `TemplateParameterDeclaration` | `42` | - | +| `TupleExpression` | `30` | - | +| `TypeReference` | `40` | - | +| `TypeSpecScript` | `0` | - | +| `UnionExpression` | `28` | - | +| `UnionStatement` | `19` | - | +| `UnionVariant` | `20` | - | +| `UnknownKeyword` | `38` | - | +| `UsingStatement` | `9` | - | +| `ValueOfExpression` | `39` | - | +| `VoidKeyword` | `36` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/Token.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/Token.md new file mode 100644 index 0000000000..243ce1b247 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/Token.md @@ -0,0 +1,81 @@ +--- +jsApi: true +title: "[E] Token" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `AliasKeyword` | `54` | +| `Ampersand` | `27` | +| `AmpsersandAmpersand` | `42` | +| `At` | `32` | +| `AtAt` | `33` | +| `Bar` | `28` | +| `BarBar` | `43` | +| `CloseBrace` | `15` | +| `CloseBracket` | `19` | +| `CloseParen` | `17` | +| `Colon` | `30` | +| `ColonColon` | `31` | +| `Comma` | `23` | +| `ConflictMarker` | `10` | +| `DecKeyword` | `61` | +| `DocCodeFenceDelimiter` | `13` | +| `DocCodeSpan` | `12` | +| `DocText` | `11` | +| `Dot` | `20` | +| `Ellipsis` | `21` | +| `ElseKeyword` | `59` | +| `EndOfFile` | `2` | +| `EnumKeyword` | `53` | +| `Equals` | `26` | +| `EqualsEquals` | `44` | +| `EqualsGreaterThan` | `46` | +| `Exclamation` | `39` | +| `ExclamationEquals` | `45` | +| `ExtendsKeyword` | `65` | +| `ExternKeyword` | `64` | +| `FalseKeyword` | `67` | +| `FnKeyword` | `62` | +| `ForwardSlash` | `36` | +| `GreaterThan` | `25` | +| `GreaterThanEquals` | `41` | +| `Hash` | `34` | +| `Hyphen` | `38` | +| `Identifier` | `3` | +| `IfKeyword` | `60` | +| `ImportKeyword` | `47` | +| `InterfaceKeyword` | `56` | +| `Invalid` | `1` | +| `IsKeyword` | `55` | +| `LessThan` | `24` | +| `LessThanEquals` | `40` | +| `ModelKeyword` | `48` | +| `MultiLineComment` | `7` | +| `NamespaceKeyword` | `50` | +| `NeverKeyword` | `70` | +| `NewLine` | `8` | +| `None` | `0` | +| `NumericLiteral` | `4` | +| `OpKeyword` | `52` | +| `OpenBrace` | `14` | +| `OpenBracket` | `18` | +| `OpenParen` | `16` | +| `Plus` | `37` | +| `ProjectionKeyword` | `58` | +| `Question` | `29` | +| `ReturnKeyword` | `68` | +| `ScalarKeyword` | `49` | +| `Semicolon` | `22` | +| `SingleLineComment` | `6` | +| `Star` | `35` | +| `StringLiteral` | `5` | +| `TrueKeyword` | `66` | +| `UnionKeyword` | `57` | +| `UnknownKeyword` | `71` | +| `UsingKeyword` | `51` | +| `ValueOfKeyword` | `63` | +| `VoidKeyword` | `69` | +| `Whitespace` | `9` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/TokenFlags.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/TokenFlags.md new file mode 100644 index 0000000000..8d7271c2f7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/TokenFlags.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[E] TokenFlags" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Backticked` | `32` | +| `DocComment` | `16` | +| `Escaped` | `1` | +| `NonAscii` | `8` | +| `None` | `0` | +| `TripleQuoted` | `2` | +| `Unterminated` | `4` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/UsageFlags.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/UsageFlags.md new file mode 100644 index 0000000000..7d619373bf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/enumerations/UsageFlags.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[E] UsageFlags" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Input` | `2` | +| `None` | `0` | +| `Output` | `4` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$deprecated.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$deprecated.md new file mode 100644 index 0000000000..1f236d3e36 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$deprecated.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] $deprecated" + +--- +```ts +$deprecated( + context, + target, + message): void +``` + +Mark a type as deprecated + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | DecoratorContext | +| `target` | [`Type`](../type-aliases/Type.md) | Decorator target | +| `message` | `string` | Deprecation target. | + +## Returns + +## Example + +``` @deprecated("Foo is deprecated, use Bar instead.") + model Foo {} +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$discriminator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$discriminator.md new file mode 100644 index 0000000000..bdfe685d63 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$discriminator.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $discriminator" + +--- +```ts +$discriminator( + context, + entity, + propertyName): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`Model`](../interfaces/Model.md) \| [`Union`](../interfaces/Union.md) | +| `propertyName` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$doc.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$doc.md new file mode 100644 index 0000000000..475f730cad --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$doc.md @@ -0,0 +1,38 @@ +--- +jsApi: true +title: "[F] $doc" + +--- +```ts +$doc( + context, + target, + text, + sourceObject?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `text` | `string` | +| `sourceObject`? | [`Type`](../type-aliases/Type.md) | + +## Returns + +## Doc + +attaches a documentation string. Works great with multi-line string literals. + +The first argument to + +## Doc + +is a string, which may contain template parameters, enclosed in braces, +which are replaced with an attribute for the type (commonly "name") passed as the second (optional) argument. + +## Doc + +can be specified on any language element -- a model, an operation, a namespace, etc. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$encode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$encode.md new file mode 100644 index 0000000000..d50bdac454 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$encode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $encode" + +--- +```ts +$encode( + context, + target, + encoding, + encodeAs?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `encoding` | `string` \| [`EnumMember`](../interfaces/EnumMember.md) | +| `encodeAs`? | [`Scalar`](../interfaces/Scalar.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$error.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$error.md new file mode 100644 index 0000000000..71c3a59ccc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$error.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $error" + +--- +```ts +$error(context, entity): void +``` + +`@error` decorator marks a model as an error type. + +`@error` can only be specified on a model. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`Model`](../interfaces/Model.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$errorsDoc.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$errorsDoc.md new file mode 100644 index 0000000000..f02027cde4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$errorsDoc.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $errorsDoc" + +--- +```ts +$errorsDoc( + context, + target, + text): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Operation`](../interfaces/Operation.md) | +| `text` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$format.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$format.md new file mode 100644 index 0000000000..aba42f8846 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$format.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[F] $format" + +--- +```ts +$format( + context, + target, + format): void +``` + +`@format` - specify the data format hint for a string type + +The first argument is a string that identifies the format that the string type expects. Any string +can be entered here, but a TypeSpec emitter must know how to interpret + +For TypeSpec specs that will be used with an OpenAPI emitter, the OpenAPI specification describes possible +valid values for a string type's format: + +https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#dataTypes + +`@format` can be specified on a type that extends from `string` or a `string`-typed model property. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `format` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$friendlyName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$friendlyName.md new file mode 100644 index 0000000000..6c5bd76f9e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$friendlyName.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $friendlyName" + +--- +```ts +$friendlyName( + context, + target, + friendlyName, + sourceObject): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `friendlyName` | `string` | +| `sourceObject` | `undefined` \| [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$indexer.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$indexer.md new file mode 100644 index 0000000000..2791d63a5c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$indexer.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $indexer" + +--- +```ts +$indexer( + context, + target, + key, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `key` | [`Scalar`](../interfaces/Scalar.md) | +| `value` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$inspectType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$inspectType.md new file mode 100644 index 0000000000..088d923ba7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$inspectType.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $inspectType" + +--- +```ts +$inspectType( + program, + target, + text): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `text` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$inspectTypeName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$inspectTypeName.md new file mode 100644 index 0000000000..77018500f6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$inspectTypeName.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $inspectTypeName" + +--- +```ts +$inspectTypeName( + program, + target, + text): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `text` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$key.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$key.md new file mode 100644 index 0000000000..331d541f71 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$key.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[F] $key" + +--- +```ts +$key( + context, + entity, + altName?): void +``` + +`@key` - mark a model property as the key to identify instances of that type + +The optional first argument accepts an alternate key name which may be used by emitters. +Otherwise, the name of the target property will be used. + +`@key` can only be applied to model properties. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`ModelProperty`](../interfaces/ModelProperty.md) | +| `altName`? | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$knownValues.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$knownValues.md new file mode 100644 index 0000000000..10a657b425 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$knownValues.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[F] $knownValues" + +--- +```ts +$knownValues( + context, + target, + knownValues): void +``` + +`@knownValues` marks a string type with an enum that contains all known values + +The first parameter is a reference to an enum type that describes all possible values that the +type accepts. + +`@knownValues` can only be applied to model types that extend `string`. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | - | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | Decorator target. Must be a string. (model Foo extends string) | +| `knownValues` | [`Enum`](../interfaces/Enum.md) | Must be an enum. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$list.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$list.md new file mode 100644 index 0000000000..108472004d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$list.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] $list" + +--- +```ts +$list( + context, + target, + listedType?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Operation`](../interfaces/Operation.md) | +| `listedType`? | [`Type`](../type-aliases/Type.md) | + +## Returns + +## Deprecated + +Use the `listsResource` decorator in `@typespec/rest` instead. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxItems.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxItems.md new file mode 100644 index 0000000000..0ca3445573 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxItems.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxItems" + +--- +```ts +$maxItems( + context, + target, + maxItems): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) \| [`ModelProperty`](../interfaces/ModelProperty.md) | +| `maxItems` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxLength.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxLength.md new file mode 100644 index 0000000000..5d8ef8b159 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxLength.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxLength" + +--- +```ts +$maxLength( + context, + target, + maxLength): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `maxLength` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxValue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxValue.md new file mode 100644 index 0000000000..82f4133734 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxValue.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxValue" + +--- +```ts +$maxValue( + context, + target, + maxValue): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `maxValue` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxValueExclusive.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxValueExclusive.md new file mode 100644 index 0000000000..ee5bf5cf7c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$maxValueExclusive.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxValueExclusive" + +--- +```ts +$maxValueExclusive( + context, + target, + maxValueExclusive): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `maxValueExclusive` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minItems.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minItems.md new file mode 100644 index 0000000000..f7e0b08453 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minItems.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minItems" + +--- +```ts +$minItems( + context, + target, + minItems): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) \| [`ModelProperty`](../interfaces/ModelProperty.md) | +| `minItems` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minLength.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minLength.md new file mode 100644 index 0000000000..830679e218 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minLength.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minLength" + +--- +```ts +$minLength( + context, + target, + minLength): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `minLength` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minValue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minValue.md new file mode 100644 index 0000000000..ec9f11ca69 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minValue.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minValue" + +--- +```ts +$minValue( + context, + target, + minValue): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `minValue` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minValueExclusive.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minValueExclusive.md new file mode 100644 index 0000000000..f1561b20e7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$minValueExclusive.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minValueExclusive" + +--- +```ts +$minValueExclusive( + context, + target, + minValueExclusive): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `minValueExclusive` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$overload.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$overload.md new file mode 100644 index 0000000000..89b66fb489 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$overload.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $overload" + +--- +```ts +$overload( + context, + target, + overloadBase): void +``` + +`@overload` - Indicate that the target overloads (specializes) the overloads type. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | DecoratorContext | +| `target` | [`Operation`](../interfaces/Operation.md) | The specializing operation declaration | +| `overloadBase` | [`Operation`](../interfaces/Operation.md) | The operation to be overloaded. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$parameterVisibility.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$parameterVisibility.md new file mode 100644 index 0000000000..aba0f8b70e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$parameterVisibility.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $parameterVisibility" + +--- +```ts +$parameterVisibility( + context, + entity, ... + visibilities): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`Operation`](../interfaces/Operation.md) | +| ...`visibilities` | `string`[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$pattern.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$pattern.md new file mode 100644 index 0000000000..c3fb9a3b9f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$pattern.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $pattern" + +--- +```ts +$pattern( + context, + target, + pattern): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `pattern` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$projectedName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$projectedName.md new file mode 100644 index 0000000000..169fb96647 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$projectedName.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] $projectedName" + +--- +```ts +$projectedName( + context, + target, + projectionName, + projectedName): void +``` + +`@projectedName` - Indicate that this entity should be renamed according to the given projection. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | DecoratorContext | +| `target` | [`Type`](../type-aliases/Type.md) | The that should have a different name. | +| `projectionName` | `string` | Name of the projection (e.g. "toJson", "toCSharp") | +| `projectedName` | `string` | Name of the type should have in the scope of the projection specified. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$returnTypeVisibility.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$returnTypeVisibility.md new file mode 100644 index 0000000000..35cc0598dd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$returnTypeVisibility.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $returnTypeVisibility" + +--- +```ts +$returnTypeVisibility( + context, + entity, ... + visibilities): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`Operation`](../interfaces/Operation.md) | +| ...`visibilities` | `string`[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$returnsDoc.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$returnsDoc.md new file mode 100644 index 0000000000..f7ed8de6ee --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$returnsDoc.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $returnsDoc" + +--- +```ts +$returnsDoc( + context, + target, + text): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Operation`](../interfaces/Operation.md) | +| `text` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$secret.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$secret.md new file mode 100644 index 0000000000..cd98d638c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$secret.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] $secret" + +--- +```ts +$secret(context, target): void +``` + +Mark a string as a secret value that should be treated carefully to avoid exposure + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | Decorator context | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | Decorator target, either a string model or a property with type string. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$service.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$service.md new file mode 100644 index 0000000000..52c1dec7dd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$service.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $service" + +--- +```ts +$service( + context, + target, + options?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Namespace`](../interfaces/Namespace.md) | +| `options`? | [`Model`](../interfaces/Model.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$summary.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$summary.md new file mode 100644 index 0000000000..f45349711e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$summary.md @@ -0,0 +1,39 @@ +--- +jsApi: true +title: "[F] $summary" + +--- +```ts +$summary( + context, + target, + text, + sourceObject): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `text` | `string` | +| `sourceObject` | [`Type`](../type-aliases/Type.md) | + +## Returns + +## Summary + +attaches a documentation string. It is typically used to give a short, single-line +description, and can be used in combination with or instead of @doc. + +The first argument to + +## Summary + +is a string, which may contain template parameters, enclosed in braces, +which are replaced with an attribute for the type (commonly "name") passed as the second (optional) argument. + +## Summary + +can be specified on any language element -- a model, an operation, a namespace, etc. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$tag.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$tag.md new file mode 100644 index 0000000000..b83e33b273 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$tag.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $tag" + +--- +```ts +$tag( + context, + target, + tag): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Interface`](../interfaces/Interface.md) \| [`Namespace`](../interfaces/Namespace.md) \| [`Operation`](../interfaces/Operation.md) | +| `tag` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$visibility.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$visibility.md new file mode 100644 index 0000000000..bc3da85509 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$visibility.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $visibility" + +--- +```ts +$visibility( + context, + target, ... + visibilities): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) | +| ...`visibilities` | `string`[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withDefaultKeyVisibility.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withDefaultKeyVisibility.md new file mode 100644 index 0000000000..03da558d06 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withDefaultKeyVisibility.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $withDefaultKeyVisibility" + +--- +```ts +$withDefaultKeyVisibility( + context, + entity, + visibility): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`Model`](../interfaces/Model.md) | +| `visibility` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withOptionalProperties.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withOptionalProperties.md new file mode 100644 index 0000000000..6514fb752d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withOptionalProperties.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $withOptionalProperties" + +--- +```ts +$withOptionalProperties(context, target): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withUpdateableProperties.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withUpdateableProperties.md new file mode 100644 index 0000000000..5e56bf5553 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withUpdateableProperties.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $withUpdateableProperties" + +--- +```ts +$withUpdateableProperties(context, target): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withVisibility.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withVisibility.md new file mode 100644 index 0000000000..ebb9ee34f2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withVisibility.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $withVisibility" + +--- +```ts +$withVisibility( + context, + target, ... + visibilities): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) | +| ...`visibilities` | `string`[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withoutDefaultValues.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withoutDefaultValues.md new file mode 100644 index 0000000000..27aff6f317 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withoutDefaultValues.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $withoutDefaultValues" + +--- +```ts +$withoutDefaultValues(context, target): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withoutOmittedProperties.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withoutOmittedProperties.md new file mode 100644 index 0000000000..7a56360362 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/$withoutOmittedProperties.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $withoutOmittedProperties" + +--- +```ts +$withoutOmittedProperties( + context, + target, + omitProperties): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) | +| `omitProperties` | [`StringLiteral`](../interfaces/StringLiteral.md) \| [`Union`](../interfaces/Union.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/addService.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/addService.md new file mode 100644 index 0000000000..9cffe02485 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/addService.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] addService" + +--- +```ts +addService( + program, + namespace, + details): void +``` + +Mark the given namespace as a service. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Namespace | +| `details` | [`ServiceDetails`](../interfaces/ServiceDetails.md) | Service details | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/assertType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/assertType.md new file mode 100644 index 0000000000..442c8893d8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/assertType.md @@ -0,0 +1,48 @@ +--- +jsApi: true +title: "[F] assertType" + +--- +```ts +assertType( + typeDescription, + t, ... + kinds): asserts t is Object +``` + +Assert that the input type has one of the kinds provided + +## Type parameters + +| Parameter | +| :------ | +| `TKind` extends ( + \| `"Model"` + \| `"ModelProperty"` + \| `"Scalar"` + \| `"Interface"` + \| `"Enum"` + \| `"EnumMember"` + \| `"TemplateParameter"` + \| `"Namespace"` + \| `"Operation"` + \| `"String"` + \| `"Number"` + \| `"Boolean"` + \| `"Tuple"` + \| `"Union"` + \| `"UnionVariant"` + \| `"Intrinsic"` + \| `"Function"` + \| `"Decorator"` + \| `"FunctionParameter"` + \| `"Object"` + \| `"Projection"`)[] | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `typeDescription` | `string` | +| `t` | [`Type`](../type-aliases/Type.md) | +| ...`kinds` | `TKind` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/cadlTypeToJson.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/cadlTypeToJson.md new file mode 100644 index 0000000000..a60c9bd905 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/cadlTypeToJson.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] cadlTypeToJson" + +--- +```ts +cadlTypeToJson(typespecType, target): [T | undefined, Diagnostic[]] +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `typespecType` | [`TypeSpecValue`](../type-aliases/TypeSpecValue.md) | +| `target` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | + +## Returns + +## Deprecated + +use typespecTypeToJson diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/checkFormatCadl.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/checkFormatCadl.md new file mode 100644 index 0000000000..afb4651df8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/checkFormatCadl.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] checkFormatCadl" + +--- +```ts +checkFormatCadl(code, prettierConfig?): Promise +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `string` | +| `prettierConfig`? | `Options` | + +## Returns + +## Deprecated + +use checkFormatTypeSpec diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/checkFormatTypeSpec.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/checkFormatTypeSpec.md new file mode 100644 index 0000000000..5f196128a0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/checkFormatTypeSpec.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] checkFormatTypeSpec" + +--- +```ts +checkFormatTypeSpec(code, prettierConfig?): Promise +``` + +Check the given is correctly formatted. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `string` | +| `prettierConfig`? | `Options` | + +## Returns + +true if code is formatted correctly. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/compile.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/compile.md new file mode 100644 index 0000000000..a9f1628c04 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/compile.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] compile" + +--- +```ts +compile( + host, + mainFile, + options, +oldProgram?): Promise +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `host` | [`CompilerHost`](../interfaces/CompilerHost.md) | +| `mainFile` | `string` | +| `options` | [`CompilerOptions`](../interfaces/CompilerOptions.md) | +| `oldProgram`? | [`Program`](../interfaces/Program.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/compilerAssert.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/compilerAssert.md new file mode 100644 index 0000000000..8b6ece8ba4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/compilerAssert.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[F] compilerAssert" + +--- +```ts +compilerAssert( + condition, + message, + target?): asserts condition +``` + +Use this to report bugs in the compiler, and not errors in the source code +being compiled. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `condition` | `any` | Throw if this is not true. | +| `message` | `string` | Error message. | +| `target`? | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | Optional location in source code that might give a clue about
what got the compiler off track. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createCadlLibrary.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createCadlLibrary.md new file mode 100644 index 0000000000..17b0bff948 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createCadlLibrary.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] createCadlLibrary" + +--- +```ts +createCadlLibrary(lib): TypeSpecLibrary +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | +| `E` extends `Record`<`string`, `any`\> | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `lib` | `Readonly`<[`TypeSpecLibraryDef`](../interfaces/TypeSpecLibraryDef.md)<`T`, `E`\>\> | + +## Returns + +## Deprecated + +use createTypeSpecLibrary diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createChecker.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createChecker.md new file mode 100644 index 0000000000..144c3dd536 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createChecker.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] createChecker" + +--- +```ts +createChecker(program): Checker +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createDecoratorDefinition.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createDecoratorDefinition.md new file mode 100644 index 0000000000..cddf71aca0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createDecoratorDefinition.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[F] createDecoratorDefinition" + +--- +```ts +createDecoratorDefinition(definition): DecoratorValidator +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends [`TypeKind`](../type-aliases/TypeKind.md) | +| `P` extends readonly [`DecoratorParamDefinition`](../interfaces/DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\>[] | +| `S` extends `undefined` \| [`DecoratorParamDefinition`](../interfaces/DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\> | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `definition` | [`DecoratorDefinition`](../interfaces/DecoratorDefinition.md)<`T`, `P`, `S`\> | + +## Returns + +## Deprecated + +use extern dec definition in typespec instead. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createDiagnosticCollector.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createDiagnosticCollector.md new file mode 100644 index 0000000000..f870b155aa --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createDiagnosticCollector.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] createDiagnosticCollector" + +--- +```ts +createDiagnosticCollector(): DiagnosticCollector +``` + +Create a new instance of the + +## Returns + +## See + +DiagnosticCollector. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createDiagnosticCreator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createDiagnosticCreator.md new file mode 100644 index 0000000000..175c187fb3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createDiagnosticCreator.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] createDiagnosticCreator" + +--- +```ts +createDiagnosticCreator(diagnostics, libraryName?): DiagnosticCreator +``` + +Create a new diagnostics creator. + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `diagnostics` | [`DiagnosticMap`](../type-aliases/DiagnosticMap.md)<`T`\> | Map of the potential diagnostics. | +| `libraryName`? | `string` | Optional name of the library if in the scope of a library. | + +## Returns + +## See + +DiagnosticCreator diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createProjectedNameProgram.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createProjectedNameProgram.md new file mode 100644 index 0000000000..ba640225c0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createProjectedNameProgram.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] createProjectedNameProgram" + +--- +```ts +createProjectedNameProgram(program, target): ProjectedNameView +``` + +Create an helper to manager project names. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | `string` | Name of the projected name target(e.g. json, csharp, etc.) | + +## Returns + +ProjectedNameView diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createRekeyableMap.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createRekeyableMap.md new file mode 100644 index 0000000000..14c7931fc2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createRekeyableMap.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] createRekeyableMap" + +--- +```ts +createRekeyableMap(entries?): RekeyableMap +``` + +## Type parameters + +| Parameter | +| :------ | +| `K` | +| `V` | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `entries`? | [`K`, `V`][] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createRule.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createRule.md new file mode 100644 index 0000000000..9b37791fab --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createRule.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] createRule" + +--- +```ts +createRule(definition): LinterRuleDefinition +``` + +Create a new linter rule. + +## Type parameters + +| Parameter | +| :------ | +| `N` extends `string` | +| `T` extends [`DiagnosticMessages`](../interfaces/DiagnosticMessages.md) | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `definition` | [`LinterRuleDefinition`](../interfaces/LinterRuleDefinition.md)<`N`, `T`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createScanner.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createScanner.md new file mode 100644 index 0000000000..dc2fe545df --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createScanner.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] createScanner" + +--- +```ts +createScanner(source, diagnosticHandler): Scanner +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `source` | `string` \| [`SourceFile`](../interfaces/SourceFile.md) | +| `diagnosticHandler` | [`DiagnosticHandler`](../type-aliases/DiagnosticHandler.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createServer.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createServer.md new file mode 100644 index 0000000000..78f5971e55 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createServer.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] createServer" + +--- +```ts +createServer(host): Server +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `host` | [`ServerHost`](../interfaces/ServerHost.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createSourceFile.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createSourceFile.md new file mode 100644 index 0000000000..ca075aa5b0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createSourceFile.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] createSourceFile" + +--- +```ts +createSourceFile(text, path): SourceFile +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `text` | `string` | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createStateAccessors.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createStateAccessors.md new file mode 100644 index 0000000000..15b436490e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createStateAccessors.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] createStateAccessors" + +--- +```ts +createStateAccessors( + stateMaps, + stateSets, + projector?): object +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `stateMaps` | `Map`<`symbol`, `StateMap`\> | +| `stateSets` | `Map`<`symbol`, `StateSet`\> | +| `projector`? | [`Projector`](../interfaces/Projector.md) | + +## Returns + +> | Member | Type | Description | +> | :------ | :------ | :------ | +> | `stateMap` | <`T`\>(`key`) => `StateMapView`<`T`\> | - | +> | `stateSet` | (`key`) => `StateSetView` | - | +> diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createTypeSpecLibrary.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createTypeSpecLibrary.md new file mode 100644 index 0000000000..0a1733d425 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/createTypeSpecLibrary.md @@ -0,0 +1,44 @@ +--- +jsApi: true +title: "[F] createTypeSpecLibrary" + +--- +```ts +createTypeSpecLibrary(lib): TypeSpecLibrary +``` + +Create a new TypeSpec library definition. + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | +| `E` extends `Record`<`string`, `any`\> | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `lib` | `Readonly`<[`TypeSpecLibraryDef`](../interfaces/TypeSpecLibraryDef.md)<`T`, `E`\>\> | Library definition. | + +## Returns + +Library with utility functions. + +## Tutorial + +Create the lib object with `as const` to get the full typing. + +## Example + +```ts +const libDef = { + name: "myLib", + diagnostics: { + "my-code": {serverity: "error", messages: {default: "Foo bar"}} + }, +} as const; + +const lib = createTypeSpecLibrary(libDef); +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/emitFile.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/emitFile.md new file mode 100644 index 0000000000..1d93bf262d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/emitFile.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] emitFile" + +--- +```ts +emitFile(program, options): Promise +``` + +Helper to emit a file. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | TypeSpec Program | +| `options` | [`EmitFileOptions`](../interfaces/EmitFileOptions.md) | File Emitter options | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/ensureTrailingDirectorySeparator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/ensureTrailingDirectorySeparator.md new file mode 100644 index 0000000000..cb8b71253a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/ensureTrailingDirectorySeparator.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] ensureTrailingDirectorySeparator" + +--- +```ts +ensureTrailingDirectorySeparator(path): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/filterModelProperties.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/filterModelProperties.md new file mode 100644 index 0000000000..761b39fffa --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/filterModelProperties.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] filterModelProperties" + +--- +```ts +filterModelProperties( + program, + model, + filter): Model +``` + +Applies a filter to the properties of a given type. If no properties +are filtered out, then return the input unchanged. Otherwise, return +a new anonymous model with only the filtered properties. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) \| [`ProjectedProgram`](../interfaces/ProjectedProgram.md) | - | +| `model` | [`Model`](../interfaces/Model.md) | The input model to filter. | +| `filter` | (`property`) => `boolean` | The filter to apply. Properties are kept when this returns true. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/finishTypeForProgram.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/finishTypeForProgram.md new file mode 100644 index 0000000000..5ad29fb270 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/finishTypeForProgram.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] finishTypeForProgram" + +--- +```ts +finishTypeForProgram(program, typeDef): T +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends [`Type`](../type-aliases/Type.md) | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `typeDef` | `T` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/formatDiagnostic.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/formatDiagnostic.md new file mode 100644 index 0000000000..6547ba8c69 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/formatDiagnostic.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] formatDiagnostic" + +--- +```ts +formatDiagnostic(diagnostic): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostic` | [`Diagnostic`](../interfaces/Diagnostic.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/formatIdentifier.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/formatIdentifier.md new file mode 100644 index 0000000000..5d9b2fb07b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/formatIdentifier.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] formatIdentifier" + +--- +```ts +formatIdentifier(sv): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `sv` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/formatTypeSpec.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/formatTypeSpec.md new file mode 100644 index 0000000000..192a98bad0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/formatTypeSpec.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] formatTypeSpec" + +--- +```ts +formatTypeSpec(code, prettierConfig?): Promise +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `string` | +| `prettierConfig`? | `Options` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getAllTags.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getAllTags.md new file mode 100644 index 0000000000..84842b3203 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getAllTags.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getAllTags" + +--- +```ts +getAllTags(program, target): string[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Interface`](../interfaces/Interface.md) \| [`Namespace`](../interfaces/Namespace.md) \| [`Operation`](../interfaces/Operation.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getAnyExtensionFromPath.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getAnyExtensionFromPath.md new file mode 100644 index 0000000000..926dfc20bb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getAnyExtensionFromPath.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] getAnyExtensionFromPath" + +--- +```ts +getAnyExtensionFromPath(path): string +``` + +Gets the file extension for a path. +Normalizes it to lower case. + +```ts +getAnyExtensionFromPath("/path/to/file.ext") === ".ext" +getAnyExtensionFromPath("/path/to/file.ext/") === ".ext" +getAnyExtensionFromPath("/path/to/file") === "" +getAnyExtensionFromPath("/path/to.ext/file") === "" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getBaseFileName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getBaseFileName.md new file mode 100644 index 0000000000..098a86d805 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getBaseFileName.md @@ -0,0 +1,42 @@ +--- +jsApi: true +title: "[F] getBaseFileName" + +--- +```ts +getBaseFileName(path): string +``` + +Returns the path except for its containing directory name. +Semantics align with NodeJS's `path.basename` except that we support URL's as well. + +```ts +// POSIX +getBaseFileName("/path/to/file.ext") === "file.ext" +getBaseFileName("/path/to/") === "to" +getBaseFileName("/") === "" +// DOS +getBaseFileName("c:/path/to/file.ext") === "file.ext" +getBaseFileName("c:/path/to/") === "to" +getBaseFileName("c:/") === "" +getBaseFileName("c:") === "" +// URL +getBaseFileName("http://typescriptlang.org/path/to/file.ext") === "file.ext" +getBaseFileName("http://typescriptlang.org/path/to/") === "to" +getBaseFileName("http://typescriptlang.org/") === "" +getBaseFileName("http://typescriptlang.org") === "" +getBaseFileName("file://server/path/to/file.ext") === "file.ext" +getBaseFileName("file://server/path/to/") === "to" +getBaseFileName("file://server/") === "" +getBaseFileName("file://server") === "" +getBaseFileName("file:///path/to/file.ext") === "file.ext" +getBaseFileName("file:///path/to/") === "to" +getBaseFileName("file:///") === "" +getBaseFileName("file://") === "" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDeprecated.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDeprecated.md new file mode 100644 index 0000000000..e4892a5c03 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDeprecated.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getDeprecated" + +--- +```ts +getDeprecated(program, type): string | undefined +``` + +Return the deprecated message or undefined if not deprecated + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `type` | [`Type`](../type-aliases/Type.md) | Type | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDeprecationDetails.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDeprecationDetails.md new file mode 100644 index 0000000000..20c3d97981 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDeprecationDetails.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getDeprecationDetails" + +--- +```ts +getDeprecationDetails(program, typeOrNode): DeprecationDetails | undefined +``` + +Returns complete deprecation details for the given type or node + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `typeOrNode` | [`Node`](../type-aliases/Node.md) \| [`Type`](../type-aliases/Type.md) | A Type or Node to check for deprecation | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDirectoryPath.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDirectoryPath.md new file mode 100644 index 0000000000..09e9fb5c6d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDirectoryPath.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] getDirectoryPath" + +--- +```ts +getDirectoryPath(path): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDiscriminatedTypes.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDiscriminatedTypes.md new file mode 100644 index 0000000000..7a83bf4fa8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDiscriminatedTypes.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] getDiscriminatedTypes" + +--- +```ts +getDiscriminatedTypes(program): [Model | Union, Discriminator][] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDiscriminatedUnion.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDiscriminatedUnion.md new file mode 100644 index 0000000000..c36f6f8f93 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDiscriminatedUnion.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getDiscriminatedUnion" + +--- +```ts +getDiscriminatedUnion(type, discriminator): [DiscriminatedUnion, readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Model`](../interfaces/Model.md) \| [`Union`](../interfaces/Union.md) | +| `discriminator` | [`Discriminator`](../interfaces/Discriminator.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDiscriminator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDiscriminator.md new file mode 100644 index 0000000000..1724d156b9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDiscriminator.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getDiscriminator" + +--- +```ts +getDiscriminator(program, entity): Discriminator | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `entity` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDoc.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDoc.md new file mode 100644 index 0000000000..2b08b48af4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDoc.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getDoc" + +--- +```ts +getDoc(program, target): string | undefined +``` + +Get the documentation string for the given type. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Type | + +## Returns + +Documentation value diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDocData.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDocData.md new file mode 100644 index 0000000000..900ff26995 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDocData.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getDocData" + +--- +```ts +getDocData(program, target): DocData | undefined +``` + +Get the documentation information for the given type. In most cases you probably just want to use [getDoc](getDoc.md) + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Type | + +## Returns + +Doc data with source information. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDocDataInternal.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDocDataInternal.md new file mode 100644 index 0000000000..c73a26414a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getDocDataInternal.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] getDocDataInternal" + +--- +```ts +getDocDataInternal( + program, + target, + key): DocData | undefined +``` + +Get the documentation information for the given type. In most cases you probably just want to use [getDoc](getDoc.md) + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Type | +| `key` | `DocTarget` | - | + +## Returns + +Doc data with source information. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getEffectiveModelType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getEffectiveModelType.md new file mode 100644 index 0000000000..2d275dcb46 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getEffectiveModelType.md @@ -0,0 +1,30 @@ +--- +jsApi: true +title: "[F] getEffectiveModelType" + +--- +```ts +getEffectiveModelType( + program, + model, + filter?): Model +``` + +If the input is anonymous (or the provided filter removes properties) +and there exists a named model with the same set of properties +(ignoring filtered properties), then return that named model. +Otherwise, return the input unchanged. + +This can be used by emitters to find a better name for a set of +properties after filtering. For example, given `{ @metadata prop: +string} & SomeName`, and an emitter that wishes to discard properties +marked with `@metadata`, the emitter can use this to recover that the +best name for the remaining properties is `SomeName`. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | - | +| `model` | [`Model`](../interfaces/Model.md) | The input model | +| `filter`? | (`property`) => `boolean` | An optional filter to apply to the input model's
properties. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getEncode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getEncode.md new file mode 100644 index 0000000000..5ecc32b123 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getEncode.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getEncode" + +--- +```ts +getEncode(program, target): EncodeData | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getErrorsDoc.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getErrorsDoc.md new file mode 100644 index 0000000000..b378e4f8a0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getErrorsDoc.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getErrorsDoc" + +--- +```ts +getErrorsDoc(program, target): string | undefined +``` + +Get the documentation string for the return errors types of an operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Operation`](../interfaces/Operation.md) | Type | + +## Returns + +Documentation value diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getErrorsDocData.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getErrorsDocData.md new file mode 100644 index 0000000000..8195cd85be --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getErrorsDocData.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getErrorsDocData" + +--- +```ts +getErrorsDocData(program, target): DocData | undefined +``` + +Get the documentation information for the return errors types of an operation. In most cases you probably just want to use [getErrorsDoc](getErrorsDoc.md) + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Operation`](../interfaces/Operation.md) | Type | + +## Returns + +Doc data with source information. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFirstAncestor.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFirstAncestor.md new file mode 100644 index 0000000000..9693bad1a2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFirstAncestor.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getFirstAncestor" + +--- +```ts +getFirstAncestor(node, test): Node | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | +| `test` | [`NodeCallback`](../type-aliases/NodeCallback.md)<`boolean`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFormat.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFormat.md new file mode 100644 index 0000000000..fa56fe4d5b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFormat.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getFormat" + +--- +```ts +getFormat(program, target): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFriendlyName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFriendlyName.md new file mode 100644 index 0000000000..e4505f13ff --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFriendlyName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getFriendlyName" + +--- +```ts +getFriendlyName(program, target): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFullyQualifiedSymbolName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFullyQualifiedSymbolName.md new file mode 100644 index 0000000000..401e425dc3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getFullyQualifiedSymbolName.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] getFullyQualifiedSymbolName" + +--- +```ts +getFullyQualifiedSymbolName(sym, options?): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `sym` | `undefined` \| [`Sym`](../interfaces/Sym.md) | +| `options`? | `object` | +| `options.useGlobalPrefixAtTopLevel`? | `boolean` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getIdentifierContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getIdentifierContext.md new file mode 100644 index 0000000000..e3ca1cce9e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getIdentifierContext.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] getIdentifierContext" + +--- +```ts +getIdentifierContext(id): IdentifierContext +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `id` | [`IdentifierNode`](../interfaces/IdentifierNode.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getIndexer.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getIndexer.md new file mode 100644 index 0000000000..4863028569 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getIndexer.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getIndexer" + +--- +```ts +getIndexer(program, target): ModelIndexer | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getKeyName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getKeyName.md new file mode 100644 index 0000000000..e2a70b9377 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getKeyName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getKeyName" + +--- +```ts +getKeyName(program, property): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `property` | [`ModelProperty`](../interfaces/ModelProperty.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getKnownValues.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getKnownValues.md new file mode 100644 index 0000000000..cbd810f433 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getKnownValues.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getKnownValues" + +--- +```ts +getKnownValues(program, target): Enum | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getListOperationType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getListOperationType.md new file mode 100644 index 0000000000..1fe0e816cd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getListOperationType.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getListOperationType" + +--- +```ts +getListOperationType(program, target): Model | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | + +## Returns + +## Deprecated + +This function is unused and will be removed in a future release. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getLocationContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getLocationContext.md new file mode 100644 index 0000000000..777afc5f40 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getLocationContext.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getLocationContext" + +--- +```ts +getLocationContext(program, type): LocationContext +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `type` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxItems.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxItems.md new file mode 100644 index 0000000000..7cb3e4d67d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxItems.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxItems" + +--- +```ts +getMaxItems(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxLength.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxLength.md new file mode 100644 index 0000000000..a50ec1b3df --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxLength.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxLength" + +--- +```ts +getMaxLength(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxValue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxValue.md new file mode 100644 index 0000000000..2d479ac26b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxValue.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxValue" + +--- +```ts +getMaxValue(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxValueExclusive.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxValueExclusive.md new file mode 100644 index 0000000000..959c9a34cc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMaxValueExclusive.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxValueExclusive" + +--- +```ts +getMaxValueExclusive(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinItems.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinItems.md new file mode 100644 index 0000000000..7870992962 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinItems.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinItems" + +--- +```ts +getMinItems(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinLength.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinLength.md new file mode 100644 index 0000000000..c9744ceb9b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinLength.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinLength" + +--- +```ts +getMinLength(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinValue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinValue.md new file mode 100644 index 0000000000..207797213c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinValue.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinValue" + +--- +```ts +getMinValue(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinValueExclusive.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinValueExclusive.md new file mode 100644 index 0000000000..4757f840bb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getMinValueExclusive.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinValueExclusive" + +--- +```ts +getMinValueExclusive(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNamespaceFullName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNamespaceFullName.md new file mode 100644 index 0000000000..082647b9f4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNamespaceFullName.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getNamespaceFullName" + +--- +```ts +getNamespaceFullName(type, options?): string +``` + +Return the full name of the namespace(e.g. "Foo.Bar") + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `type` | [`Namespace`](../interfaces/Namespace.md) | namespace type | +| `options`? | [`TypeNameOptions`](../interfaces/TypeNameOptions.md) | | + +## Returns diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNodeAtPosition.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNodeAtPosition.md new file mode 100644 index 0000000000..1f6ad69ebb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNodeAtPosition.md @@ -0,0 +1,46 @@ +--- +jsApi: true +title: "[F] getNodeAtPosition" + +--- +## getNodeAtPosition(script, position, filter) + +```ts +getNodeAtPosition( + script, + position, + filter?): Node | undefined +``` + +Resolve the node in the syntax tree that that is at the given position. + +### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `script` | [`TypeSpecScriptNode`](../interfaces/TypeSpecScriptNode.md) | TypeSpec Script node | +| `position` | `number` | Position | +| `filter`? | (`node`) => `boolean` | Filter if wanting to return a parent containing node early. | + +## getNodeAtPosition(script, position, filter) + +```ts +getNodeAtPosition( + script, + position, + filter): T | undefined +``` + +### Type parameters + +| Parameter | +| :------ | +| `T` extends [`Node`](../type-aliases/Node.md) | + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `script` | [`TypeSpecScriptNode`](../interfaces/TypeSpecScriptNode.md) | +| `position` | `number` | +| `filter` | (`node`) => `node is T` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNormalizedAbsolutePath.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNormalizedAbsolutePath.md new file mode 100644 index 0000000000..b99530643f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNormalizedAbsolutePath.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getNormalizedAbsolutePath" + +--- +```ts +getNormalizedAbsolutePath(fileName, currentDirectory): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `fileName` | `string` | +| `currentDirectory` | `undefined` \| `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNormalizedAbsolutePathWithoutRoot.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNormalizedAbsolutePathWithoutRoot.md new file mode 100644 index 0000000000..775cb25199 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNormalizedAbsolutePathWithoutRoot.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getNormalizedAbsolutePathWithoutRoot" + +--- +```ts +getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `fileName` | `string` | +| `currentDirectory` | `undefined` \| `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNormalizedPathComponents.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNormalizedPathComponents.md new file mode 100644 index 0000000000..ba4aa440f8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getNormalizedPathComponents.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] getNormalizedPathComponents" + +--- +```ts +getNormalizedPathComponents(path, currentDirectory): string[] +``` + +Parse a path into an array containing a root component (at index 0) and zero or more path +components (at indices > 0). The result is normalized. +If the path is relative, the root component is `""`. +If the path is absolute, the root component includes the first path separator (`/`). + +```ts +getNormalizedPathComponents("to/dir/../file.ext", "/path/") === ["/", "path", "to", "file.ext"] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | +| `currentDirectory` | `undefined` \| `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getOverloadedOperation.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getOverloadedOperation.md new file mode 100644 index 0000000000..44a24c99ba --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getOverloadedOperation.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getOverloadedOperation" + +--- +```ts +getOverloadedOperation(program, operation): Operation | undefined +``` + +If the given operation overloads another operation, return that operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `operation` | [`Operation`](../interfaces/Operation.md) | The operation to check for an overload target. | + +## Returns + +The operation this operation overloads, if any. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getOverloads.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getOverloads.md new file mode 100644 index 0000000000..82cc080bd7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getOverloads.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getOverloads" + +--- +```ts +getOverloads(program, operation): Operation[] | undefined +``` + +Get all operations that are marked as overloads of the given operation + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `operation` | [`Operation`](../interfaces/Operation.md) | Operation | + +## Returns + +An array of operations that overload the given operation. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getOverriddenProperty.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getOverriddenProperty.md new file mode 100644 index 0000000000..cb2984a2aa --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getOverriddenProperty.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getOverriddenProperty" + +--- +```ts +getOverriddenProperty(property): ModelProperty | undefined +``` + +Gets the property from the nearest base type that is overridden by the +given property, if any. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | [`ModelProperty`](../interfaces/ModelProperty.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getParameterVisibility.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getParameterVisibility.md new file mode 100644 index 0000000000..47ea057c94 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getParameterVisibility.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getParameterVisibility" + +--- +```ts +getParameterVisibility(program, entity): string[] | undefined +``` + +Returns the visibilities of the parameters of the given operation, if provided with `@parameterVisibility`. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `entity` | [`Operation`](../interfaces/Operation.md) | + +## Returns + +## See + +[$parameterVisibility]($parameterVisibility.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getParentTemplateNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getParentTemplateNode.md new file mode 100644 index 0000000000..6018d40cec --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getParentTemplateNode.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[F] getParentTemplateNode" + +--- +```ts +getParentTemplateNode(node): Node & TemplateDeclarationNode | undefined +``` + +Lookup and find the node + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | Node | + +## Returns + +Template Parent node if applicable diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPathComponents.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPathComponents.md new file mode 100644 index 0000000000..311769b9f8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPathComponents.md @@ -0,0 +1,45 @@ +--- +jsApi: true +title: "[F] getPathComponents" + +--- +```ts +getPathComponents(path, currentDirectory): string[] +``` + +Parse a path into an array containing a root component (at index 0) and zero or more path +components (at indices > 0). The result is not normalized. +If the path is relative, the root component is `""`. +If the path is absolute, the root component includes the first path separator (`/`). + +```ts +// POSIX +getPathComponents("/path/to/file.ext") === ["/", "path", "to", "file.ext"] +getPathComponents("/path/to/") === ["/", "path", "to"] +getPathComponents("/") === ["/"] +// DOS +getPathComponents("c:/path/to/file.ext") === ["c:/", "path", "to", "file.ext"] +getPathComponents("c:/path/to/") === ["c:/", "path", "to"] +getPathComponents("c:/") === ["c:/"] +getPathComponents("c:") === ["c:"] +// URL +getPathComponents("http://typescriptlang.org/path/to/file.ext") === ["http://typescriptlang.org/", "path", "to", "file.ext"] +getPathComponents("http://typescriptlang.org/path/to/") === ["http://typescriptlang.org/", "path", "to"] +getPathComponents("http://typescriptlang.org/") === ["http://typescriptlang.org/"] +getPathComponents("http://typescriptlang.org") === ["http://typescriptlang.org"] +getPathComponents("file://server/path/to/file.ext") === ["file://server/", "path", "to", "file.ext"] +getPathComponents("file://server/path/to/") === ["file://server/", "path", "to"] +getPathComponents("file://server/") === ["file://server/"] +getPathComponents("file://server") === ["file://server"] +getPathComponents("file:///path/to/file.ext") === ["file:///", "path", "to", "file.ext"] +getPathComponents("file:///path/to/") === ["file:///", "path", "to"] +getPathComponents("file:///") === ["file:///"] +getPathComponents("file://") === ["file://"] +``` + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `path` | `string` | `undefined` | +| `currentDirectory` | `string` | `""` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPathFromPathComponents.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPathFromPathComponents.md new file mode 100644 index 0000000000..5a94cdbcc3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPathFromPathComponents.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getPathFromPathComponents" + +--- +```ts +getPathFromPathComponents(pathComponents): string +``` + +Formats a parsed path consisting of a root component (at index 0) and zero or more path +segments (at indices > 0). + +```ts +getPathFromPathComponents(["/", "path", "to", "file.ext"]) === "/path/to/file.ext" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `pathComponents` | readonly `string`[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPattern.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPattern.md new file mode 100644 index 0000000000..a576476ddc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPattern.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getPattern" + +--- +```ts +getPattern(program, target): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getProjectedName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getProjectedName.md new file mode 100644 index 0000000000..4ec1c9bdd7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getProjectedName.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] getProjectedName" + +--- +```ts +getProjectedName( + program, + target, + projectionName): string | undefined +``` + +Get the projected name of the given entity for the given projection. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Target | +| `projectionName` | `string` | - | + +## Returns + +Projected name for the given projection diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getProjectedNames.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getProjectedNames.md new file mode 100644 index 0000000000..d0148033fb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getProjectedNames.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getProjectedNames" + +--- +```ts +getProjectedNames(program, target): ReadonlyMap | undefined +``` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Target | + +## Returns + +Map of the projected names for the given entity. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getProperty.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getProperty.md new file mode 100644 index 0000000000..4f0e4322e5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getProperty.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getProperty" + +--- +```ts +getProperty(type, propertyName): ModelProperty | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Model`](../interfaces/Model.md) | +| `propertyName` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPropertyType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPropertyType.md new file mode 100644 index 0000000000..07dcdac223 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getPropertyType.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] getPropertyType" + +--- +```ts +getPropertyType(target): Type +``` + +Return the type of the property or the model itself. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getRelativePathFromDirectory.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getRelativePathFromDirectory.md new file mode 100644 index 0000000000..9543c34627 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getRelativePathFromDirectory.md @@ -0,0 +1,42 @@ +--- +jsApi: true +title: "[F] getRelativePathFromDirectory" + +--- +## getRelativePathFromDirectory(from, to, ignoreCase) + +```ts +getRelativePathFromDirectory( + from, + to, + ignoreCase): string +``` + +Gets a relative path that can be used to traverse between `from` and `to`. + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `from` | `string` | +| `to` | `string` | +| `ignoreCase` | `boolean` | + +## getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileName) + +```ts +getRelativePathFromDirectory( + fromDirectory, + to, + getCanonicalFileName): string +``` + +Gets a relative path that can be used to traverse between `from` and `to`. + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `fromDirectory` | `string` | +| `to` | `string` | +| `getCanonicalFileName` | `GetCanonicalFileName` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getReturnTypeVisibility.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getReturnTypeVisibility.md new file mode 100644 index 0000000000..d9b693307b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getReturnTypeVisibility.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getReturnTypeVisibility" + +--- +```ts +getReturnTypeVisibility(program, entity): string[] | undefined +``` + +Returns the visibilities of the return type of the given operation, if provided with `@returnTypeVisibility`. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `entity` | [`Operation`](../interfaces/Operation.md) | + +## Returns + +## See + +[$returnTypeVisibility]($returnTypeVisibility.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getReturnsDoc.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getReturnsDoc.md new file mode 100644 index 0000000000..57cbc718ae --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getReturnsDoc.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getReturnsDoc" + +--- +```ts +getReturnsDoc(program, target): string | undefined +``` + +Get the documentation string for the return success types of an operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Operation`](../interfaces/Operation.md) | Type | + +## Returns + +Documentation value diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getReturnsDocData.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getReturnsDocData.md new file mode 100644 index 0000000000..dfb32ab10d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getReturnsDocData.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getReturnsDocData" + +--- +```ts +getReturnsDocData(program, target): DocData | undefined +``` + +Get the documentation information for the return success types of an operation. In most cases you probably just want to use [getReturnsDoc](getReturnsDoc.md) + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Operation`](../interfaces/Operation.md) | Type | + +## Returns + +Doc data with source information. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getRootLength.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getRootLength.md new file mode 100644 index 0000000000..146e8f71c4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getRootLength.md @@ -0,0 +1,38 @@ +--- +jsApi: true +title: "[F] getRootLength" + +--- +```ts +getRootLength(path): number +``` + +Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files"). + +For example: +```ts +getRootLength("a") === 0 // "" +getRootLength("/") === 1 // "/" +getRootLength("c:") === 2 // "c:" +getRootLength("c:d") === 0 // "" +getRootLength("c:/") === 3 // "c:/" +getRootLength("c:\\") === 3 // "c:\\" +getRootLength("//server") === 7 // "//server" +getRootLength("//server/share") === 8 // "//server/" +getRootLength("\\\\server") === 7 // "\\\\server" +getRootLength("\\\\server\\share") === 8 // "\\\\server\\" +getRootLength("file:///path") === 8 // "file:///" +getRootLength("file:///c:") === 10 // "file:///c:" +getRootLength("file:///c:d") === 8 // "file:///" +getRootLength("file:///c:/path") === 11 // "file:///c:/" +getRootLength("file://server") === 13 // "file://server" +getRootLength("file://server/path") === 14 // "file://server/" +getRootLength("http://server") === 13 // "http://server" +getRootLength("http://server/path") === 14 // "http://server/" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getService.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getService.md new file mode 100644 index 0000000000..dac6220099 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getService.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getService" + +--- +```ts +getService(program, namespace): Service | undefined +``` + +Get the service information for the given namespace. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Service namespace | + +## Returns + +Service information or undefined if namespace is not a service namespace. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getSourceFileKindFromExt.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getSourceFileKindFromExt.md new file mode 100644 index 0000000000..0519c5c2e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getSourceFileKindFromExt.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] getSourceFileKindFromExt" + +--- +```ts +getSourceFileKindFromExt(path): SourceFileKind | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getSourceLocation.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getSourceLocation.md new file mode 100644 index 0000000000..8715826c64 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getSourceLocation.md @@ -0,0 +1,43 @@ +--- +jsApi: true +title: "[F] getSourceLocation" + +--- +## getSourceLocation(target, options) + +```ts +getSourceLocation(target, options?): SourceLocation +``` + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | +| `options`? | [`SourceLocationOptions`](../interfaces/SourceLocationOptions.md) | + +## getSourceLocation(target, options) + +```ts +getSourceLocation(target, options?): undefined +``` + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | `undefined` \| *typeof* [`NoTarget`](../variables/NoTarget.md) | +| `options`? | [`SourceLocationOptions`](../interfaces/SourceLocationOptions.md) | + +## getSourceLocation(target, options) + +```ts +getSourceLocation(target, options?): SourceLocation | undefined +``` + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | `undefined` \| [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | +| `options`? | [`SourceLocationOptions`](../interfaces/SourceLocationOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getSummary.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getSummary.md new file mode 100644 index 0000000000..2d75b04224 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getSummary.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getSummary" + +--- +```ts +getSummary(program, type): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getTags.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getTags.md new file mode 100644 index 0000000000..5abc746d9f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getTags.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getTags" + +--- +```ts +getTags(program, target): string[] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getTypeName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getTypeName.md new file mode 100644 index 0000000000..f0afc39009 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getTypeName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getTypeName" + +--- +```ts +getTypeName(type, options?): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) \| [`ValueType`](../interfaces/ValueType.md) | +| `options`? | [`TypeNameOptions`](../interfaces/TypeNameOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getVisibility.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getVisibility.md new file mode 100644 index 0000000000..d1f4c4ff4a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/getVisibility.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getVisibility" + +--- +```ts +getVisibility(program, target): string[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/hasParseError.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/hasParseError.md new file mode 100644 index 0000000000..a79a0b6c81 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/hasParseError.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] hasParseError" + +--- +```ts +hasParseError(node): number | true +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/hasProjectedName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/hasProjectedName.md new file mode 100644 index 0000000000..d4adfd20dd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/hasProjectedName.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] hasProjectedName" + +--- +```ts +hasProjectedName( + program, + target, + projectionName): boolean +``` + +Get the projected name of the given entity for the given projection. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Target | +| `projectionName` | `string` | - | + +## Returns + +Projected name for the given projection diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/hasTrailingDirectorySeparator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/hasTrailingDirectorySeparator.md new file mode 100644 index 0000000000..9c12615003 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/hasTrailingDirectorySeparator.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] hasTrailingDirectorySeparator" + +--- +```ts +hasTrailingDirectorySeparator(path): boolean +``` + +Determines whether a path has a trailing separator (`/` or `\\`). + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/ignoreDiagnostics.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/ignoreDiagnostics.md new file mode 100644 index 0000000000..cce487fbd2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/ignoreDiagnostics.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[F] ignoreDiagnostics" + +--- +```ts +ignoreDiagnostics(result): T +``` + +Ignore the diagnostics emitted by the diagnostic accessor pattern and just return the actual result. + +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `result` | [`DiagnosticResult`](../type-aliases/DiagnosticResult.md)<`T`\> | + +## Returns + +Actual result. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/interpolatePath.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/interpolatePath.md new file mode 100644 index 0000000000..313652ce1b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/interpolatePath.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] interpolatePath" + +--- +```ts +interpolatePath(pathTemplate, predefinedVariables): string +``` + +Interpolate a path template + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `pathTemplate` | `string` | Path template | +| `predefinedVariables` | `Record`<`string`, `undefined` \| `string`\> | Variables that can be used in the path template. | + +## Returns diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isAnyDirectorySeparator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isAnyDirectorySeparator.md new file mode 100644 index 0000000000..409e3f1606 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isAnyDirectorySeparator.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] isAnyDirectorySeparator" + +--- +```ts +isAnyDirectorySeparator(charCode): boolean +``` + +Determines whether a charCode corresponds to `/` or ``. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `charCode` | `number` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isArrayModelType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isArrayModelType.md new file mode 100644 index 0000000000..b9217fa59c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isArrayModelType.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isArrayModelType" + +--- +```ts +isArrayModelType(program, type): type is ArrayModelType +``` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | - | +| `type` | [`Model`](../interfaces/Model.md) | Model type | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isCadlValueTypeOf.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isCadlValueTypeOf.md new file mode 100644 index 0000000000..54f967b04e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isCadlValueTypeOf.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] isCadlValueTypeOf" + +--- +```ts +isCadlValueTypeOf(target, expectedType): target is InferredTypeSpecValue +``` + +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](../type-aliases/TypeKind.md) | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | [`TypeSpecValue`](../type-aliases/TypeSpecValue.md) | +| `expectedType` | `K` \| readonly `K`[] | + +## Returns + +## Deprecated + +use isTypeSpecValueTypeOf diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isComment.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isComment.md new file mode 100644 index 0000000000..3d2236928e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isComment.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isComment" + +--- +```ts +isComment(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isDeclaredInNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isDeclaredInNamespace.md new file mode 100644 index 0000000000..d801e0f281 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isDeclaredInNamespace.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] isDeclaredInNamespace" + +--- +```ts +isDeclaredInNamespace( + type, + namespace, + options): boolean +``` + +Check if the given type is declared in the specified namespace or, optionally, its child namespaces. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `type` | \| [`Model`](../interfaces/Model.md) \| [`Interface`](../interfaces/Interface.md) \| [`Enum`](../interfaces/Enum.md) \| [`Namespace`](../interfaces/Namespace.md) \| [`Operation`](../interfaces/Operation.md) | Type | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Namespace | +| `options` | `object` | - | +| `options.recursive`? | `boolean` | - | + +## Returns diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isDeclaredType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isDeclaredType.md new file mode 100644 index 0000000000..f8a99abd28 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isDeclaredType.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[F] isDeclaredType" + +--- +```ts +isDeclaredType(type): boolean +``` + +Check if the type is a declared type. This include: +- non templated type +- template declaration + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isDeprecated.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isDeprecated.md new file mode 100644 index 0000000000..e18babc8df --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isDeprecated.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] isDeprecated" + +--- +```ts +isDeprecated(program, type): boolean +``` + +Check if the given type is deprecated + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `type` | [`Type`](../type-aliases/Type.md) | Type | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isErrorModel.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isErrorModel.md new file mode 100644 index 0000000000..d518300a41 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isErrorModel.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isErrorModel" + +--- +```ts +isErrorModel(program, target): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isErrorType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isErrorType.md new file mode 100644 index 0000000000..7d7dbfe785 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isErrorType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isErrorType" + +--- +```ts +isErrorType(type): type is ErrorType +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isGlobalNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isGlobalNamespace.md new file mode 100644 index 0000000000..e7585f42b9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isGlobalNamespace.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] isGlobalNamespace" + +--- +```ts +isGlobalNamespace(program, namespace): namespace is Namespace & Object +``` + +Check if the given namespace is the global namespace + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Namespace | + +## Returns diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isImportStatement.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isImportStatement.md new file mode 100644 index 0000000000..15c4f80906 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isImportStatement.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isImportStatement" + +--- +```ts +isImportStatement(node): node is ImportStatementNode +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isIntrinsicType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isIntrinsicType.md new file mode 100644 index 0000000000..1de7bd9afa --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isIntrinsicType.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] isIntrinsicType" + +--- +```ts +isIntrinsicType( + program, + type, + kind): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `type` | [`Scalar`](../interfaces/Scalar.md) | +| `kind` | [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isKey.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isKey.md new file mode 100644 index 0000000000..b0e2c670e4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isKey.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isKey" + +--- +```ts +isKey(program, property): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `property` | [`ModelProperty`](../interfaces/ModelProperty.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isKeyword.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isKeyword.md new file mode 100644 index 0000000000..e15e18440b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isKeyword.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isKeyword" + +--- +```ts +isKeyword(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isListOperation.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isListOperation.md new file mode 100644 index 0000000000..a694ab1a7a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isListOperation.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isListOperation" + +--- +```ts +isListOperation(program, target): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Operation`](../interfaces/Operation.md) | + +## Returns + +## Deprecated + +Use `isListOperation` in `@typespec/rest` instead. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isModifier.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isModifier.md new file mode 100644 index 0000000000..de8bf19e0e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isModifier.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isModifier" + +--- +```ts +isModifier(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isNeverType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isNeverType.md new file mode 100644 index 0000000000..a0736e7b10 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isNeverType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isNeverType" + +--- +```ts +isNeverType(type): type is NeverType +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isNullType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isNullType.md new file mode 100644 index 0000000000..33d1d99183 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isNullType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isNullType" + +--- +```ts +isNullType(type): type is NullType +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isNumericType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isNumericType.md new file mode 100644 index 0000000000..4d8ca679a7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isNumericType.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isNumericType" + +--- +```ts +isNumericType(program, target): target is Scalar +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) \| [`ProjectedProgram`](../interfaces/ProjectedProgram.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isPathAbsolute.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isPathAbsolute.md new file mode 100644 index 0000000000..ceb4586309 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isPathAbsolute.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isPathAbsolute" + +--- +```ts +isPathAbsolute(path): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isProjectedProgram.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isProjectedProgram.md new file mode 100644 index 0000000000..51e055c943 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isProjectedProgram.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isProjectedProgram" + +--- +```ts +isProjectedProgram(program): program is ProjectedProgram +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) \| [`ProjectedProgram`](../interfaces/ProjectedProgram.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isPunctuation.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isPunctuation.md new file mode 100644 index 0000000000..5661e7072e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isPunctuation.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isPunctuation" + +--- +```ts +isPunctuation(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isRecordModelType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isRecordModelType.md new file mode 100644 index 0000000000..96d0f644fe --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isRecordModelType.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] isRecordModelType" + +--- +```ts +isRecordModelType(program, type): type is ArrayModelType +``` + +Check if a model is an array type. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | - | +| `type` | [`Model`](../interfaces/Model.md) | Model type | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isSecret.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isSecret.md new file mode 100644 index 0000000000..ae5e2b48a6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isSecret.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isSecret" + +--- +```ts +isSecret(program, target): boolean | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isService.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isService.md new file mode 100644 index 0000000000..8a9f0b3960 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isService.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isService" + +--- +```ts +isService(program, namespace): boolean +``` + +Check if the namespace is defined as a service. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Namespace | + +## Returns + +Boolean diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isStatementKeyword.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isStatementKeyword.md new file mode 100644 index 0000000000..3bec936aee --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isStatementKeyword.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isStatementKeyword" + +--- +```ts +isStatementKeyword(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isStdNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isStdNamespace.md new file mode 100644 index 0000000000..80924c73d1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isStdNamespace.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isStdNamespace" + +--- +```ts +isStdNamespace(namespace): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isStringType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isStringType.md new file mode 100644 index 0000000000..efd49ecc3b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isStringType.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isStringType" + +--- +```ts +isStringType(program, target): target is Scalar +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) \| [`ProjectedProgram`](../interfaces/ProjectedProgram.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTemplateDeclaration.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTemplateDeclaration.md new file mode 100644 index 0000000000..517ed31640 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTemplateDeclaration.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] isTemplateDeclaration" + +--- +```ts +isTemplateDeclaration(type): type is Object +``` + +Resolve if the type is a template type declaration(Non initialized template type). + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`TemplatedType`](../type-aliases/TemplatedType.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTemplateDeclarationOrInstance.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTemplateDeclarationOrInstance.md new file mode 100644 index 0000000000..24d5c94d55 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTemplateDeclarationOrInstance.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] isTemplateDeclarationOrInstance" + +--- +```ts +isTemplateDeclarationOrInstance(type): boolean +``` + +Resolve if the type was created from a template type or is a template type declaration. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`TemplatedType`](../type-aliases/TemplatedType.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTemplateInstance.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTemplateInstance.md new file mode 100644 index 0000000000..06a1f65608 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTemplateInstance.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] isTemplateInstance" + +--- +```ts +isTemplateInstance(type): type is Object +``` + +Check the given type is a finished template instance. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTrivia.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTrivia.md new file mode 100644 index 0000000000..6b02bc0f08 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTrivia.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isTrivia" + +--- +```ts +isTrivia(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTypeSpecValueTypeOf.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTypeSpecValueTypeOf.md new file mode 100644 index 0000000000..87e9641e04 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isTypeSpecValueTypeOf.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] isTypeSpecValueTypeOf" + +--- +```ts +isTypeSpecValueTypeOf(target, expectedType): target is InferredTypeSpecValue +``` + +Check if the given target is of any of the typespec types. + +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](../type-aliases/TypeKind.md) | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `target` | [`TypeSpecValue`](../type-aliases/TypeSpecValue.md) | Target to validate. | +| `expectedType` | `K` \| readonly `K`[] | One or multiple allowed typespec types. | + +## Returns + +boolean if the target is of one of the allowed types. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isUnknownType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isUnknownType.md new file mode 100644 index 0000000000..39fa7cfefc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isUnknownType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isUnknownType" + +--- +```ts +isUnknownType(type): type is UnknownType +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isUrl.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isUrl.md new file mode 100644 index 0000000000..670d518d6b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isUrl.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] isUrl" + +--- +```ts +isUrl(path): boolean +``` + +Determines whether a path starts with a URL scheme (e.g. starts with `http://`, `ftp://`, `file://`, etc.). + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isVisible.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isVisible.md new file mode 100644 index 0000000000..116add3394 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isVisible.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] isVisible" + +--- +```ts +isVisible( + program, + property, + visibilities): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `property` | [`ModelProperty`](../interfaces/ModelProperty.md) | +| `visibilities` | readonly `string`[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isVoidType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isVoidType.md new file mode 100644 index 0000000000..f8e9b3083f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/isVoidType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isVoidType" + +--- +```ts +isVoidType(type): type is VoidType +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/joinPaths.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/joinPaths.md new file mode 100644 index 0000000000..761a23b6c7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/joinPaths.md @@ -0,0 +1,32 @@ +--- +jsApi: true +title: "[F] joinPaths" + +--- +```ts +joinPaths(path, ...paths): string +``` + +Combines paths. If a path is absolute, it replaces any previous path. Relative paths are not simplified. + +```ts +// Non-rooted +joinPaths("path", "to", "file.ext") === "path/to/file.ext" +joinPaths("path", "dir", "..", "to", "file.ext") === "path/dir/../to/file.ext" +// POSIX +joinPaths("/path", "to", "file.ext") === "/path/to/file.ext" +joinPaths("/path", "/to", "file.ext") === "/to/file.ext" +// DOS +joinPaths("c:/path", "to", "file.ext") === "c:/path/to/file.ext" +joinPaths("c:/path", "c:/to", "file.ext") === "c:/to/file.ext" +// URL +joinPaths("file:///path", "to", "file.ext") === "file:///path/to/file.ext" +joinPaths("file:///path", "file:///to", "file.ext") === "file:///to/file.ext" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | +| ...`paths` | (`undefined` \| `string`)[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/listOperationsIn.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/listOperationsIn.md new file mode 100644 index 0000000000..7d35fa7450 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/listOperationsIn.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] listOperationsIn" + +--- +```ts +listOperationsIn(container, options): Operation[] +``` + +List operations in the given container. Will list operation recursively by default(Check subnamespaces.) + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `container` | [`Interface`](../interfaces/Interface.md) \| [`Namespace`](../interfaces/Namespace.md) | Container. | +| `options` | [`ListOperationOptions`](../interfaces/ListOperationOptions.md) | Options. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/listServices.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/listServices.md new file mode 100644 index 0000000000..c1c8ac3dec --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/listServices.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[F] listServices" + +--- +```ts +listServices(program): Service[] +``` + +List all the services defined in the typespec program + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | + +## Returns + +List of service. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/logDiagnostics.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/logDiagnostics.md new file mode 100644 index 0000000000..99216e7ad4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/logDiagnostics.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] logDiagnostics" + +--- +```ts +logDiagnostics(diagnostics, logger): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostics` | readonly [`Diagnostic`](../interfaces/Diagnostic.md)[] | +| `logger` | [`LogSink`](../interfaces/LogSink.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/logVerboseTestOutput.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/logVerboseTestOutput.md new file mode 100644 index 0000000000..064ff7e617 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/logVerboseTestOutput.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[F] logVerboseTestOutput" + +--- +```ts +logVerboseTestOutput(messageOrCallback): void +``` + +Verbose output is enabled by default for runs in mocha explorer in VS Code, +where the output is nicely associated with the individual test, and disabled +by default for command line runs where we don't want to spam the console. + +If the steps taken to produce the message are expensive, pass a callback +instead of producing the message then passing it here only to be dropped +when verbose output is disabled. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `messageOrCallback` | `string` \| (`log`) => `void` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/mapEventEmitterToNodeListener.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/mapEventEmitterToNodeListener.md new file mode 100644 index 0000000000..1d8cdc6aae --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/mapEventEmitterToNodeListener.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[F] mapEventEmitterToNodeListener" + +--- +```ts +mapEventEmitterToNodeListener(eventEmitter): SemanticNodeListener +``` + +Create a Semantic node listener from an event emitter. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `eventEmitter` | [`EventEmitter`](../classes/EventEmitter.md)<[`SemanticNodeListener`](../type-aliases/SemanticNodeListener.md)\> | Event emitter. | + +## Returns + +Semantic node listener. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/markDeprecated.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/markDeprecated.md new file mode 100644 index 0000000000..c65ddb6121 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/markDeprecated.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] markDeprecated" + +--- +```ts +markDeprecated( + program, + type, + details): void +``` + +Mark the given type as deprecated with the provided details. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `type` | [`Type`](../type-aliases/Type.md) | Type | +| `details` | [`DeprecationDetails`](../interfaces/DeprecationDetails.md) | Details of the deprecation | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/navigateProgram.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/navigateProgram.md new file mode 100644 index 0000000000..6f3fdc9654 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/navigateProgram.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] navigateProgram" + +--- +```ts +navigateProgram( + program, + listeners, + options): void +``` + +Navigate all types in the program. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program to navigate. | +| `listeners` | [`SemanticNodeListener`](../type-aliases/SemanticNodeListener.md) | Listener called when visiting types. | +| `options` | [`NavigationOptions`](../interfaces/NavigationOptions.md) | Navigation options. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/navigateType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/navigateType.md new file mode 100644 index 0000000000..c9d47f66b2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/navigateType.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] navigateType" + +--- +```ts +navigateType( + type, + listeners, + options): void +``` + +Navigate the given type and all the types that are used in it. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | Type to navigate. | +| `listeners` | [`SemanticNodeListener`](../type-aliases/SemanticNodeListener.md) | Listener for the types found. | +| `options` | [`NavigationOptions`](../interfaces/NavigationOptions.md) | Navigation options | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/navigateTypesInNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/navigateTypesInNamespace.md new file mode 100644 index 0000000000..c827c67660 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/navigateTypesInNamespace.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] navigateTypesInNamespace" + +--- +```ts +navigateTypesInNamespace( + namespace, + listeners, + options): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | +| `listeners` | `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` | +| `options` | [`NamespaceNavigationOptions`](../interfaces/NamespaceNavigationOptions.md) & [`NavigationOptions`](../interfaces/NavigationOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/normalizePath.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/normalizePath.md new file mode 100644 index 0000000000..74a9fceadf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/normalizePath.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] normalizePath" + +--- +```ts +normalizePath(path): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/normalizeSlashes.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/normalizeSlashes.md new file mode 100644 index 0000000000..9ed7a2775e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/normalizeSlashes.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] normalizeSlashes" + +--- +```ts +normalizeSlashes(path): string +``` + +Normalize path separators, converting `\` into `/`. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/paramMessage.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/paramMessage.md new file mode 100644 index 0000000000..e75e773936 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/paramMessage.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] paramMessage" + +--- +```ts +paramMessage(strings, ...keys): CallableMessage +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `string`[] | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `strings` | readonly `string`[] | +| ...`keys` | `T` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/parse.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/parse.md new file mode 100644 index 0000000000..07ce67685c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/parse.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] parse" + +--- +```ts +parse(code, options): TypeSpecScriptNode +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `string` \| [`SourceFile`](../interfaces/SourceFile.md) | +| `options` | [`ParseOptions`](../interfaces/ParseOptions.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/parseStandaloneTypeReference.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/parseStandaloneTypeReference.md new file mode 100644 index 0000000000..9f01d158d4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/parseStandaloneTypeReference.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] parseStandaloneTypeReference" + +--- +```ts +parseStandaloneTypeReference(code): [TypeReferenceNode, readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `string` \| [`SourceFile`](../interfaces/SourceFile.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/projectProgram.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/projectProgram.md new file mode 100644 index 0000000000..7ce0f39a58 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/projectProgram.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] projectProgram" + +--- +```ts +projectProgram( + program, + projections, + startNode?): ProjectedProgram +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `projections` | [`ProjectionApplication`](../interfaces/ProjectionApplication.md)[] | +| `startNode`? | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/reducePathComponents.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/reducePathComponents.md new file mode 100644 index 0000000000..d1c1773efe --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/reducePathComponents.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] reducePathComponents" + +--- +```ts +reducePathComponents(components): string[] +``` + +Reduce an array of path components to a more simplified path by navigating any +`"."` or `".."` entries in the path. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `components` | readonly `string`[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/removeTrailingDirectorySeparator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/removeTrailingDirectorySeparator.md new file mode 100644 index 0000000000..63b171f7dd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/removeTrailingDirectorySeparator.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] removeTrailingDirectorySeparator" + +--- +```ts +removeTrailingDirectorySeparator(path): string +``` + +Removes a trailing directory separator from a path, if it does not already have one. + +```ts +removeTrailingDirectorySeparator("/path/to/file.ext") === "/path/to/file.ext" +removeTrailingDirectorySeparator("/path/to/file.ext/") === "/path/to/file.ext" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/reportDeprecated.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/reportDeprecated.md new file mode 100644 index 0000000000..77840af0f3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/reportDeprecated.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] reportDeprecated" + +--- +```ts +reportDeprecated( + program, + message, + target): void +``` + +Report a deprecated diagnostic. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | TypeSpec Program. | +| `message` | `string` | Message describing the deprecation. | +| `target` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | Target of the deprecation. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolveCompilerOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolveCompilerOptions.md new file mode 100644 index 0000000000..b8db05d492 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolveCompilerOptions.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] resolveCompilerOptions" + +--- +```ts +resolveCompilerOptions(host, options): Promise<[CompilerOptions, readonly Diagnostic[]]> +``` + +Resolve the compiler options for the given entrypoint by resolving the tspconfig.yaml. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `host` | [`CompilerHost`](../interfaces/CompilerHost.md) | Compiler host | +| `options` | [`ResolveCompilerOptionsOptions`](../interfaces/ResolveCompilerOptionsOptions.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolveModule.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolveModule.md new file mode 100644 index 0000000000..4f233e9c6b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolveModule.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] resolveModule" + +--- +```ts +resolveModule( + host, + name, +options): Promise +``` + +Resolve a module + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `host` | [`ResolveModuleHost`](../interfaces/ResolveModuleHost.md) | | +| `name` | `string` | | +| `options` | [`ResolveModuleOptions`](../interfaces/ResolveModuleOptions.md) | | + +## Returns diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolvePath.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolvePath.md new file mode 100644 index 0000000000..b9c37cfbdd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolvePath.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] resolvePath" + +--- +```ts +resolvePath(path, ...paths): string +``` + +Combines and resolves paths. If a path is absolute, it replaces any previous path. Any +`.` and `..` path components are resolved. Trailing directory separators are preserved. + +```ts +resolvePath("/path", "to", "file.ext") === "path/to/file.ext" +resolvePath("/path", "to", "file.ext/") === "path/to/file.ext/" +resolvePath("/path", "dir", "..", "to", "file.ext") === "path/to/file.ext" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | +| ...`paths` | (`undefined` \| `string`)[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolveUsages.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolveUsages.md new file mode 100644 index 0000000000..8e45b17886 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/resolveUsages.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] resolveUsages" + +--- +```ts +resolveUsages(types): UsageTracker +``` + +Resolve usage(input, output or both) of various types in the given namespace. +Will recursively scan all namespace, interfaces and operations contained inside the namespace. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `types` | [`OperationContainer`](../type-aliases/OperationContainer.md) \| [`OperationContainer`](../type-aliases/OperationContainer.md)[] | Entrypoint(s) namespace, interface or operations to get usage from. | + +## Returns + +Map of types to usage. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/scopeNavigationToNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/scopeNavigationToNamespace.md new file mode 100644 index 0000000000..2cb3d7998a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/scopeNavigationToNamespace.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[F] scopeNavigationToNamespace" + +--- +```ts +scopeNavigationToNamespace( + namespace, + listeners, + options): T +``` + +Scope the current navigation to the given namespace. + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Namespace the traversal shouldn't leave. | +| `listeners` | `T` | Type listeners. | +| `options` | [`NamespaceNavigationOptions`](../interfaces/NamespaceNavigationOptions.md) | Scope options | + +## Returns + +wrapped listeners that that can be used with `navigateType` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/setCadlNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/setCadlNamespace.md new file mode 100644 index 0000000000..b72dd7e61f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/setCadlNamespace.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] setCadlNamespace" + +--- +```ts +setCadlNamespace(namespace, ...functions): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `namespace` | `string` | +| ...`functions` | (...`args`) => `any`[] | + +## Returns + +## Deprecated + +use setTypeSpecNamespace diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/setTypeSpecNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/setTypeSpecNamespace.md new file mode 100644 index 0000000000..c136758acf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/setTypeSpecNamespace.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] setTypeSpecNamespace" + +--- +```ts +setTypeSpecNamespace(namespace, ...functions): void +``` + +Set the TypeSpec namespace for that function. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `namespace` | `string` | Namespace string (e.g. "Foo.Bar") | +| ...`functions` | (...`args`) => `any`[] | Functions | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/skipTrivia.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/skipTrivia.md new file mode 100644 index 0000000000..aa72c70d31 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/skipTrivia.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] skipTrivia" + +--- +```ts +skipTrivia( + input, + position, + endPosition): number +``` + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `input` | `string` | `undefined` | +| `position` | `number` | `undefined` | +| `endPosition` | `number` | `input.length` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/skipWhiteSpace.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/skipWhiteSpace.md new file mode 100644 index 0000000000..d4c22456b7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/skipWhiteSpace.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] skipWhiteSpace" + +--- +```ts +skipWhiteSpace( + input, + position, + endPosition): number +``` + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `input` | `string` | `undefined` | +| `position` | `number` | `undefined` | +| `endPosition` | `number` | `input.length` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/typespecTypeToJson.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/typespecTypeToJson.md new file mode 100644 index 0000000000..5dcd158e9c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/typespecTypeToJson.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] typespecTypeToJson" + +--- +```ts +typespecTypeToJson(typespecType, target): [T | undefined, Diagnostic[]] +``` + +Convert a typespec type to a serializable Json object. +Emits diagnostics if the given type is invalid + +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `typespecType` | [`TypeSpecValue`](../type-aliases/TypeSpecValue.md) | The type to convert to Json data | +| `target` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | The diagnostic target in case of errors. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorNotOnType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorNotOnType.md new file mode 100644 index 0000000000..9cb27e6dcc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorNotOnType.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[F] validateDecoratorNotOnType" + +--- +```ts +validateDecoratorNotOnType( + context, + type, + badDecorator, + givenDecorator): boolean +``` + +Validate that a given decorator is not on a type or any of its base types. +Useful to check for decorator usage that conflicts with another decorator. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | Decorator context | +| `type` | [`Type`](../type-aliases/Type.md) | The type to check | +| `badDecorator` | [`DecoratorFunction`](../interfaces/DecoratorFunction.md) | The decorator we don't want present | +| `givenDecorator` | [`DecoratorFunction`](../interfaces/DecoratorFunction.md) | The decorator that is the reason why we don't want the bad decorator present | + +## Returns + +Whether the decorator application is valid diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorParamCount.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorParamCount.md new file mode 100644 index 0000000000..444c244585 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorParamCount.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] validateDecoratorParamCount" + +--- +```ts +validateDecoratorParamCount( + context, + min, + max, + parameters): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `min` | `number` | +| `max` | `undefined` \| `number` | +| `parameters` | `unknown`[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorParamType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorParamType.md new file mode 100644 index 0000000000..ee03f0ec48 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorParamType.md @@ -0,0 +1,62 @@ +--- +jsApi: true +title: "[F] validateDecoratorParamType" + +--- +```ts +validateDecoratorParamType( + program, + target, + value, + expectedType): value is InferredTypeSpecValue +``` + +Validate a decorator parameter has the correct type. + +## Type parameters + +| Parameter | +| :------ | +| `K` extends + \| `"Model"` + \| `"ModelProperty"` + \| `"Scalar"` + \| `"Interface"` + \| `"Enum"` + \| `"EnumMember"` + \| `"TemplateParameter"` + \| `"Namespace"` + \| `"Operation"` + \| `"String"` + \| `"Number"` + \| `"Boolean"` + \| `"Tuple"` + \| `"Union"` + \| `"UnionVariant"` + \| `"Intrinsic"` + \| `"Function"` + \| `"Decorator"` + \| `"FunctionParameter"` + \| `"Object"` + \| `"Projection"` | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Decorator target | +| `value` | [`TypeSpecValue`](../type-aliases/TypeSpecValue.md) | Value of the parameter. | +| `expectedType` | `K` \| `K`[] | Expected type or list of expected type | + +## Returns + +true if the value is of one of the type in the list of expected types. If not emit a diagnostic. + +## Deprecated + +use + +## See + +createDecoratorDefinition#validate instead. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorTarget.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorTarget.md new file mode 100644 index 0000000000..a19d37a2c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorTarget.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[F] validateDecoratorTarget" + +--- +```ts +validateDecoratorTarget( + context, + target, + decoratorName, + expectedType): target is K extends "Any" ? Type : Object +``` + +Validate the decorator target is matching the expected value. + +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](../type-aliases/TypeKind.md) | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | - | +| `target` | [`Type`](../type-aliases/Type.md) | | +| `decoratorName` | `string` | | +| `expectedType` | `K` \| readonly `K`[] | | + +## Returns diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorTargetIntrinsic.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorTargetIntrinsic.md new file mode 100644 index 0000000000..a9712bc109 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorTargetIntrinsic.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] validateDecoratorTargetIntrinsic" + +--- +```ts +validateDecoratorTargetIntrinsic( + context, + target, + decoratorName, + expectedType): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `decoratorName` | `string` | +| `expectedType` | [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md) \| [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md)[] | + +## Returns + +## Deprecated + +this function is deprecated use decorator definition in typespec instead or check assignability directly. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorUniqueOnNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorUniqueOnNode.md new file mode 100644 index 0000000000..a69903de5c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/validateDecoratorUniqueOnNode.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] validateDecoratorUniqueOnNode" + +--- +```ts +validateDecoratorUniqueOnNode( + context, + type, + decorator): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `type` | [`Type`](../type-aliases/Type.md) | +| `decorator` | [`DecoratorFunction`](../interfaces/DecoratorFunction.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/visitChildren.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/visitChildren.md new file mode 100644 index 0000000000..6dee1450e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/visitChildren.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] visitChildren" + +--- +```ts +visitChildren(node, cb): T | undefined +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | +| `cb` | [`NodeCallback`](../type-aliases/NodeCallback.md)<`T`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/walkPropertiesInherited.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/walkPropertiesInherited.md new file mode 100644 index 0000000000..76771e5930 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/functions/walkPropertiesInherited.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] walkPropertiesInherited" + +--- +```ts +walkPropertiesInherited(model): Generator +``` + +Enumerates the properties declared by model or inherited from its base. + +Properties declared by more derived types are enumerated before properties +of less derived types. + +Properties that are overridden are not enumerated. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | [`Model`](../interfaces/Model.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/index.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/index.md new file mode 100644 index 0000000000..e43e6e9225 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/index.md @@ -0,0 +1,541 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Enumerations + +- [IdentifierKind](enumerations/IdentifierKind.md) +- [ListenerFlow](enumerations/ListenerFlow.md) +- [ModifierFlags](enumerations/ModifierFlags.md) +- [NodeFlags](enumerations/NodeFlags.md) +- [SemanticTokenKind](enumerations/SemanticTokenKind.md) +- [SymbolFlags](enumerations/SymbolFlags.md) +- [SyntaxKind](enumerations/SyntaxKind.md) +- [Token](enumerations/Token.md) +- [TokenFlags](enumerations/TokenFlags.md) +- [UsageFlags](enumerations/UsageFlags.md) + +### Classes + +- [DuplicateTracker](classes/DuplicateTracker.md) +- [EventEmitter](classes/EventEmitter.md) +- [InvalidEncodingError](classes/InvalidEncodingError.md) +- [ProjectionError](classes/ProjectionError.md) +- [Queue](classes/Queue.md) +- [ResolveModuleError](classes/ResolveModuleError.md) + +### Interfaces + +- [AliasStatementNode](interfaces/AliasStatementNode.md) +- [AnyKeywordNode](interfaces/AnyKeywordNode.md) +- [ArrayExpressionNode](interfaces/ArrayExpressionNode.md) +- [ArrayModelType](interfaces/ArrayModelType.md) +- [AugmentDecoratorStatementNode](interfaces/AugmentDecoratorStatementNode.md) +- [BaseNode](interfaces/BaseNode.md) +- [BaseType](interfaces/BaseType.md) +- [BlockComment](interfaces/BlockComment.md) +- [BooleanLiteral](interfaces/BooleanLiteral.md) +- [BooleanLiteralNode](interfaces/BooleanLiteralNode.md) +- [CallableMessage](interfaces/CallableMessage.md) +- [Checker](interfaces/Checker.md) +- [CompilerHost](interfaces/CompilerHost.md) +- [CompilerLocationContext](interfaces/CompilerLocationContext.md) +- [CompilerOptions](interfaces/CompilerOptions.md) +- [DeclarationNode](interfaces/DeclarationNode.md) +- [DecoratedType](interfaces/DecoratedType.md) +- [Decorator](interfaces/Decorator.md) +- [DecoratorApplication](interfaces/DecoratorApplication.md) +- [DecoratorArgument](interfaces/DecoratorArgument.md) +- [DecoratorContext](interfaces/DecoratorContext.md) +- [DecoratorDeclarationStatementNode](interfaces/DecoratorDeclarationStatementNode.md) +- [DecoratorDefinition](interfaces/DecoratorDefinition.md) +- [DecoratorExpressionNode](interfaces/DecoratorExpressionNode.md) +- [DecoratorFunction](interfaces/DecoratorFunction.md) +- [DecoratorParamDefinition](interfaces/DecoratorParamDefinition.md) +- [DecoratorValidator](interfaces/DecoratorValidator.md) +- [DeprecatedDirective](interfaces/DeprecatedDirective.md) +- [DeprecationDetails](interfaces/DeprecationDetails.md) +- [Diagnostic](interfaces/Diagnostic.md) +- [DiagnosticCollector](interfaces/DiagnosticCollector.md) +- [DiagnosticCreator](interfaces/DiagnosticCreator.md) +- [DiagnosticDefinition](interfaces/DiagnosticDefinition.md) +- [DiagnosticMessages](interfaces/DiagnosticMessages.md) +- [DirectiveBase](interfaces/DirectiveBase.md) +- [DirectiveExpressionNode](interfaces/DirectiveExpressionNode.md) +- [Dirent](interfaces/Dirent.md) +- [DiscriminatedUnion](interfaces/DiscriminatedUnion.md) +- [Discriminator](interfaces/Discriminator.md) +- [DocData](interfaces/DocData.md) +- [DocErrorsTagNode](interfaces/DocErrorsTagNode.md) +- [DocNode](interfaces/DocNode.md) +- [DocParamTagNode](interfaces/DocParamTagNode.md) +- [DocReturnsTagNode](interfaces/DocReturnsTagNode.md) +- [DocTagBaseNode](interfaces/DocTagBaseNode.md) +- [DocTemplateTagNode](interfaces/DocTemplateTagNode.md) +- [DocTextNode](interfaces/DocTextNode.md) +- [DocUnknownTagNode](interfaces/DocUnknownTagNode.md) +- [EmitContext](interfaces/EmitContext.md) +- [EmitFileOptions](interfaces/EmitFileOptions.md) +- [EmptyStatementNode](interfaces/EmptyStatementNode.md) +- [EncodeData](interfaces/EncodeData.md) +- [Enum](interfaces/Enum.md) +- [EnumMember](interfaces/EnumMember.md) +- [EnumMemberNode](interfaces/EnumMemberNode.md) +- [EnumSpreadMemberNode](interfaces/EnumSpreadMemberNode.md) +- [EnumStatementNode](interfaces/EnumStatementNode.md) +- [ErrorType](interfaces/ErrorType.md) +- [ExternKeywordNode](interfaces/ExternKeywordNode.md) +- [FileLibraryMetadata](interfaces/FileLibraryMetadata.md) +- [FunctionDeclarationStatementNode](interfaces/FunctionDeclarationStatementNode.md) +- [FunctionParameter](interfaces/FunctionParameter.md) +- [FunctionParameterNode](interfaces/FunctionParameterNode.md) +- [FunctionType](interfaces/FunctionType.md) +- [IdentifierContext](interfaces/IdentifierContext.md) +- [IdentifierNode](interfaces/IdentifierNode.md) +- [ImportStatementNode](interfaces/ImportStatementNode.md) +- [Interface](interfaces/Interface.md) +- [InterfaceStatementNode](interfaces/InterfaceStatementNode.md) +- [IntersectionExpressionNode](interfaces/IntersectionExpressionNode.md) +- [IntrinsicType](interfaces/IntrinsicType.md) +- [InvalidStatementNode](interfaces/InvalidStatementNode.md) +- [JSONSchemaValidator](interfaces/JSONSchemaValidator.md) +- [JsNamespaceDeclarationNode](interfaces/JsNamespaceDeclarationNode.md) +- [JsSourceFileNode](interfaces/JsSourceFileNode.md) +- [LibraryInstance](interfaces/LibraryInstance.md) +- [LibraryLocationContext](interfaces/LibraryLocationContext.md) +- [LineAndCharacter](interfaces/LineAndCharacter.md) +- [LineComment](interfaces/LineComment.md) +- [LinterDefinition](interfaces/LinterDefinition.md) +- [LinterRule](interfaces/LinterRule.md) +- [LinterRuleContext](interfaces/LinterRuleContext.md) +- [LinterRuleDefinition](interfaces/LinterRuleDefinition.md) +- [LinterRuleSet](interfaces/LinterRuleSet.md) +- [ListOperationOptions](interfaces/ListOperationOptions.md) +- [LogInfo](interfaces/LogInfo.md) +- [LogSink](interfaces/LogSink.md) +- [Logger](interfaces/Logger.md) +- [MemberExpressionNode](interfaces/MemberExpressionNode.md) +- [Model](interfaces/Model.md) +- [ModelExpressionNode](interfaces/ModelExpressionNode.md) +- [ModelProperty](interfaces/ModelProperty.md) +- [ModelPropertyNode](interfaces/ModelPropertyNode.md) +- [ModelSpreadPropertyNode](interfaces/ModelSpreadPropertyNode.md) +- [ModelStatementNode](interfaces/ModelStatementNode.md) +- [ModuleLibraryMetadata](interfaces/ModuleLibraryMetadata.md) +- [Namespace](interfaces/Namespace.md) +- [NamespaceNavigationOptions](interfaces/NamespaceNavigationOptions.md) +- [NamespaceStatementNode](interfaces/NamespaceStatementNode.md) +- [NavigationOptions](interfaces/NavigationOptions.md) +- [NeverKeywordNode](interfaces/NeverKeywordNode.md) +- [NeverType](interfaces/NeverType.md) +- [NodePackage](interfaces/NodePackage.md) +- [NullType](interfaces/NullType.md) +- [NumericLiteral](interfaces/NumericLiteral.md) +- [NumericLiteralNode](interfaces/NumericLiteralNode.md) +- [ObjectType](interfaces/ObjectType.md) +- [Operation](interfaces/Operation.md) +- [OperationSignatureDeclarationNode](interfaces/OperationSignatureDeclarationNode.md) +- [OperationSignatureReferenceNode](interfaces/OperationSignatureReferenceNode.md) +- [OperationStatementNode](interfaces/OperationStatementNode.md) +- [ParseOptions](interfaces/ParseOptions.md) +- [ProcessedLog](interfaces/ProcessedLog.md) +- [Program](interfaces/Program.md) +- [ProjectLocationContext](interfaces/ProjectLocationContext.md) +- [ProjectedNameView](interfaces/ProjectedNameView.md) +- [ProjectedProgram](interfaces/ProjectedProgram.md) +- [Projection](interfaces/Projection.md) +- [ProjectionApplication](interfaces/ProjectionApplication.md) +- [ProjectionArithmeticExpressionNode](interfaces/ProjectionArithmeticExpressionNode.md) +- [ProjectionBlockExpressionNode](interfaces/ProjectionBlockExpressionNode.md) +- [ProjectionCallExpressionNode](interfaces/ProjectionCallExpressionNode.md) +- [ProjectionDecoratorReferenceExpressionNode](interfaces/ProjectionDecoratorReferenceExpressionNode.md) +- [ProjectionEnumMemberSelectorNode](interfaces/ProjectionEnumMemberSelectorNode.md) +- [ProjectionEnumSelectorNode](interfaces/ProjectionEnumSelectorNode.md) +- [ProjectionEqualityExpressionNode](interfaces/ProjectionEqualityExpressionNode.md) +- [ProjectionExpressionStatementNode](interfaces/ProjectionExpressionStatementNode.md) +- [ProjectionIfExpressionNode](interfaces/ProjectionIfExpressionNode.md) +- [ProjectionInterfaceSelectorNode](interfaces/ProjectionInterfaceSelectorNode.md) +- [ProjectionLambdaExpressionNode](interfaces/ProjectionLambdaExpressionNode.md) +- [ProjectionLambdaParameterDeclarationNode](interfaces/ProjectionLambdaParameterDeclarationNode.md) +- [ProjectionLogicalExpressionNode](interfaces/ProjectionLogicalExpressionNode.md) +- [ProjectionMemberExpressionNode](interfaces/ProjectionMemberExpressionNode.md) +- [ProjectionModelExpressionNode](interfaces/ProjectionModelExpressionNode.md) +- [ProjectionModelPropertyNode](interfaces/ProjectionModelPropertyNode.md) +- [ProjectionModelPropertySelectorNode](interfaces/ProjectionModelPropertySelectorNode.md) +- [ProjectionModelSelectorNode](interfaces/ProjectionModelSelectorNode.md) +- [ProjectionModelSpreadPropertyNode](interfaces/ProjectionModelSpreadPropertyNode.md) +- [ProjectionNode](interfaces/ProjectionNode.md) +- [ProjectionOperationSelectorNode](interfaces/ProjectionOperationSelectorNode.md) +- [ProjectionParameterDeclarationNode](interfaces/ProjectionParameterDeclarationNode.md) +- [ProjectionReferenceNode](interfaces/ProjectionReferenceNode.md) +- [ProjectionRelationalExpressionNode](interfaces/ProjectionRelationalExpressionNode.md) +- [ProjectionStatementNode](interfaces/ProjectionStatementNode.md) +- [ProjectionTupleExpressionNode](interfaces/ProjectionTupleExpressionNode.md) +- [ProjectionUnaryExpressionNode](interfaces/ProjectionUnaryExpressionNode.md) +- [ProjectionUnionSelectorNode](interfaces/ProjectionUnionSelectorNode.md) +- [ProjectionUnionVariantSelectorNode](interfaces/ProjectionUnionVariantSelectorNode.md) +- [Projector](interfaces/Projector.md) +- [RecordModelType](interfaces/RecordModelType.md) +- [ResolveCompilerOptionsOptions](interfaces/ResolveCompilerOptionsOptions.md) +- [ResolveModuleHost](interfaces/ResolveModuleHost.md) +- [ResolveModuleOptions](interfaces/ResolveModuleOptions.md) +- [ResolvedFile](interfaces/ResolvedFile.md) +- [ResolvedModule](interfaces/ResolvedModule.md) +- [ReturnExpressionNode](interfaces/ReturnExpressionNode.md) +- [ReturnRecord](interfaces/ReturnRecord.md) +- [RmOptions](interfaces/RmOptions.md) +- [Scalar](interfaces/Scalar.md) +- [ScalarStatementNode](interfaces/ScalarStatementNode.md) +- [Scanner](interfaces/Scanner.md) +- [SemanticToken](interfaces/SemanticToken.md) +- [Server](interfaces/Server.md) +- [ServerHost](interfaces/ServerHost.md) +- [ServerSourceFile](interfaces/ServerSourceFile.md) +- [ServerWorkspaceFolder](interfaces/ServerWorkspaceFolder.md) +- [Service](interfaces/Service.md) +- [ServiceDetails](interfaces/ServiceDetails.md) +- [SourceFile](interfaces/SourceFile.md) +- [SourceLocation](interfaces/SourceLocation.md) +- [SourceLocationOptions](interfaces/SourceLocationOptions.md) +- [StringLiteral](interfaces/StringLiteral.md) +- [StringLiteralNode](interfaces/StringLiteralNode.md) +- [SuppressDirective](interfaces/SuppressDirective.md) +- [Sym](interfaces/Sym.md) +- [SymbolLinks](interfaces/SymbolLinks.md) +- [SyntheticLocationContext](interfaces/SyntheticLocationContext.md) +- [TemplateDeclarationNode](interfaces/TemplateDeclarationNode.md) +- [TemplateParameter](interfaces/TemplateParameter.md) +- [TemplateParameterDeclarationNode](interfaces/TemplateParameterDeclarationNode.md) +- [TemplatedTypeBase](interfaces/TemplatedTypeBase.md) +- [TextRange](interfaces/TextRange.md) +- [Tracer](interfaces/Tracer.md) +- [TracerOptions](interfaces/TracerOptions.md) +- [Tuple](interfaces/Tuple.md) +- [TupleExpressionNode](interfaces/TupleExpressionNode.md) +- [TypeInstantiationMap](interfaces/TypeInstantiationMap.md) +- [TypeMapper](interfaces/TypeMapper.md) +- [TypeNameOptions](interfaces/TypeNameOptions.md) +- [TypeReferenceNode](interfaces/TypeReferenceNode.md) +- [TypeSpecCompletionItem](interfaces/TypeSpecCompletionItem.md) +- [TypeSpecLibrary](interfaces/TypeSpecLibrary.md) +- [TypeSpecLibraryDef](interfaces/TypeSpecLibraryDef.md) +- [TypeSpecManifest](interfaces/TypeSpecManifest.md) +- [TypeSpecScriptNode](interfaces/TypeSpecScriptNode.md) +- [Union](interfaces/Union.md) +- [UnionExpressionNode](interfaces/UnionExpressionNode.md) +- [UnionStatementNode](interfaces/UnionStatementNode.md) +- [UnionVariant](interfaces/UnionVariant.md) +- [UnionVariantNode](interfaces/UnionVariantNode.md) +- [UnknownType](interfaces/UnknownType.md) +- [UsageTracker](interfaces/UsageTracker.md) +- [UsingStatementNode](interfaces/UsingStatementNode.md) +- [ValueOfExpressionNode](interfaces/ValueOfExpressionNode.md) +- [ValueType](interfaces/ValueType.md) +- [VoidKeywordNode](interfaces/VoidKeywordNode.md) +- [VoidType](interfaces/VoidType.md) + +### Type Aliases + +- [BytesKnownEncoding](type-aliases/BytesKnownEncoding.md) +- [CadlCompletionItem](type-aliases/CadlCompletionItem.md) +- [CadlLibrary](type-aliases/CadlLibrary.md) +- [CadlLibraryDef](type-aliases/CadlLibraryDef.md) +- [CadlManifest](type-aliases/CadlManifest.md) +- [CadlScriptNode](type-aliases/CadlScriptNode.md) +- [CadlValue](type-aliases/CadlValue.md) +- [Comment](type-aliases/Comment.md) +- [CreateTypeProps](type-aliases/CreateTypeProps.md) +- [DateTimeKnownEncoding](type-aliases/DateTimeKnownEncoding.md) +- [Declaration](type-aliases/Declaration.md) +- [DecoratorArgumentValue](type-aliases/DecoratorArgumentValue.md) +- [DiagnosticFormat](type-aliases/DiagnosticFormat.md) +- [DiagnosticHandler](type-aliases/DiagnosticHandler.md) +- [DiagnosticMap](type-aliases/DiagnosticMap.md) +- [DiagnosticReport](type-aliases/DiagnosticReport.md) +- [DiagnosticReportWithoutTarget](type-aliases/DiagnosticReportWithoutTarget.md) +- [DiagnosticResult](type-aliases/DiagnosticResult.md) +- [DiagnosticSeverity](type-aliases/DiagnosticSeverity.md) +- [DiagnosticTarget](type-aliases/DiagnosticTarget.md) +- [Directive](type-aliases/Directive.md) +- [DirectiveArgument](type-aliases/DirectiveArgument.md) +- [DocContent](type-aliases/DocContent.md) +- [DocTag](type-aliases/DocTag.md) +- [DocToken](type-aliases/DocToken.md) +- [DurationKnownEncoding](type-aliases/DurationKnownEncoding.md) +- [EmitOptionsFor](type-aliases/EmitOptionsFor.md) +- [EmitterFunc](type-aliases/EmitterFunc.md) +- [Expression](type-aliases/Expression.md) +- [InferredCadlValue](type-aliases/InferredCadlValue.md) +- [InferredTypeSpecValue](type-aliases/InferredTypeSpecValue.md) +- [IntrinsicScalarName](type-aliases/IntrinsicScalarName.md) +- [JSONSchemaType](type-aliases/JSONSchemaType.md) +- [LibraryMetadata](type-aliases/LibraryMetadata.md) +- [LinterRuleDiagnosticFormat](type-aliases/LinterRuleDiagnosticFormat.md) +- [LinterRuleDiagnosticReport](type-aliases/LinterRuleDiagnosticReport.md) +- [LinterRuleDiagnosticReportWithoutTarget](type-aliases/LinterRuleDiagnosticReportWithoutTarget.md) +- [LiteralNode](type-aliases/LiteralNode.md) +- [LiteralType](type-aliases/LiteralType.md) +- [LocationContext](type-aliases/LocationContext.md) +- [LogLevel](type-aliases/LogLevel.md) +- [MarshalledValue](type-aliases/MarshalledValue.md) +- [MemberContainerNode](type-aliases/MemberContainerNode.md) +- [MemberContainerType](type-aliases/MemberContainerType.md) +- [MemberNode](type-aliases/MemberNode.md) +- [MemberType](type-aliases/MemberType.md) +- [ModelIndexer](type-aliases/ModelIndexer.md) +- [Modifier](type-aliases/Modifier.md) +- [ModuleResolutionResult](type-aliases/ModuleResolutionResult.md) +- [NeverIndexer](type-aliases/NeverIndexer.md) +- [NewLine](type-aliases/NewLine.md) +- [Node](type-aliases/Node.md) +- [NodeCallback](type-aliases/NodeCallback.md) +- [OperationContainer](type-aliases/OperationContainer.md) +- [OperationSignature](type-aliases/OperationSignature.md) +- [ProjectionExpression](type-aliases/ProjectionExpression.md) +- [ProjectionStatementItem](type-aliases/ProjectionStatementItem.md) +- [ReferenceExpression](type-aliases/ReferenceExpression.md) +- [RuleRef](type-aliases/RuleRef.md) +- [ScopeNode](type-aliases/ScopeNode.md) +- [SemanticNodeListener](type-aliases/SemanticNodeListener.md) +- [SourceFileKind](type-aliases/SourceFileKind.md) +- [Statement](type-aliases/Statement.md) +- [StdTypeName](type-aliases/StdTypeName.md) +- [StdTypes](type-aliases/StdTypes.md) +- [TemplateableNode](type-aliases/TemplateableNode.md) +- [TemplatedType](type-aliases/TemplatedType.md) +- [TrackableType](type-aliases/TrackableType.md) +- [Type](type-aliases/Type.md) +- [TypeKind](type-aliases/TypeKind.md) +- [TypeListeners](type-aliases/TypeListeners.md) +- [TypeOfDiagnostics](type-aliases/TypeOfDiagnostics.md) +- [TypeOrReturnRecord](type-aliases/TypeOrReturnRecord.md) +- [TypeSpecDiagnosticTarget](type-aliases/TypeSpecDiagnosticTarget.md) +- [TypeSpecValue](type-aliases/TypeSpecValue.md) +- [WriteLine](type-aliases/WriteLine.md) + +### Variables + +- [CadlPrettierPlugin](variables/CadlPrettierPlugin.md) +- [MANIFEST](variables/MANIFEST.md) +- [NoTarget](variables/NoTarget.md) +- [NodeHost](variables/NodeHost.md) +- [TypeSpecPrettierPlugin](variables/TypeSpecPrettierPlugin.md) +- [altDirectorySeparator](variables/altDirectorySeparator.md) +- [cadlVersion](variables/cadlVersion.md) +- [directorySeparator](variables/directorySeparator.md) +- [namespace](variables/namespace.md) +- [typespecVersion](variables/typespecVersion.md) + +### Functions + +- [$deprecated](functions/$deprecated.md) +- [$discriminator](functions/$discriminator.md) +- [$doc](functions/$doc.md) +- [$encode](functions/$encode.md) +- [$error](functions/$error.md) +- [$errorsDoc](functions/$errorsDoc.md) +- [$format](functions/$format.md) +- [$friendlyName](functions/$friendlyName.md) +- [$indexer](functions/$indexer.md) +- [$inspectType](functions/$inspectType.md) +- [$inspectTypeName](functions/$inspectTypeName.md) +- [$key](functions/$key.md) +- [$knownValues](functions/$knownValues.md) +- [$list](functions/$list.md) +- [$maxItems](functions/$maxItems.md) +- [$maxLength](functions/$maxLength.md) +- [$maxValue](functions/$maxValue.md) +- [$maxValueExclusive](functions/$maxValueExclusive.md) +- [$minItems](functions/$minItems.md) +- [$minLength](functions/$minLength.md) +- [$minValue](functions/$minValue.md) +- [$minValueExclusive](functions/$minValueExclusive.md) +- [$overload](functions/$overload.md) +- [$parameterVisibility](functions/$parameterVisibility.md) +- [$pattern](functions/$pattern.md) +- [$projectedName](functions/$projectedName.md) +- [$returnTypeVisibility](functions/$returnTypeVisibility.md) +- [$returnsDoc](functions/$returnsDoc.md) +- [$secret](functions/$secret.md) +- [$service](functions/$service.md) +- [$summary](functions/$summary.md) +- [$tag](functions/$tag.md) +- [$visibility](functions/$visibility.md) +- [$withDefaultKeyVisibility](functions/$withDefaultKeyVisibility.md) +- [$withOptionalProperties](functions/$withOptionalProperties.md) +- [$withUpdateableProperties](functions/$withUpdateableProperties.md) +- [$withVisibility](functions/$withVisibility.md) +- [$withoutDefaultValues](functions/$withoutDefaultValues.md) +- [$withoutOmittedProperties](functions/$withoutOmittedProperties.md) +- [addService](functions/addService.md) +- [assertType](functions/assertType.md) +- [cadlTypeToJson](functions/cadlTypeToJson.md) +- [checkFormatCadl](functions/checkFormatCadl.md) +- [checkFormatTypeSpec](functions/checkFormatTypeSpec.md) +- [compile](functions/compile.md) +- [compilerAssert](functions/compilerAssert.md) +- [createCadlLibrary](functions/createCadlLibrary.md) +- [createChecker](functions/createChecker.md) +- [createDecoratorDefinition](functions/createDecoratorDefinition.md) +- [createDiagnosticCollector](functions/createDiagnosticCollector.md) +- [createDiagnosticCreator](functions/createDiagnosticCreator.md) +- [createProjectedNameProgram](functions/createProjectedNameProgram.md) +- [createRekeyableMap](functions/createRekeyableMap.md) +- [createRule](functions/createRule.md) +- [createScanner](functions/createScanner.md) +- [createServer](functions/createServer.md) +- [createSourceFile](functions/createSourceFile.md) +- [createStateAccessors](functions/createStateAccessors.md) +- [createTypeSpecLibrary](functions/createTypeSpecLibrary.md) +- [emitFile](functions/emitFile.md) +- [ensureTrailingDirectorySeparator](functions/ensureTrailingDirectorySeparator.md) +- [filterModelProperties](functions/filterModelProperties.md) +- [finishTypeForProgram](functions/finishTypeForProgram.md) +- [formatDiagnostic](functions/formatDiagnostic.md) +- [formatIdentifier](functions/formatIdentifier.md) +- [formatTypeSpec](functions/formatTypeSpec.md) +- [getAllTags](functions/getAllTags.md) +- [getAnyExtensionFromPath](functions/getAnyExtensionFromPath.md) +- [getBaseFileName](functions/getBaseFileName.md) +- [getDeprecated](functions/getDeprecated.md) +- [getDeprecationDetails](functions/getDeprecationDetails.md) +- [getDirectoryPath](functions/getDirectoryPath.md) +- [getDiscriminatedTypes](functions/getDiscriminatedTypes.md) +- [getDiscriminatedUnion](functions/getDiscriminatedUnion.md) +- [getDiscriminator](functions/getDiscriminator.md) +- [getDoc](functions/getDoc.md) +- [getDocData](functions/getDocData.md) +- [getDocDataInternal](functions/getDocDataInternal.md) +- [getEffectiveModelType](functions/getEffectiveModelType.md) +- [getEncode](functions/getEncode.md) +- [getErrorsDoc](functions/getErrorsDoc.md) +- [getErrorsDocData](functions/getErrorsDocData.md) +- [getFirstAncestor](functions/getFirstAncestor.md) +- [getFormat](functions/getFormat.md) +- [getFriendlyName](functions/getFriendlyName.md) +- [getFullyQualifiedSymbolName](functions/getFullyQualifiedSymbolName.md) +- [getIdentifierContext](functions/getIdentifierContext.md) +- [getIndexer](functions/getIndexer.md) +- [getKeyName](functions/getKeyName.md) +- [getKnownValues](functions/getKnownValues.md) +- [getListOperationType](functions/getListOperationType.md) +- [getLocationContext](functions/getLocationContext.md) +- [getMaxItems](functions/getMaxItems.md) +- [getMaxLength](functions/getMaxLength.md) +- [getMaxValue](functions/getMaxValue.md) +- [getMaxValueExclusive](functions/getMaxValueExclusive.md) +- [getMinItems](functions/getMinItems.md) +- [getMinLength](functions/getMinLength.md) +- [getMinValue](functions/getMinValue.md) +- [getMinValueExclusive](functions/getMinValueExclusive.md) +- [getNamespaceFullName](functions/getNamespaceFullName.md) +- [getNodeAtPosition](functions/getNodeAtPosition.md) +- [getNormalizedAbsolutePath](functions/getNormalizedAbsolutePath.md) +- [getNormalizedAbsolutePathWithoutRoot](functions/getNormalizedAbsolutePathWithoutRoot.md) +- [getNormalizedPathComponents](functions/getNormalizedPathComponents.md) +- [getOverloadedOperation](functions/getOverloadedOperation.md) +- [getOverloads](functions/getOverloads.md) +- [getOverriddenProperty](functions/getOverriddenProperty.md) +- [getParameterVisibility](functions/getParameterVisibility.md) +- [getParentTemplateNode](functions/getParentTemplateNode.md) +- [getPathComponents](functions/getPathComponents.md) +- [getPathFromPathComponents](functions/getPathFromPathComponents.md) +- [getPattern](functions/getPattern.md) +- [getProjectedName](functions/getProjectedName.md) +- [getProjectedNames](functions/getProjectedNames.md) +- [getProperty](functions/getProperty.md) +- [getPropertyType](functions/getPropertyType.md) +- [getRelativePathFromDirectory](functions/getRelativePathFromDirectory.md) +- [getReturnTypeVisibility](functions/getReturnTypeVisibility.md) +- [getReturnsDoc](functions/getReturnsDoc.md) +- [getReturnsDocData](functions/getReturnsDocData.md) +- [getRootLength](functions/getRootLength.md) +- [getService](functions/getService.md) +- [getSourceFileKindFromExt](functions/getSourceFileKindFromExt.md) +- [getSourceLocation](functions/getSourceLocation.md) +- [getSummary](functions/getSummary.md) +- [getTags](functions/getTags.md) +- [getTypeName](functions/getTypeName.md) +- [getVisibility](functions/getVisibility.md) +- [hasParseError](functions/hasParseError.md) +- [hasProjectedName](functions/hasProjectedName.md) +- [hasTrailingDirectorySeparator](functions/hasTrailingDirectorySeparator.md) +- [ignoreDiagnostics](functions/ignoreDiagnostics.md) +- [interpolatePath](functions/interpolatePath.md) +- [isAnyDirectorySeparator](functions/isAnyDirectorySeparator.md) +- [isArrayModelType](functions/isArrayModelType.md) +- [isCadlValueTypeOf](functions/isCadlValueTypeOf.md) +- [isComment](functions/isComment.md) +- [isDeclaredInNamespace](functions/isDeclaredInNamespace.md) +- [isDeclaredType](functions/isDeclaredType.md) +- [isDeprecated](functions/isDeprecated.md) +- [isErrorModel](functions/isErrorModel.md) +- [isErrorType](functions/isErrorType.md) +- [isGlobalNamespace](functions/isGlobalNamespace.md) +- [isImportStatement](functions/isImportStatement.md) +- [isIntrinsicType](functions/isIntrinsicType.md) +- [isKey](functions/isKey.md) +- [isKeyword](functions/isKeyword.md) +- [isListOperation](functions/isListOperation.md) +- [isModifier](functions/isModifier.md) +- [isNeverType](functions/isNeverType.md) +- [isNullType](functions/isNullType.md) +- [isNumericType](functions/isNumericType.md) +- [isPathAbsolute](functions/isPathAbsolute.md) +- [isProjectedProgram](functions/isProjectedProgram.md) +- [isPunctuation](functions/isPunctuation.md) +- [isRecordModelType](functions/isRecordModelType.md) +- [isSecret](functions/isSecret.md) +- [isService](functions/isService.md) +- [isStatementKeyword](functions/isStatementKeyword.md) +- [isStdNamespace](functions/isStdNamespace.md) +- [isStringType](functions/isStringType.md) +- [isTemplateDeclaration](functions/isTemplateDeclaration.md) +- [isTemplateDeclarationOrInstance](functions/isTemplateDeclarationOrInstance.md) +- [isTemplateInstance](functions/isTemplateInstance.md) +- [isTrivia](functions/isTrivia.md) +- [isTypeSpecValueTypeOf](functions/isTypeSpecValueTypeOf.md) +- [isUnknownType](functions/isUnknownType.md) +- [isUrl](functions/isUrl.md) +- [isVisible](functions/isVisible.md) +- [isVoidType](functions/isVoidType.md) +- [joinPaths](functions/joinPaths.md) +- [listOperationsIn](functions/listOperationsIn.md) +- [listServices](functions/listServices.md) +- [logDiagnostics](functions/logDiagnostics.md) +- [logVerboseTestOutput](functions/logVerboseTestOutput.md) +- [mapEventEmitterToNodeListener](functions/mapEventEmitterToNodeListener.md) +- [markDeprecated](functions/markDeprecated.md) +- [navigateProgram](functions/navigateProgram.md) +- [navigateType](functions/navigateType.md) +- [navigateTypesInNamespace](functions/navigateTypesInNamespace.md) +- [normalizePath](functions/normalizePath.md) +- [normalizeSlashes](functions/normalizeSlashes.md) +- [paramMessage](functions/paramMessage.md) +- [parse](functions/parse.md) +- [parseStandaloneTypeReference](functions/parseStandaloneTypeReference.md) +- [projectProgram](functions/projectProgram.md) +- [reducePathComponents](functions/reducePathComponents.md) +- [removeTrailingDirectorySeparator](functions/removeTrailingDirectorySeparator.md) +- [reportDeprecated](functions/reportDeprecated.md) +- [resolveCompilerOptions](functions/resolveCompilerOptions.md) +- [resolveModule](functions/resolveModule.md) +- [resolvePath](functions/resolvePath.md) +- [resolveUsages](functions/resolveUsages.md) +- [scopeNavigationToNamespace](functions/scopeNavigationToNamespace.md) +- [setCadlNamespace](functions/setCadlNamespace.md) +- [setTypeSpecNamespace](functions/setTypeSpecNamespace.md) +- [skipTrivia](functions/skipTrivia.md) +- [skipWhiteSpace](functions/skipWhiteSpace.md) +- [typespecTypeToJson](functions/typespecTypeToJson.md) +- [validateDecoratorNotOnType](functions/validateDecoratorNotOnType.md) +- [validateDecoratorParamCount](functions/validateDecoratorParamCount.md) +- [validateDecoratorParamType](functions/validateDecoratorParamType.md) +- [validateDecoratorTarget](functions/validateDecoratorTarget.md) +- [validateDecoratorTargetIntrinsic](functions/validateDecoratorTargetIntrinsic.md) +- [validateDecoratorUniqueOnNode](functions/validateDecoratorUniqueOnNode.md) +- [visitChildren](functions/visitChildren.md) +- [walkPropertiesInherited](functions/walkPropertiesInherited.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/AliasStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/AliasStatementNode.md new file mode 100644 index 0000000000..8af7218489 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/AliasStatementNode.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] AliasStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `AliasStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | +| `readonly` | `value` | [`Expression`](../type-aliases/Expression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/AnyKeywordNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/AnyKeywordNode.md new file mode 100644 index 0000000000..cfa67c80a6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/AnyKeywordNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] AnyKeywordNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `UnknownKeyword` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ArrayExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ArrayExpressionNode.md new file mode 100644 index 0000000000..2f35c81548 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ArrayExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ArrayExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `elementType` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ArrayExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ArrayModelType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ArrayModelType.md new file mode 100644 index 0000000000..ce4daf5ef1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ArrayModelType.md @@ -0,0 +1,59 @@ +--- +jsApi: true +title: "[I] ArrayModelType" + +--- +## Extends + +- [`Model`](Model.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `baseModel?` | [`Model`](Model.md) | Model this model extends. This represent inheritance. | [`Model`](Model.md).`baseModel` | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`Model`](Model.md).`decorators` | +| `derivedModels` | [`Model`](Model.md)[] | Direct children. This is the reverse relation of [baseModel](ArrayModelType.md) | [`Model`](Model.md).`derivedModels` | +| `indexer` | `object` | - | [`Model`](Model.md).`indexer` | +| `indexer.key` | [`Scalar`](Scalar.md) | - | - | +| `indexer.value` | [`Type`](../type-aliases/Type.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`Model`](Model.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`Model`](Model.md).`isFinished` | +| `kind` | `"Model"` | - | [`Model`](Model.md).`kind` | +| `name` | `string` | - | [`Model`](Model.md).`name` | +| `namespace?` | [`Namespace`](Namespace.md) | - | [`Model`](Model.md).`namespace` | +| `node?` | [`ModelStatementNode`](ModelStatementNode.md) \| [`ModelExpressionNode`](ModelExpressionNode.md) \| [`IntersectionExpressionNode`](IntersectionExpressionNode.md) \| [`ProjectionModelExpressionNode`](ProjectionModelExpressionNode.md) | - | [`Model`](Model.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`Model`](Model.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`Model`](Model.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`Model`](Model.md).`projector` | +| `properties` | `RekeyableMap`<`string`, [`ModelProperty`](ModelProperty.md)\> | The properties of the model.

Properties are ordered in the order that they appear in source.
Properties obtained via `model is` appear before properties defined in
the model body. Properties obtained via `...` are inserted where the
spread appears in source.

Properties inherited via `model extends` are not included. Use
[walkPropertiesInherited](../functions/walkPropertiesInherited.md) to enumerate all properties in the
inheritance hierarchy. | [`Model`](Model.md).`properties` | +| `sourceModel?` | [`Model`](Model.md) | The model that is referenced via `model is`. | [`Model`](Model.md).`sourceModel` | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`Model`](Model.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`Model`](Model.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`Model`](Model.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`Model`](Model.md).[`projectionsByName`](Model.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/AugmentDecoratorStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/AugmentDecoratorStatementNode.md new file mode 100644 index 0000000000..0c6bbffcb2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/AugmentDecoratorStatementNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] AugmentDecoratorStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `AugmentDecoratorStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `targetType` | [`TypeReferenceNode`](TypeReferenceNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BaseNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BaseNode.md new file mode 100644 index 0000000000..1f5cc1b7b7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BaseNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] BaseNode" + +--- +## Extends + +- [`TextRange`](TextRange.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | - | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | - | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`TextRange`](TextRange.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | - | +| `readonly` | `kind` | [`SyntaxKind`](../enumerations/SyntaxKind.md) | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`TextRange`](TextRange.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BaseType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BaseType.md new file mode 100644 index 0000000000..d1d90d6eb1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BaseType.md @@ -0,0 +1,62 @@ +--- +jsApi: true +title: "[I] BaseType" + +--- +## Extended By + +- [`ObjectType`](ObjectType.md) +- [`Projection`](Projection.md) +- [`IntrinsicType`](IntrinsicType.md) +- [`Model`](Model.md) +- [`ModelProperty`](ModelProperty.md) +- [`Scalar`](Scalar.md) +- [`Interface`](Interface.md) +- [`Enum`](Enum.md) +- [`EnumMember`](EnumMember.md) +- [`Operation`](Operation.md) +- [`Namespace`](Namespace.md) +- [`StringLiteral`](StringLiteral.md) +- [`NumericLiteral`](NumericLiteral.md) +- [`BooleanLiteral`](BooleanLiteral.md) +- [`Tuple`](Tuple.md) +- [`Union`](Union.md) +- [`UnionVariant`](UnionVariant.md) +- [`TemplateParameter`](TemplateParameter.md) +- [`Decorator`](Decorator.md) +- [`FunctionType`](FunctionType.md) +- [`FunctionParameter`](FunctionParameter.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | +| `kind` | `string` | - | +| `node?` | [`Node`](../type-aliases/Node.md) | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | +| `projector?` | [`Projector`](Projector.md) | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BlockComment.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BlockComment.md new file mode 100644 index 0000000000..fdb2e5f012 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BlockComment.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[I] BlockComment" + +--- +## Extends + +- [`TextRange`](TextRange.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`TextRange`](TextRange.md).`end` | +| `readonly` | `kind` | `BlockComment` | - | - | +| `readonly` | `parsedAsDocs?` | `boolean` | If that comment was parsed as a doc comment. If parserOptions.docs=false this will always be false. | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`TextRange`](TextRange.md).`pos` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BooleanLiteral.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BooleanLiteral.md new file mode 100644 index 0000000000..80425018cc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BooleanLiteral.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] BooleanLiteral" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Boolean"` | - | [`BaseType`](BaseType.md).`kind` | +| `node?` | [`BooleanLiteralNode`](BooleanLiteralNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `value` | `boolean` | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BooleanLiteralNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BooleanLiteralNode.md new file mode 100644 index 0000000000..c62e5b765a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/BooleanLiteralNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] BooleanLiteralNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `BooleanLiteral` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | `boolean` | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CallableMessage.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CallableMessage.md new file mode 100644 index 0000000000..07283ef526 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CallableMessage.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] CallableMessage" + +--- +## Type parameters + +| Parameter | +| :------ | +| `T` extends `string`[] | + +```ts +CallableMessage(dict): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `dict` | `Record`<`T`[`number`], `string`\> | + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `keys` | `T` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Checker.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Checker.md new file mode 100644 index 0000000000..2e88a02ee9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Checker.md @@ -0,0 +1,531 @@ +--- +jsApi: true +title: "[I] Checker" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `anyType` | [`UnknownType`](UnknownType.md) | - | +| `errorType` | [`ErrorType`](ErrorType.md) | - | +| `neverType` | [`NeverType`](NeverType.md) | - | +| `typePrototype` | `TypePrototype` | - | +| `voidType` | [`VoidType`](VoidType.md) | - | + +## Methods + +### checkProgram() + +```ts +checkProgram(): void +``` + +*** + +### checkSourceFile() + +```ts +checkSourceFile(file): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `file` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) | + +*** + +### cloneType() + +```ts +cloneType(type, additionalProps?): T +``` + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`Type`](../type-aliases/Type.md) | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `T` | +| `additionalProps`? | `{ [P in string | number | symbol]?: T[P] }` | + +*** + +### createAndFinishType() + +```ts +createAndFinishType(typeDef): T & TypePrototype +``` + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`CreateTypeProps`](../type-aliases/CreateTypeProps.md) | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `typeDef` | `T` | + +*** + +### createFunctionType() + +```ts +createFunctionType(fn): FunctionType +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `fn` | (...`args`) => [`Type`](../type-aliases/Type.md) | + +*** + +### createLiteralType() + +#### createLiteralType(value, node) + +```ts +createLiteralType(value, node?): StringLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `value` | `string` | +| `node`? | [`StringLiteralNode`](StringLiteralNode.md) | + +#### createLiteralType(value, node) + +```ts +createLiteralType(value, node?): NumericLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `value` | `number` | +| `node`? | [`NumericLiteralNode`](NumericLiteralNode.md) | + +#### createLiteralType(value, node) + +```ts +createLiteralType(value, node?): BooleanLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `value` | `boolean` | +| `node`? | [`BooleanLiteralNode`](BooleanLiteralNode.md) | + +#### createLiteralType(value, node) + +```ts +createLiteralType(value, node?): StringLiteral | NumericLiteral | BooleanLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `value` | `string` \| `number` \| `boolean` | +| `node`? | [`StringLiteralNode`](StringLiteralNode.md) \| [`NumericLiteralNode`](NumericLiteralNode.md) \| [`BooleanLiteralNode`](BooleanLiteralNode.md) | + +#### createLiteralType(value, node) + +```ts +createLiteralType(value, node?): StringLiteral | NumericLiteral | BooleanLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `value` | `string` \| `number` \| `boolean` | +| `node`? | [`StringLiteralNode`](StringLiteralNode.md) \| [`NumericLiteralNode`](NumericLiteralNode.md) \| [`BooleanLiteralNode`](BooleanLiteralNode.md) | + +*** + +### createType() + +```ts +createType(typeDef): T & TypePrototype & object +``` + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`CreateTypeProps`](../type-aliases/CreateTypeProps.md) | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `typeDef` | `T` | + +*** + +### evalProjection() + +```ts +evalProjection( + node, + target, + args): Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`ProjectionNode`](ProjectionNode.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `args` | [`Type`](../type-aliases/Type.md)[] | + +*** + +### finishType() + +```ts +finishType(typeDef): T +``` + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`Type`](../type-aliases/Type.md) | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `typeDef` | `T` | + +*** + +### getGlobalNamespaceNode() + +```ts +getGlobalNamespaceNode(): NamespaceStatementNode +``` + +*** + +### getGlobalNamespaceType() + +```ts +getGlobalNamespaceType(): Namespace +``` + +*** + +### getLiteralType() + +#### getLiteralType(node) + +```ts +getLiteralType(node): StringLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`StringLiteralNode`](StringLiteralNode.md) | + +#### getLiteralType(node) + +```ts +getLiteralType(node): NumericLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`NumericLiteralNode`](NumericLiteralNode.md) | + +#### getLiteralType(node) + +```ts +getLiteralType(node): BooleanLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`BooleanLiteralNode`](BooleanLiteralNode.md) | + +#### getLiteralType(node) + +```ts +getLiteralType(node): LiteralType +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`LiteralNode`](../type-aliases/LiteralNode.md) | + +*** + +### getMergedSymbol() + +```ts +getMergedSymbol(sym): undefined | Sym +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `sym` | `undefined` \| [`Sym`](Sym.md) | + +*** + +### getNamespaceString() + +```ts +getNamespaceString(type, options?): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `undefined` \| [`Namespace`](Namespace.md) | +| `options`? | [`TypeNameOptions`](TypeNameOptions.md) | + +#### Returns + +#### Deprecated + +use `import { getNamespaceFullName } from "@typespec/compiler";` + +*** + +### getStdType() + +```ts +getStdType(name): StdTypes[T] +``` + +Std type + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md) \| `"Array"` \| `"Record"` | + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `name` | `T` | Name | + +*** + +### getTypeForNode() + +```ts +getTypeForNode(node): Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | + +*** + +### getTypeName() + +```ts +getTypeName(type, options?): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | +| `options`? | [`TypeNameOptions`](TypeNameOptions.md) | + +#### Returns + +#### Deprecated + +use `import { getTypeName } from "@typespec/compiler";` + +*** + +### isStdType() + +#### isStdType(type, stdType) + +```ts +isStdType(type, stdType?): type is Scalar & Object +``` + +Check if the given type is one of the built-in standard TypeSpec Types. + +##### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `type` | [`Scalar`](Scalar.md) | Type to check | +| `stdType`? | [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md) | If provided check is that standard type | + +#### isStdType(type, stdType) + +```ts +isStdType(type, stdType?): type is Type & Object +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | +| `stdType`? | [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md) \| `"Array"` \| `"Record"` | + +*** + +### isTypeAssignableTo() + +```ts +isTypeAssignableTo( + source, + target, + diagnosticTarget): [boolean, readonly Diagnostic[]] +``` + +Check if the source type can be assigned to the target type. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `source` | [`Type`](../type-aliases/Type.md) \| [`ValueType`](ValueType.md) | Source type, should be assignable to the target. | +| `target` | [`Type`](../type-aliases/Type.md) \| [`ValueType`](ValueType.md) | Target type | +| `diagnosticTarget` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | Target for the diagnostic, unless something better can be inferred. | + +#### Returns + +[related, list of diagnostics] + +*** + +### mergeSourceFile() + +```ts +mergeSourceFile(file): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `file` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`JsSourceFileNode`](JsSourceFileNode.md) | + +*** + +### project() + +```ts +project( + target, + projection, + args?): Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | [`Type`](../type-aliases/Type.md) | +| `projection` | [`ProjectionNode`](ProjectionNode.md) | +| `args`? | (`string` \| `number` \| `boolean` \| [`Type`](../type-aliases/Type.md))[] | + +*** + +### resolveCompletions() + +```ts +resolveCompletions(node): Map +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`IdentifierNode`](IdentifierNode.md) | + +*** + +### resolveIdentifier() + +```ts +resolveIdentifier(node): undefined | Sym +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`IdentifierNode`](IdentifierNode.md) | + +*** + +### resolveTypeReference() + +```ts +resolveTypeReference(node): [undefined | Type, readonly Diagnostic[]] +``` + +Check and resolve a type for the given type reference node. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `node` | [`TypeReferenceNode`](TypeReferenceNode.md) | Node. | + +#### Returns + +Resolved type and diagnostics if there was an error. + +*** + +### setUsingsForFile() + +```ts +setUsingsForFile(file): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `file` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CompilerHost.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CompilerHost.md new file mode 100644 index 0000000000..11d7861967 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CompilerHost.md @@ -0,0 +1,213 @@ +--- +jsApi: true +title: "[I] CompilerHost" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `logSink` | [`LogSink`](LogSink.md) | - | +| `parseCache?` | `WeakMap`<[`SourceFile`](SourceFile.md), [`TypeSpecScriptNode`](TypeSpecScriptNode.md)\> | Optional cache to reuse the results of parsing and binding across programs. | + +## Methods + +### fileURLToPath() + +```ts +fileURLToPath(url): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `url` | `string` | + +*** + +### getExecutionRoot() + +```ts +getExecutionRoot(): string +``` + +*** + +### getJsImport() + +```ts +getJsImport(path): Promise> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### getLibDirs() + +```ts +getLibDirs(): string[] +``` + +*** + +### getSourceFileKind() + +```ts +getSourceFileKind(path): undefined | SourceFileKind +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### mkdirp() + +```ts +mkdirp(path): Promise +``` + +create directory recursively. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | Path to the directory. | + +*** + +### pathToFileURL() + +```ts +pathToFileURL(path): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### readDir() + +```ts +readDir(dir): Promise +``` + +Read directory. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `dir` | `string` | + +#### Returns + +list of file/directory in the given directory. Returns the name not the full path. + +*** + +### readFile() + +```ts +readFile(path): Promise +``` + +read a utf-8 or utf-8 with bom encoded file + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### readUrl() + +```ts +readUrl(url): Promise +``` + +read a file at the given url. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `url` | `string` | + +*** + +### realpath() + +```ts +realpath(path): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### rm() + +```ts +rm(path, options?): Promise +``` + +Deletes a directory or file. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | Path to the directory or file. | +| `options`? | [`RmOptions`](RmOptions.md) | - | + +*** + +### stat() + +```ts +stat(path): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### writeFile() + +```ts +writeFile(path, content): Promise +``` + +Write the file. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | Path to the file. | +| `content` | `string` | Content of the file. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CompilerLocationContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CompilerLocationContext.md new file mode 100644 index 0000000000..5f6b0e0433 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CompilerLocationContext.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] CompilerLocationContext" + +--- +Built-in + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `type` | `"compiler"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CompilerOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CompilerOptions.md new file mode 100644 index 0000000000..9ca4cd6625 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/CompilerOptions.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] CompilerOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `additionalImports?` | `string`[] | - | +| `config?` | `string` | Path to config YAML file or folder in which to search for default tspconfig.yaml file. | +| `designTimeBuild?` | `boolean` | When true, indicates that a compilation is being performed for live
analysis in the language server. | +| `emit?` | `string`[] | List or path to emitters to use. | +| `emitters?` | `Record`<`string`, `EmitterOptions`\> | **Deprecated**

use [emit](CompilerOptions.md) and [options](CompilerOptions.md) instead.

Will be removed in March 2022 sprint. | +| `ignoreDeprecated?` | `boolean` | Suppress all `deprecated` warnings. | +| `linterRuleSet?` | [`LinterRuleSet`](LinterRuleSet.md) | Ruleset to enable for linting. | +| `miscOptions?` | `Record`<`string`, `unknown`\> | - | +| `noEmit?` | `boolean` | - | +| `nostdlib?` | `boolean` | - | +| `options?` | `Record`<`string`, `EmitterOptions`\> | Emitter options.
Key value pair where the key must be the emitter name. | +| `outputDir?` | `string` | Default output directory used by emitters.

**Default**

` ./tsp-output ` | +| `outputPath?` | `string` | **Deprecated**

use outputDir. | +| `parseOptions?` | [`ParseOptions`](ParseOptions.md) | - | +| `trace?` | `string`[] | Trace area to enable. | +| `warningAsError?` | `boolean` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DeclarationNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DeclarationNode.md new file mode 100644 index 0000000000..cb1f3bb4aa --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DeclarationNode.md @@ -0,0 +1,30 @@ +--- +jsApi: true +title: "[I] DeclarationNode" + +--- +## Extended By + +- [`TypeSpecScriptNode`](TypeSpecScriptNode.md) +- [`NamespaceStatementNode`](NamespaceStatementNode.md) +- [`OperationStatementNode`](OperationStatementNode.md) +- [`ModelStatementNode`](ModelStatementNode.md) +- [`ScalarStatementNode`](ScalarStatementNode.md) +- [`InterfaceStatementNode`](InterfaceStatementNode.md) +- [`UnionStatementNode`](UnionStatementNode.md) +- [`EnumStatementNode`](EnumStatementNode.md) +- [`AliasStatementNode`](AliasStatementNode.md) +- [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md) +- [`DecoratorDeclarationStatementNode`](DecoratorDeclarationStatementNode.md) +- [`FunctionDeclarationStatementNode`](FunctionDeclarationStatementNode.md) +- [`ProjectionParameterDeclarationNode`](ProjectionParameterDeclarationNode.md) +- [`ProjectionLambdaParameterDeclarationNode`](ProjectionLambdaParameterDeclarationNode.md) +- [`ProjectionStatementNode`](ProjectionStatementNode.md) +- [`JsSourceFileNode`](JsSourceFileNode.md) +- [`JsNamespaceDeclarationNode`](JsNamespaceDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratedType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratedType.md new file mode 100644 index 0000000000..deec49240e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratedType.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DecoratedType" + +--- +## Extended By + +- [`Model`](Model.md) +- [`ModelProperty`](ModelProperty.md) +- [`Scalar`](Scalar.md) +- [`Interface`](Interface.md) +- [`Enum`](Enum.md) +- [`EnumMember`](EnumMember.md) +- [`Operation`](Operation.md) +- [`Namespace`](Namespace.md) +- [`Union`](Union.md) +- [`UnionVariant`](UnionVariant.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Decorator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Decorator.md new file mode 100644 index 0000000000..c85ef6409f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Decorator.md @@ -0,0 +1,51 @@ +--- +jsApi: true +title: "[I] Decorator" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `implementation` | (...`args`) => `void` | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Decorator"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | \`@${string}\` | - | - | +| `namespace` | [`Namespace`](Namespace.md) | - | - | +| `node` | [`DecoratorDeclarationStatementNode`](DecoratorDeclarationStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `parameters` | [`FunctionParameter`](FunctionParameter.md)[] | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `target` | [`FunctionParameter`](FunctionParameter.md) | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorApplication.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorApplication.md new file mode 100644 index 0000000000..610312d64d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorApplication.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] DecoratorApplication" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `args` | [`DecoratorArgument`](DecoratorArgument.md)[] | - | +| `decorator` | [`DecoratorFunction`](DecoratorFunction.md) | - | +| `definition?` | [`Decorator`](Decorator.md) | - | +| `node?` | [`DecoratorExpressionNode`](DecoratorExpressionNode.md) \| [`AugmentDecoratorStatementNode`](AugmentDecoratorStatementNode.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorArgument.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorArgument.md new file mode 100644 index 0000000000..1b43175dc5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorArgument.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] DecoratorArgument" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `jsValue` | `string` \| `number` \| `boolean` \| [`Type`](../type-aliases/Type.md) | Marshalled value for use in Javascript. | +| `node?` | [`Node`](../type-aliases/Node.md) | - | +| `value` | [`Type`](../type-aliases/Type.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorContext.md new file mode 100644 index 0000000000..24e6f39e37 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorContext.md @@ -0,0 +1,66 @@ +--- +jsApi: true +title: "[I] DecoratorContext" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `decoratorTarget` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | Point to the decorator target | +| `program` | [`Program`](Program.md) | - | + +## Methods + +### call() + +```ts +call( + decorator, + target, ... + args): R +``` + +Helper to call out to another decorator + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`Type`](../type-aliases/Type.md) | +| `A` extends `any`[] | +| `R` | + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `decorator` | (`context`, `target`, ...`args`) => `R` | Other decorator function | +| `target` | `T` | - | +| ...`args` | `A` | Args to pass to other decorator function | + +*** + +### getArgumentTarget() + +```ts +getArgumentTarget(paramIndex): undefined | DiagnosticTarget +``` + +Function that can be used to retrieve the target for a parameter at the given index. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `paramIndex` | `number` | Parameter index in the typespec | + +#### Returns + +#### Example + +```ts +@foo("bar", 123) -> $foo(context, target, arg0: string, arg1: number); + getArgumentTarget(0) -> target for arg0 + getArgumentTarget(1) -> target for arg1 +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorDeclarationStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorDeclarationStatementNode.md new file mode 100644 index 0000000000..5560aefc58 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorDeclarationStatementNode.md @@ -0,0 +1,34 @@ +--- +jsApi: true +title: "[I] DecoratorDeclarationStatementNode" + +--- +Represent a decorator declaration + +## Example + +```typespec +extern dec doc(target: Type, value: valueof string); +``` + +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `DecoratorDeclarationStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `modifierFlags` | [`ModifierFlags`](../enumerations/ModifierFlags.md) | - | - | +| `readonly` | `modifiers` | readonly [`ExternKeywordNode`](ExternKeywordNode.md)[] | - | - | +| `readonly` | `parameters` | [`FunctionParameterNode`](FunctionParameterNode.md)[] | Additional parameters | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`FunctionParameterNode`](FunctionParameterNode.md) | Decorator target. First parameter. | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorDefinition.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorDefinition.md new file mode 100644 index 0000000000..73b25848c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorDefinition.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] DecoratorDefinition" + +--- +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends [`TypeKind`](../type-aliases/TypeKind.md) | - | +| `P` extends readonly [`DecoratorParamDefinition`](DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\>[] | - | +| `S` extends [`DecoratorParamDefinition`](DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\> \| `undefined` | `undefined` | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `args` | `P` | List of positional arguments in the function. | +| `readonly` | `name` | `string` | Name of the decorator. | +| `readonly` | `spreadArgs?` | `S` | **Optional**

Type of the spread args at the end of the function if applicable. | +| `readonly` | `target` | `T` \| readonly `T`[] | Decorator target. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorExpressionNode.md new file mode 100644 index 0000000000..60f9f274cf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorExpressionNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DecoratorExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `DecoratorExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorFunction.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorFunction.md new file mode 100644 index 0000000000..6a95ad3f69 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorFunction.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] DecoratorFunction" + +--- +```ts +DecoratorFunction( + program, + target, ... + customArgs): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`DecoratorContext`](DecoratorContext.md) | +| `target` | `any` | +| ...`customArgs` | `any`[] | + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `namespace?` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorParamDefinition.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorParamDefinition.md new file mode 100644 index 0000000000..a677ca5bcf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorParamDefinition.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[I] DecoratorParamDefinition" + +--- +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](../type-aliases/TypeKind.md) | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `kind` | `K` \| readonly `K`[] | Kind of the parameter | +| `readonly` | `optional?` | `boolean` | Is the parameter optional. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorValidator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorValidator.md new file mode 100644 index 0000000000..3ae5c968cd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DecoratorValidator.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[I] DecoratorValidator" + +--- +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends [`TypeKind`](../type-aliases/TypeKind.md) | - | +| `P` extends readonly [`DecoratorParamDefinition`](DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\>[] | - | +| `S` extends [`DecoratorParamDefinition`](DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\> \| `undefined` | `undefined` | + +## Methods + +### validate() + +```ts +validate( + context, + target, + parameters): boolean +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](DecoratorContext.md) | +| `target` | [`InferredTypeSpecValue`](../type-aliases/InferredTypeSpecValue.md)<`T`\> | +| `parameters` | `InferParameters`<`P`, `S`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DeprecatedDirective.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DeprecatedDirective.md new file mode 100644 index 0000000000..b5558b58ed --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DeprecatedDirective.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[I] DeprecatedDirective" + +--- +## Extends + +- [`DirectiveBase`](DirectiveBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `message` | `string` | - | - | +| `name` | `"deprecated"` | - | - | +| `node` | [`DirectiveExpressionNode`](DirectiveExpressionNode.md) | - | [`DirectiveBase`](DirectiveBase.md).`node` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DeprecationDetails.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DeprecationDetails.md new file mode 100644 index 0000000000..b826f1f4cf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DeprecationDetails.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] DeprecationDetails" + +--- +Provides details on the deprecation of a given type. + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `message` | `string` | The deprecation message to display when the type is used. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Diagnostic.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Diagnostic.md new file mode 100644 index 0000000000..b4e0fa22e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Diagnostic.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] Diagnostic" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `code` | `string` | - | +| `message` | `string` | - | +| `severity` | [`DiagnosticSeverity`](../type-aliases/DiagnosticSeverity.md) | - | +| `target` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticCollector.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticCollector.md new file mode 100644 index 0000000000..40ff22dacf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticCollector.md @@ -0,0 +1,80 @@ +--- +jsApi: true +title: "[I] DiagnosticCollector" + +--- +Helper object to collect diagnostics from function following the diagnostics accessor pattern(foo() => [T, Diagnostic[]]) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `diagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | - | + +## Methods + +### add() + +```ts +add(diagnostic): void +``` + +Add a diagnostic to the collection + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `diagnostic` | [`Diagnostic`](Diagnostic.md) | Diagnostic to add. | + +*** + +### pipe() + +```ts +pipe(result): T +``` + +Unwrap the Diagnostic result, add all the diagnostics and return the data. + +#### Type parameters + +| Parameter | +| :------ | +| `T` | + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `result` | [`DiagnosticResult`](../type-aliases/DiagnosticResult.md)<`T`\> | Accessor diagnostic result | + +*** + +### wrap() + +```ts +wrap(value): DiagnosticResult +``` + +Wrap the given value in a tuple including the diagnostics following the TypeSpec accessor pattern. + +#### Type parameters + +| Parameter | +| :------ | +| `T` | + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `value` | `T` | Accessor value to return | + +#### Returns + +#### Example + +```ts +return diagnostics.wrap(routes); +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticCreator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticCreator.md new file mode 100644 index 0000000000..30e7130973 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticCreator.md @@ -0,0 +1,60 @@ +--- +jsApi: true +title: "[I] DiagnosticCreator" + +--- +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `diagnostics` | [`DiagnosticMap`](../type-aliases/DiagnosticMap.md)<`T`\> | - | +| `readonly` | `type` | `T` | - | + +## Methods + +### createDiagnostic() + +```ts +createDiagnostic(diag): Diagnostic +``` + +#### Type parameters + +| Parameter | Default | +| :------ | :------ | +| `C` extends `string` \| `number` \| `symbol` | - | +| `M` extends `string` \| `number` \| `symbol` | `"default"` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diag` | [`DiagnosticReport`](../type-aliases/DiagnosticReport.md)<`T`, `C`, `M`\> | + +*** + +### reportDiagnostic() + +```ts +reportDiagnostic(program, diag): void +``` + +#### Type parameters + +| Parameter | Default | +| :------ | :------ | +| `C` extends `string` \| `number` \| `symbol` | - | +| `M` extends `string` \| `number` \| `symbol` | `"default"` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](Program.md) | +| `diag` | [`DiagnosticReport`](../type-aliases/DiagnosticReport.md)<`T`, `C`, `M`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticDefinition.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticDefinition.md new file mode 100644 index 0000000000..166fc62a3c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticDefinition.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[I] DiagnosticDefinition" + +--- +## Type parameters + +| Parameter | +| :------ | +| `M` extends [`DiagnosticMessages`](DiagnosticMessages.md) | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `messages` | `M` | - | +| `readonly` | `severity` | `"error"` \| `"warning"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticMessages.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticMessages.md new file mode 100644 index 0000000000..55a0d323be --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiagnosticMessages.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[I] DiagnosticMessages" + +--- +## Indexable + + \[`messageId`: `string`\]: `string` \| [`CallableMessage`](CallableMessage.md)<`string`[]\> diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DirectiveBase.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DirectiveBase.md new file mode 100644 index 0000000000..9e41fea0dc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DirectiveBase.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] DirectiveBase" + +--- +## Extended By + +- [`SuppressDirective`](SuppressDirective.md) +- [`DeprecatedDirective`](DeprecatedDirective.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `node` | [`DirectiveExpressionNode`](DirectiveExpressionNode.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DirectiveExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DirectiveExpressionNode.md new file mode 100644 index 0000000000..f67f8eca79 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DirectiveExpressionNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DirectiveExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | readonly [`DirectiveArgument`](../type-aliases/DirectiveArgument.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `DirectiveExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Dirent.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Dirent.md new file mode 100644 index 0000000000..71bb214e94 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Dirent.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] Dirent" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | - | + +## Methods + +### isDirectory() + +```ts +isDirectory(): boolean +``` + +*** + +### isFile() + +```ts +isFile(): boolean +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiscriminatedUnion.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiscriminatedUnion.md new file mode 100644 index 0000000000..47d11187ca --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DiscriminatedUnion.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] DiscriminatedUnion" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `propertyName` | `string` | - | +| `variants` | `Map`<`string`, [`Model`](Model.md)\> | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Discriminator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Discriminator.md new file mode 100644 index 0000000000..6fa4551106 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Discriminator.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] Discriminator" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `propertyName` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocData.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocData.md new file mode 100644 index 0000000000..3ceaf1de98 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocData.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] DocData" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `source` | `"decorator"` \| `"comment"` | How was the doc set.
- `@doc` means the `@doc` decorator was used
- `comment` means it was set from a `/** comment * /` | +| `value` | `string` | Doc value. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocErrorsTagNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocErrorsTagNode.md new file mode 100644 index 0000000000..62d380541a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocErrorsTagNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DocErrorsTagNode" + +--- +## Extends + +- [`DocTagBaseNode`](DocTagBaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`content` | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`flags` | +| `readonly` | `kind` | `DocErrorsTag` | - | [`DocTagBaseNode`](DocTagBaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`DocTagBaseNode`](DocTagBaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`tagName` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocNode.md new file mode 100644 index 0000000000..74a7db2828 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DocNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `Doc` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `tags` | readonly [`DocTag`](../type-aliases/DocTag.md)[] | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocParamTagNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocParamTagNode.md new file mode 100644 index 0000000000..7f437e1275 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocParamTagNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] DocParamTagNode" + +--- +## Extends + +- [`DocTagBaseNode`](DocTagBaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`content` | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`flags` | +| `readonly` | `kind` | `DocParamTag` | - | [`DocTagBaseNode`](DocTagBaseNode.md).`kind` | +| `readonly` | `paramName` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`DocTagBaseNode`](DocTagBaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`tagName` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocReturnsTagNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocReturnsTagNode.md new file mode 100644 index 0000000000..fb5cf9bb3a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocReturnsTagNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DocReturnsTagNode" + +--- +## Extends + +- [`DocTagBaseNode`](DocTagBaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`content` | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`flags` | +| `readonly` | `kind` | `DocReturnsTag` | - | [`DocTagBaseNode`](DocTagBaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`DocTagBaseNode`](DocTagBaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`tagName` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocTagBaseNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocTagBaseNode.md new file mode 100644 index 0000000000..95265ee0dc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocTagBaseNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DocTagBaseNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | [`SyntaxKind`](../enumerations/SyntaxKind.md) | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocTemplateTagNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocTemplateTagNode.md new file mode 100644 index 0000000000..5a682f117d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocTemplateTagNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] DocTemplateTagNode" + +--- +## Extends + +- [`DocTagBaseNode`](DocTagBaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`content` | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`flags` | +| `readonly` | `kind` | `DocTemplateTag` | - | [`DocTagBaseNode`](DocTagBaseNode.md).`kind` | +| `readonly` | `paramName` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`DocTagBaseNode`](DocTagBaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`tagName` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocTextNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocTextNode.md new file mode 100644 index 0000000000..a23d1b4ebd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocTextNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] DocTextNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `DocText` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `text` | `string` | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocUnknownTagNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocUnknownTagNode.md new file mode 100644 index 0000000000..59b330fbb7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/DocUnknownTagNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DocUnknownTagNode" + +--- +## Extends + +- [`DocTagBaseNode`](DocTagBaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`content` | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`flags` | +| `readonly` | `kind` | `DocUnknownTag` | - | [`DocTagBaseNode`](DocTagBaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`DocTagBaseNode`](DocTagBaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`tagName` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EmitContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EmitContext.md new file mode 100644 index 0000000000..ce610523cc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EmitContext.md @@ -0,0 +1,40 @@ +--- +jsApi: true +title: "[I] EmitContext" + +--- +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `TOptions` extends `object` | `Record`<`string`, `never`\> | + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `emitterOutputDir` | `string` | Configured output dir for the emitter. Emitter should emit all output under that directory. | +| `options` | `TOptions` | Emitter custom options defined in createTypeSpecLibrary | +| `program` | [`Program`](Program.md) | TypeSpec Program. | + +## Methods + +### getAssetEmitter() + +```ts +getAssetEmitter(TypeEmitterClass): AssetEmitter +``` + +Get an asset emitter to write emitted output to disk using a TypeEmitter + +#### Type parameters + +| Parameter | +| :------ | +| `T` | + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `TypeEmitterClass` | *typeof* `TypeEmitter` | The TypeEmitter to construct your emitted output | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EmitFileOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EmitFileOptions.md new file mode 100644 index 0000000000..21c9a670f4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EmitFileOptions.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] EmitFileOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `content` | `string` | - | +| `newLine?` | [`NewLine`](../type-aliases/NewLine.md) | - | +| `path` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EmptyStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EmptyStatementNode.md new file mode 100644 index 0000000000..6deaa371f0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EmptyStatementNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] EmptyStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `EmptyStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EncodeData.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EncodeData.md new file mode 100644 index 0000000000..fe9cbabff8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EncodeData.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] EncodeData" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `encoding` | `string` | - | +| `type` | [`Scalar`](Scalar.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Enum.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Enum.md new file mode 100644 index 0000000000..6762c5e474 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Enum.md @@ -0,0 +1,50 @@ +--- +jsApi: true +title: "[I] Enum" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Enum"` | - | [`BaseType`](BaseType.md).`kind` | +| `members` | `RekeyableMap`<`string`, [`EnumMember`](EnumMember.md)\> | The members of the enum.

Members are ordered in the order that they appear in source. Members
obtained via `...` are inserted where the spread appears in source. | - | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `node` | [`EnumStatementNode`](EnumStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumMember.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumMember.md new file mode 100644 index 0000000000..c6347aee9d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumMember.md @@ -0,0 +1,51 @@ +--- +jsApi: true +title: "[I] EnumMember" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `enum` | [`Enum`](Enum.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"EnumMember"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `node` | [`EnumMemberNode`](EnumMemberNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `sourceMember?` | [`EnumMember`](EnumMember.md) | when spread operators make new enum members,
this tracks the enum member we copied from. | - | +| `value?` | `string` \| `number` | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumMemberNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumMemberNode.md new file mode 100644 index 0000000000..38ca5eea27 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumMemberNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] EnumMemberNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `EnumMember` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`EnumStatementNode`](EnumStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value?` | [`StringLiteralNode`](StringLiteralNode.md) \| [`NumericLiteralNode`](NumericLiteralNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumSpreadMemberNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumSpreadMemberNode.md new file mode 100644 index 0000000000..56fc99d21d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumSpreadMemberNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] EnumSpreadMemberNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `EnumSpreadMember` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`TypeReferenceNode`](TypeReferenceNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumStatementNode.md new file mode 100644 index 0000000000..2ec544dd0a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/EnumStatementNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] EnumStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `EnumStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `members` | readonly ([`EnumMemberNode`](EnumMemberNode.md) \| [`EnumSpreadMemberNode`](EnumSpreadMemberNode.md))[] | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ErrorType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ErrorType.md new file mode 100644 index 0000000000..9cb66d9d94 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ErrorType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] ErrorType" + +--- +## Extends + +- [`IntrinsicType`](IntrinsicType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`IntrinsicType`](IntrinsicType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`IntrinsicType`](IntrinsicType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`IntrinsicType`](IntrinsicType.md).`kind` | +| `name` | `"ErrorType"` | - | [`IntrinsicType`](IntrinsicType.md).`name` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`IntrinsicType`](IntrinsicType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`IntrinsicType`](IntrinsicType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`IntrinsicType`](IntrinsicType.md).[`projectionsByName`](IntrinsicType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ExternKeywordNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ExternKeywordNode.md new file mode 100644 index 0000000000..894e5e8f5c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ExternKeywordNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ExternKeywordNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ExternKeyword` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FileLibraryMetadata.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FileLibraryMetadata.md new file mode 100644 index 0000000000..c8cdd0fef4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FileLibraryMetadata.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[I] FileLibraryMetadata" + +--- +## Extends + +- `LibraryMetadataBase` + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `bugs?` | `object` | - | LibraryMetadataBase.bugs | +| `bugs.url?` | `string` | Url where to file bugs for this library. | - | +| `homepage?` | `string` | Library homepage. | LibraryMetadataBase.homepage | +| `name?` | `string` | Library name as specified in the package.json or in exported $lib. | - | +| `type` | `"file"` | - | - | +| `version?` | `string` | Library version | LibraryMetadataBase.version | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionDeclarationStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionDeclarationStatementNode.md new file mode 100644 index 0000000000..61a5a1db85 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionDeclarationStatementNode.md @@ -0,0 +1,34 @@ +--- +jsApi: true +title: "[I] FunctionDeclarationStatementNode" + +--- +Represent a function declaration + +## Example + +```typespec +extern fn camelCase(value: StringLiteral): StringLiteral; +``` + +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `FunctionDeclarationStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `modifierFlags` | [`ModifierFlags`](../enumerations/ModifierFlags.md) | - | - | +| `readonly` | `modifiers` | readonly [`ExternKeywordNode`](ExternKeywordNode.md)[] | - | - | +| `readonly` | `parameters` | [`FunctionParameterNode`](FunctionParameterNode.md)[] | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `returnType?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionParameter.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionParameter.md new file mode 100644 index 0000000000..9991d7da9a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionParameter.md @@ -0,0 +1,50 @@ +--- +jsApi: true +title: "[I] FunctionParameter" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"FunctionParameter"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `node` | [`FunctionParameterNode`](FunctionParameterNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `optional` | `boolean` | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `rest` | `boolean` | - | - | +| `type` | [`Type`](../type-aliases/Type.md) \| [`ValueType`](ValueType.md) | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionParameterNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionParameterNode.md new file mode 100644 index 0000000000..525c999fbc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionParameterNode.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] FunctionParameterNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `FunctionParameter` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `optional` | `boolean` | Parameter defined with `?` | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `rest` | `boolean` | Parameter defined with `...` notation. | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `type?` | [`Expression`](../type-aliases/Expression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionType.md new file mode 100644 index 0000000000..202b58404b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/FunctionType.md @@ -0,0 +1,51 @@ +--- +jsApi: true +title: "[I] FunctionType" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `implementation` | (...`args`) => `unknown` | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Function"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `node?` | [`FunctionDeclarationStatementNode`](FunctionDeclarationStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `parameters` | [`FunctionParameter`](FunctionParameter.md)[] | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `returnType` | [`Type`](../type-aliases/Type.md) | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IdentifierContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IdentifierContext.md new file mode 100644 index 0000000000..6a5a70c1e4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IdentifierContext.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] IdentifierContext" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `kind` | [`IdentifierKind`](../enumerations/IdentifierKind.md) | - | +| `node` | [`Node`](../type-aliases/Node.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IdentifierNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IdentifierNode.md new file mode 100644 index 0000000000..b67502bf58 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IdentifierNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] IdentifierNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `Identifier` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `sv` | `string` | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ImportStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ImportStatementNode.md new file mode 100644 index 0000000000..0001a7e2a1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ImportStatementNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ImportStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ImportStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `path` | [`StringLiteralNode`](StringLiteralNode.md) | - | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Interface.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Interface.md new file mode 100644 index 0000000000..78aae04109 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Interface.md @@ -0,0 +1,54 @@ +--- +jsApi: true +title: "[I] Interface" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md).[`TemplatedTypeBase`](TemplatedTypeBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Interface"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `node` | [`InterfaceStatementNode`](InterfaceStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `operations` | `RekeyableMap`<`string`, [`Operation`](Operation.md)\> | The operations of the interface.

Operations are ordered in the order that they appear in the source.
Operations obtained via `interface extends` appear before operations
declared in the interface body. | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `sourceInterfaces` | [`Interface`](Interface.md)[] | The interfaces that provide additional operations via `interface extends`.

Note that despite the same `extends` keyword in source form, this is a
different semantic relationship than the one from [Model](Model.md) to
[Model.baseModel](ArrayModelType.md). Operations from extended interfaces are copied
into [Interface.operations](Interface.md). | - | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/InterfaceStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/InterfaceStatementNode.md new file mode 100644 index 0000000000..f3a992398d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/InterfaceStatementNode.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[I] InterfaceStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `extends` | readonly [`TypeReferenceNode`](TypeReferenceNode.md)[] | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `InterfaceStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `operations` | readonly [`OperationStatementNode`](OperationStatementNode.md)[] | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IntersectionExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IntersectionExpressionNode.md new file mode 100644 index 0000000000..f2ebd1f482 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IntersectionExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] IntersectionExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `IntersectionExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `options` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IntrinsicType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IntrinsicType.md new file mode 100644 index 0000000000..619457528e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/IntrinsicType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] IntrinsicType" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | \| `"unknown"` \| `"never"` \| `"null"` \| `"void"` \| `"ErrorType"` | - | - | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/InvalidStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/InvalidStatementNode.md new file mode 100644 index 0000000000..3f47cdc128 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/InvalidStatementNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] InvalidStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `InvalidStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/JSONSchemaValidator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/JSONSchemaValidator.md new file mode 100644 index 0000000000..34ad2abc1a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/JSONSchemaValidator.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] JSONSchemaValidator" + +--- +## Methods + +### validate() + +```ts +validate(config, target): Diagnostic[] +``` + +Validate the configuration against its JSON Schema. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `config` | `unknown` | Configuration to validate. | +| `target` | [`SourceFile`](SourceFile.md) \| `YamlScript` \| *typeof* [`NoTarget`](../variables/NoTarget.md) | Source file target to use for diagnostics. | + +#### Returns + +Diagnostics produced by schema validation of the configuration. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/JsNamespaceDeclarationNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/JsNamespaceDeclarationNode.md new file mode 100644 index 0000000000..e67fca43ef --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/JsNamespaceDeclarationNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] JsNamespaceDeclarationNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `JsNamespaceDeclaration` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/JsSourceFileNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/JsSourceFileNode.md new file mode 100644 index 0000000000..a8af98851b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/JsSourceFileNode.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] JsSourceFileNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `esmExports` | `any` | - | - | +| `readonly` | `file` | [`SourceFile`](SourceFile.md) | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `JsSourceFile` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `namespaceSymbols` | [`Sym`](Sym.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LibraryInstance.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LibraryInstance.md new file mode 100644 index 0000000000..b1d2e4d71d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LibraryInstance.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] LibraryInstance" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `definition?` | [`TypeSpecLibrary`](TypeSpecLibrary.md)<`any`, `Record`<`string`, `never`\>\> | - | +| `entrypoint` | `undefined` \| [`JsSourceFileNode`](JsSourceFileNode.md) | - | +| `metadata` | [`LibraryMetadata`](../type-aliases/LibraryMetadata.md) | - | +| `module` | [`ModuleResolutionResult`](../type-aliases/ModuleResolutionResult.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LibraryLocationContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LibraryLocationContext.md new file mode 100644 index 0000000000..278ecf3d50 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LibraryLocationContext.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] LibraryLocationContext" + +--- +Defined in a library. + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `metadata` | [`ModuleLibraryMetadata`](ModuleLibraryMetadata.md) | - | +| `type` | `"library"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LineAndCharacter.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LineAndCharacter.md new file mode 100644 index 0000000000..908afd3e56 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LineAndCharacter.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] LineAndCharacter" + +--- +Identifies the position within a source file by line number and offset from +beginning of line. + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `character` | `number` | The offset in UTF-16 code units to the character from the beginning of the
line. 0-based.

NOTE: This is not necessarily the same as what a given text editor might
call the "column". Tabs, combining characters, surrogate pairs, and so on
can all cause an editor to report the column differently. Indeed, different
text editors report different column numbers for the same position in a
given document. | +| `line` | `number` | The line number. 0-based. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LineComment.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LineComment.md new file mode 100644 index 0000000000..bc04dd4ba8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LineComment.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[I] LineComment" + +--- +## Extends + +- [`TextRange`](TextRange.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`TextRange`](TextRange.md).`end` | +| `readonly` | `kind` | `LineComment` | - | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`TextRange`](TextRange.md).`pos` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterDefinition.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterDefinition.md new file mode 100644 index 0000000000..e6df6493b6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterDefinition.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] LinterDefinition" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `ruleSets?` | `Record`<`string`, [`LinterRuleSet`](LinterRuleSet.md)\> | - | +| `rules` | [`LinterRuleDefinition`](LinterRuleDefinition.md)<`string`, [`DiagnosticMessages`](DiagnosticMessages.md)\>[] | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRule.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRule.md new file mode 100644 index 0000000000..dd898a4a68 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRule.md @@ -0,0 +1,45 @@ +--- +jsApi: true +title: "[I] LinterRule" + +--- +Resolved instance of a linter rule that will run. + +## Extends + +- [`LinterRuleDefinition`](LinterRuleDefinition.md)<`N`, `DM`\> + +## Type parameters + +| Parameter | +| :------ | +| `N` extends `string` | +| `DM` extends [`DiagnosticMessages`](DiagnosticMessages.md) | + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `description` | `string` | - | [`LinterRuleDefinition`](LinterRuleDefinition.md).`description` | +| `id` | `string` | Expanded rule id in format `:` | - | +| `messages` | `DM` | - | [`LinterRuleDefinition`](LinterRuleDefinition.md).`messages` | +| `name` | `N` | - | [`LinterRuleDefinition`](LinterRuleDefinition.md).`name` | +| `severity` | `"warning"` | - | [`LinterRuleDefinition`](LinterRuleDefinition.md).`severity` | + +## Methods + +### create() + +```ts +create(context): SemanticNodeListener +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`LinterRuleContext`](LinterRuleContext.md)<`DM`\> | + +#### Inherited from + +[`LinterRuleDefinition`](LinterRuleDefinition.md).[`create`](LinterRuleDefinition.md#create) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRuleContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRuleContext.md new file mode 100644 index 0000000000..65a96be11b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRuleContext.md @@ -0,0 +1,36 @@ +--- +jsApi: true +title: "[I] LinterRuleContext" + +--- +## Type parameters + +| Parameter | +| :------ | +| `DM` extends [`DiagnosticMessages`](DiagnosticMessages.md) | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `program` | [`Program`](Program.md) | - | + +## Methods + +### reportDiagnostic() + +```ts +reportDiagnostic(diag): void +``` + +#### Type parameters + +| Parameter | +| :------ | +| `M` extends `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diag` | [`LinterRuleDiagnosticReport`](../type-aliases/LinterRuleDiagnosticReport.md)<`DM`, `M`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRuleDefinition.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRuleDefinition.md new file mode 100644 index 0000000000..105294cd00 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRuleDefinition.md @@ -0,0 +1,38 @@ +--- +jsApi: true +title: "[I] LinterRuleDefinition" + +--- +## Extended By + +- [`LinterRule`](LinterRule.md) + +## Type parameters + +| Parameter | +| :------ | +| `N` extends `string` | +| `DM` extends [`DiagnosticMessages`](DiagnosticMessages.md) | + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description` | `string` | - | +| `messages` | `DM` | - | +| `name` | `N` | - | +| `severity` | `"warning"` | - | + +## Methods + +### create() + +```ts +create(context): SemanticNodeListener +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`LinterRuleContext`](LinterRuleContext.md)<`DM`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRuleSet.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRuleSet.md new file mode 100644 index 0000000000..2c2e36aab3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LinterRuleSet.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] LinterRuleSet" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `disable?` | `Record`<\`${string}/${string}\`, `string`\> | Rules to disable. A rule CANNOT be in enable and disable map. | +| `enable?` | `Record`<\`${string}/${string}\`, `boolean`\> | Rules to enable/configure | +| `extends?` | \`${string}/${string}\`[] | Other ruleset this ruleset extends | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ListOperationOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ListOperationOptions.md new file mode 100644 index 0000000000..d6db33c018 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ListOperationOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] ListOperationOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `recursive?` | `boolean` | If the container is a namespace look for operation in sub namespaces.

**Default**

` true ` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LogInfo.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LogInfo.md new file mode 100644 index 0000000000..35857be4e2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LogInfo.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] LogInfo" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `code?` | `string` | - | +| `level` | [`LogLevel`](../type-aliases/LogLevel.md) | - | +| `message` | `string` | - | +| `target?` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LogSink.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LogSink.md new file mode 100644 index 0000000000..fdcbbbb13a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/LogSink.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[I] LogSink" + +--- +## Methods + +### log() + +```ts +log(log): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `log` | [`ProcessedLog`](ProcessedLog.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Logger.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Logger.md new file mode 100644 index 0000000000..3ab0310ea7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Logger.md @@ -0,0 +1,60 @@ +--- +jsApi: true +title: "[I] Logger" + +--- +## Methods + +### error() + +```ts +error(message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | + +*** + +### log() + +```ts +log(log): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `log` | [`LogInfo`](LogInfo.md) | + +*** + +### trace() + +```ts +trace(message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | + +*** + +### warn() + +```ts +warn(message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/MemberExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/MemberExpressionNode.md new file mode 100644 index 0000000000..7226d7a018 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/MemberExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] MemberExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `base` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `MemberExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `selector` | `"."` \| `"::"` | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Model.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Model.md new file mode 100644 index 0000000000..40a4049a7d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Model.md @@ -0,0 +1,57 @@ +--- +jsApi: true +title: "[I] Model" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md).[`TemplatedTypeBase`](TemplatedTypeBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `baseModel?` | [`Model`](Model.md) | Model this model extends. This represent inheritance. | - | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `derivedModels` | [`Model`](Model.md)[] | Direct children. This is the reverse relation of [baseModel](ArrayModelType.md) | - | +| `indexer?` | [`ModelIndexer`](../type-aliases/ModelIndexer.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Model"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `node?` | [`ModelStatementNode`](ModelStatementNode.md) \| [`ModelExpressionNode`](ModelExpressionNode.md) \| [`IntersectionExpressionNode`](IntersectionExpressionNode.md) \| [`ProjectionModelExpressionNode`](ProjectionModelExpressionNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `properties` | `RekeyableMap`<`string`, [`ModelProperty`](ModelProperty.md)\> | The properties of the model.

Properties are ordered in the order that they appear in source.
Properties obtained via `model is` appear before properties defined in
the model body. Properties obtained via `...` are inserted where the
spread appears in source.

Properties inherited via `model extends` are not included. Use
[walkPropertiesInherited](../functions/walkPropertiesInherited.md) to enumerate all properties in the
inheritance hierarchy. | - | +| `sourceModel?` | [`Model`](Model.md) | The model that is referenced via `model is`. | - | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelExpressionNode.md new file mode 100644 index 0000000000..50941f6c05 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ModelExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ModelExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `properties` | ([`ModelPropertyNode`](ModelPropertyNode.md) \| [`ModelSpreadPropertyNode`](ModelSpreadPropertyNode.md))[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelProperty.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelProperty.md new file mode 100644 index 0000000000..be3ac3d208 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelProperty.md @@ -0,0 +1,53 @@ +--- +jsApi: true +title: "[I] ModelProperty" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `default?` | [`Type`](../type-aliases/Type.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"ModelProperty"` | - | [`BaseType`](BaseType.md).`kind` | +| `model?` | [`Model`](Model.md) | - | - | +| `name` | `string` | - | - | +| `node` | [`ModelPropertyNode`](ModelPropertyNode.md) \| [`ModelSpreadPropertyNode`](ModelSpreadPropertyNode.md) \| [`ProjectionModelPropertyNode`](ProjectionModelPropertyNode.md) \| [`ProjectionModelSpreadPropertyNode`](ProjectionModelSpreadPropertyNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `optional` | `boolean` | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `sourceProperty?` | [`ModelProperty`](ModelProperty.md) | - | - | +| `type` | [`Type`](../type-aliases/Type.md) | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelPropertyNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelPropertyNode.md new file mode 100644 index 0000000000..39b945081a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelPropertyNode.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] ModelPropertyNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `default?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `ModelProperty` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `optional` | `boolean` | - | - | +| `readonly` | `parent?` | [`ModelStatementNode`](ModelStatementNode.md) \| [`ModelExpressionNode`](ModelExpressionNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | [`Expression`](../type-aliases/Expression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelSpreadPropertyNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelSpreadPropertyNode.md new file mode 100644 index 0000000000..dc53dafffa --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelSpreadPropertyNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ModelSpreadPropertyNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ModelSpreadProperty` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`ModelStatementNode`](ModelStatementNode.md) \| [`ModelExpressionNode`](ModelExpressionNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`TypeReferenceNode`](TypeReferenceNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelStatementNode.md new file mode 100644 index 0000000000..966190d728 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModelStatementNode.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[I] ModelStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `extends?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `is?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `kind` | `ModelStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `properties` | readonly ([`ModelPropertyNode`](ModelPropertyNode.md) \| [`ModelSpreadPropertyNode`](ModelSpreadPropertyNode.md))[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModuleLibraryMetadata.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModuleLibraryMetadata.md new file mode 100644 index 0000000000..6044378c00 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ModuleLibraryMetadata.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ModuleLibraryMetadata" + +--- +Data for a library. Either loaded via a node_modules package or a standalone js file + +## Extends + +- `LibraryMetadataBase` + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `bugs?` | `object` | - | LibraryMetadataBase.bugs | +| `bugs.url?` | `string` | Url where to file bugs for this library. | - | +| `homepage?` | `string` | Library homepage. | LibraryMetadataBase.homepage | +| `name` | `string` | Library name as specified in the package.json or in exported $lib. | - | +| `type` | `"module"` | - | - | +| `version?` | `string` | Library version | LibraryMetadataBase.version | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Namespace.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Namespace.md new file mode 100644 index 0000000000..3a531295e6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Namespace.md @@ -0,0 +1,58 @@ +--- +jsApi: true +title: "[I] Namespace" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decoratorDeclarations` | `Map`<`string`, [`Decorator`](Decorator.md)\> | The decorators declared in the namespace.

Order is implementation-defined and may change. | - | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `enums` | `Map`<`string`, [`Enum`](Enum.md)\> | The enums in the namespace.

Order is implementation-defined and may change. | - | +| `functionDeclarations` | `Map`<`string`, [`FunctionType`](FunctionType.md)\> | The functions declared in the namespace.

Order is implementation-defined and may change. | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `interfaces` | `Map`<`string`, [`Interface`](Interface.md)\> | The interfaces in the namespace.

Order is implementation-defined and may change. | - | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Namespace"` | - | [`BaseType`](BaseType.md).`kind` | +| `models` | `Map`<`string`, [`Model`](Model.md)\> | The models in the namespace.

Order is implementation-defined and may change. | - | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `namespaces` | `Map`<`string`, [`Namespace`](Namespace.md)\> | The sub-namespaces in the namespace.

Order is implementation-defined and may change. | - | +| `node` | [`JsNamespaceDeclarationNode`](JsNamespaceDeclarationNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `operations` | `Map`<`string`, [`Operation`](Operation.md)\> | The operations in the namespace.

Order is implementation-defined and may change. | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `scalars` | `Map`<`string`, [`Scalar`](Scalar.md)\> | The scalars in the namespace.

Order is implementation-defined and may change. | - | +| `unions` | `Map`<`string`, [`Union`](Union.md)\> | The unions in the namespace.

Order is implementation-defined and may change. | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NamespaceNavigationOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NamespaceNavigationOptions.md new file mode 100644 index 0000000000..5634ab26b8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NamespaceNavigationOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] NamespaceNavigationOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `skipSubNamespaces?` | `boolean` | Recursively navigate sub namespaces.

**Default**

` false ` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NamespaceStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NamespaceStatementNode.md new file mode 100644 index 0000000000..cb497e2426 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NamespaceStatementNode.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] NamespaceStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `NamespaceStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `statements?` | [`NamespaceStatementNode`](NamespaceStatementNode.md) \| readonly [`Statement`](../type-aliases/Statement.md)[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NavigationOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NavigationOptions.md new file mode 100644 index 0000000000..f41933be2a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NavigationOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] NavigationOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `includeTemplateDeclaration?` | `boolean` | Skip non instantiated templates. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NeverKeywordNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NeverKeywordNode.md new file mode 100644 index 0000000000..5ce3541c66 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NeverKeywordNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] NeverKeywordNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `NeverKeyword` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NeverType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NeverType.md new file mode 100644 index 0000000000..b385be071a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NeverType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] NeverType" + +--- +## Extends + +- [`IntrinsicType`](IntrinsicType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`IntrinsicType`](IntrinsicType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`IntrinsicType`](IntrinsicType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`IntrinsicType`](IntrinsicType.md).`kind` | +| `name` | `"never"` | - | [`IntrinsicType`](IntrinsicType.md).`name` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`IntrinsicType`](IntrinsicType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`IntrinsicType`](IntrinsicType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`IntrinsicType`](IntrinsicType.md).[`projectionsByName`](IntrinsicType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NodePackage.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NodePackage.md new file mode 100644 index 0000000000..155498500a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NodePackage.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] NodePackage" + +--- +Type for package.json https://docs.npmjs.com/cli/v8/configuring-npm/package-json + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `bugs?` | `object` | - | +| `bugs.email?` | `string` | - | +| `bugs.url?` | `string` | - | +| `dependencies?` | `Record`<`string`, `string`\> | - | +| `description?` | `string` | - | +| `devDependencies?` | `Record`<`string`, `string`\> | - | +| `homepage?` | `string` | - | +| `main?` | `string` | - | +| `name` | `string` | - | +| `peerDependencies?` | `Record`<`string`, `string`\> | - | +| `private?` | `boolean` | - | +| `tspMain?` | `string` | - | +| `type?` | `"module"` \| `"commonjs"` | - | +| `version` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NullType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NullType.md new file mode 100644 index 0000000000..38d7324140 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NullType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] NullType" + +--- +## Extends + +- [`IntrinsicType`](IntrinsicType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`IntrinsicType`](IntrinsicType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`IntrinsicType`](IntrinsicType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`IntrinsicType`](IntrinsicType.md).`kind` | +| `name` | `"null"` | - | [`IntrinsicType`](IntrinsicType.md).`name` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`IntrinsicType`](IntrinsicType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`IntrinsicType`](IntrinsicType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`IntrinsicType`](IntrinsicType.md).[`projectionsByName`](IntrinsicType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NumericLiteral.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NumericLiteral.md new file mode 100644 index 0000000000..f992e84843 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NumericLiteral.md @@ -0,0 +1,48 @@ +--- +jsApi: true +title: "[I] NumericLiteral" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Number"` | - | [`BaseType`](BaseType.md).`kind` | +| `node?` | [`NumericLiteralNode`](NumericLiteralNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `value` | `number` | - | - | +| `valueAsString` | `string` | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NumericLiteralNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NumericLiteralNode.md new file mode 100644 index 0000000000..39570e96e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/NumericLiteralNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] NumericLiteralNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `NumericLiteral` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | `number` | - | - | +| `readonly` | `valueAsString` | `string` | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ObjectType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ObjectType.md new file mode 100644 index 0000000000..a3a2d01ea6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ObjectType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] ObjectType" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Object"` | - | [`BaseType`](BaseType.md).`kind` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `properties` | `Record`<`string`, [`Type`](../type-aliases/Type.md)\> | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Operation.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Operation.md new file mode 100644 index 0000000000..d4f41a567a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Operation.md @@ -0,0 +1,56 @@ +--- +jsApi: true +title: "[I] Operation" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md).[`TemplatedTypeBase`](TemplatedTypeBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `interface?` | [`Interface`](Interface.md) | - | - | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Operation"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `node` | [`OperationStatementNode`](OperationStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `parameters` | [`Model`](Model.md) | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `returnType` | [`Type`](../type-aliases/Type.md) | - | - | +| `sourceOperation?` | [`Operation`](Operation.md) | The operation that is referenced via `op is`. | - | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/OperationSignatureDeclarationNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/OperationSignatureDeclarationNode.md new file mode 100644 index 0000000000..9c315a01b3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/OperationSignatureDeclarationNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] OperationSignatureDeclarationNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `OperationSignatureDeclaration` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parameters` | [`ModelExpressionNode`](ModelExpressionNode.md) | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `returnType` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/OperationSignatureReferenceNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/OperationSignatureReferenceNode.md new file mode 100644 index 0000000000..bb74214901 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/OperationSignatureReferenceNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] OperationSignatureReferenceNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `baseOperation` | [`TypeReferenceNode`](TypeReferenceNode.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `OperationSignatureReference` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/OperationStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/OperationStatementNode.md new file mode 100644 index 0000000000..70e71b1070 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/OperationStatementNode.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] OperationStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `OperationStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) \| [`InterfaceStatementNode`](InterfaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `signature` | [`OperationSignature`](../type-aliases/OperationSignature.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ParseOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ParseOptions.md new file mode 100644 index 0000000000..dc69b899be --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ParseOptions.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ParseOptions" + +--- +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `comments?` | `boolean` | When true, collect comment ranges in [TypeSpecScriptNode.comments](TypeSpecScriptNode.md). | +| `readonly` | `docs?` | `boolean` | When true, parse doc comments into [Node.docs](BaseNode.md). | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProcessedLog.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProcessedLog.md new file mode 100644 index 0000000000..4716d55258 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProcessedLog.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] ProcessedLog" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `code?` | `string` | - | +| `level` | [`LogLevel`](../type-aliases/LogLevel.md) | - | +| `message` | `string` | - | +| `sourceLocation?` | [`SourceLocation`](SourceLocation.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Program.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Program.md new file mode 100644 index 0000000000..37521c68a3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Program.md @@ -0,0 +1,200 @@ +--- +jsApi: true +title: "[I] Program" + +--- +## Extended By + +- [`ProjectedProgram`](ProjectedProgram.md) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `public` | `checker` | [`Checker`](Checker.md) | - | +| `public` | `compilerOptions` | [`CompilerOptions`](CompilerOptions.md) | - | +| `readonly` | `diagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | - | +| `public` | `emitters` | `EmitterRef`[] | - | +| `public` | `host` | [`CompilerHost`](CompilerHost.md) | - | +| `public` | `jsSourceFiles` | `Map`<`string`, [`JsSourceFileNode`](JsSourceFileNode.md)\> | - | +| `public` | `literalTypes` | `Map`<`string` \| `number` \| `boolean`, [`LiteralType`](../type-aliases/LiteralType.md)\> | - | +| `public` | `mainFile?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) | - | +| `readonly` | `projectRoot` | `string` | Project root. If a tsconfig was found/specified this is the directory for the tsconfig.json. Otherwise directory where the entrypoint is located. | +| `public` | `sourceFiles` | `Map`<`string`, [`TypeSpecScriptNode`](TypeSpecScriptNode.md)\> | All source files in the program, keyed by their file path. | +| `public` | `stateMaps` | `Map`<`symbol`, `StateMap`\> | - | +| `public` | `stateSets` | `Map`<`symbol`, `StateSet`\> | - | +| `public` | `tracer` | [`Tracer`](Tracer.md) | - | + +## Methods + +### getGlobalNamespaceType() + +```ts +getGlobalNamespaceType(): Namespace +``` + +*** + +### getOption() + +```ts +getOption(key): undefined | string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `string` | + +*** + +### getSourceFileLocationContext() + +```ts +getSourceFileLocationContext(sourceFile): LocationContext +``` + +Return location context of the given source file. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `sourceFile` | [`SourceFile`](SourceFile.md) | + +*** + +### hasError() + +```ts +hasError(): boolean +``` + +*** + +### loadTypeSpecScript() + +```ts +loadTypeSpecScript(typespecScript): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `typespecScript` | [`SourceFile`](SourceFile.md) | + +*** + +### onValidate() + +```ts +onValidate(cb, LibraryMetadata): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `cb` | (`program`) => `void` \| `Promise`<`void`\> | +| `LibraryMetadata` | [`LibraryMetadata`](../type-aliases/LibraryMetadata.md) | + +*** + +### reportDiagnostic() + +```ts +reportDiagnostic(diagnostic): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostic` | [`Diagnostic`](Diagnostic.md) | + +*** + +### reportDiagnostics() + +```ts +reportDiagnostics(diagnostics): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | + +*** + +### reportDuplicateSymbols() + +```ts +reportDuplicateSymbols(symbols): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `symbols` | `undefined` \| `SymbolTable` | + +*** + +### resolveTypeReference() + +```ts +resolveTypeReference(reference): [undefined | Type, readonly Diagnostic[]] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `reference` | `string` | + +*** + +### stateMap() + +```ts +stateMap(key): Map +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `symbol` | + +*** + +### stateSet() + +```ts +stateSet(key): Set +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `symbol` | + +*** + +### trace() + +```ts +trace(area, message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `area` | `string` | +| `message` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectLocationContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectLocationContext.md new file mode 100644 index 0000000000..4ab05797d3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectLocationContext.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] ProjectLocationContext" + +--- +Defined in the user project. + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `type` | `"project"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectedNameView.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectedNameView.md new file mode 100644 index 0000000000..57becaa013 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectedNameView.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[I] ProjectedNameView" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `program` | [`ProjectedProgram`](ProjectedProgram.md) | - | + +## Methods + +### getProjectedName() + +```ts +getProjectedName(target): string +``` + +Get the name of the given entity in that scope. +If there is a projected name it returns that one otherwise return the original name. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | `Object` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectedProgram.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectedProgram.md new file mode 100644 index 0000000000..84f3d1db8f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectedProgram.md @@ -0,0 +1,253 @@ +--- +jsApi: true +title: "[I] ProjectedProgram" + +--- +## Extends + +- [`Program`](Program.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `public` | `checker` | [`Checker`](Checker.md) | - | [`Program`](Program.md).`checker` | +| `public` | `compilerOptions` | [`CompilerOptions`](CompilerOptions.md) | - | [`Program`](Program.md).`compilerOptions` | +| `readonly` | `diagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | - | [`Program`](Program.md).`diagnostics` | +| `public` | `emitters` | `EmitterRef`[] | - | [`Program`](Program.md).`emitters` | +| `public` | `host` | [`CompilerHost`](CompilerHost.md) | - | [`Program`](Program.md).`host` | +| `public` | `jsSourceFiles` | `Map`<`string`, [`JsSourceFileNode`](JsSourceFileNode.md)\> | - | [`Program`](Program.md).`jsSourceFiles` | +| `public` | `literalTypes` | `Map`<`string` \| `number` \| `boolean`, [`LiteralType`](../type-aliases/LiteralType.md)\> | - | [`Program`](Program.md).`literalTypes` | +| `public` | `mainFile?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) | - | [`Program`](Program.md).`mainFile` | +| `readonly` | `projectRoot` | `string` | Project root. If a tsconfig was found/specified this is the directory for the tsconfig.json. Otherwise directory where the entrypoint is located. | [`Program`](Program.md).`projectRoot` | +| `public` | `projector` | [`Projector`](Projector.md) | - | - | +| `public` | `sourceFiles` | `Map`<`string`, [`TypeSpecScriptNode`](TypeSpecScriptNode.md)\> | All source files in the program, keyed by their file path. | [`Program`](Program.md).`sourceFiles` | +| `public` | `stateMaps` | `Map`<`symbol`, `StateMap`\> | - | [`Program`](Program.md).`stateMaps` | +| `public` | `stateSets` | `Map`<`symbol`, `StateSet`\> | - | [`Program`](Program.md).`stateSets` | +| `public` | `tracer` | [`Tracer`](Tracer.md) | - | [`Program`](Program.md).`tracer` | + +## Methods + +### getGlobalNamespaceType() + +```ts +getGlobalNamespaceType(): Namespace +``` + +#### Inherited from + +[`Program`](Program.md).[`getGlobalNamespaceType`](Program.md#getglobalnamespacetype) + +*** + +### getOption() + +```ts +getOption(key): undefined | string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `string` | + +#### Inherited from + +[`Program`](Program.md).[`getOption`](Program.md#getoption) + +*** + +### getSourceFileLocationContext() + +```ts +getSourceFileLocationContext(sourceFile): LocationContext +``` + +Return location context of the given source file. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `sourceFile` | [`SourceFile`](SourceFile.md) | + +#### Inherited from + +[`Program`](Program.md).[`getSourceFileLocationContext`](Program.md#getsourcefilelocationcontext) + +*** + +### hasError() + +```ts +hasError(): boolean +``` + +#### Inherited from + +[`Program`](Program.md).[`hasError`](Program.md#haserror) + +*** + +### loadTypeSpecScript() + +```ts +loadTypeSpecScript(typespecScript): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `typespecScript` | [`SourceFile`](SourceFile.md) | + +#### Inherited from + +[`Program`](Program.md).[`loadTypeSpecScript`](Program.md#loadtypespecscript) + +*** + +### onValidate() + +```ts +onValidate(cb, LibraryMetadata): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `cb` | (`program`) => `void` \| `Promise`<`void`\> | +| `LibraryMetadata` | [`LibraryMetadata`](../type-aliases/LibraryMetadata.md) | + +#### Inherited from + +[`Program`](Program.md).[`onValidate`](Program.md#onvalidate) + +*** + +### reportDiagnostic() + +```ts +reportDiagnostic(diagnostic): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostic` | [`Diagnostic`](Diagnostic.md) | + +#### Inherited from + +[`Program`](Program.md).[`reportDiagnostic`](Program.md#reportdiagnostic) + +*** + +### reportDiagnostics() + +```ts +reportDiagnostics(diagnostics): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | + +#### Inherited from + +[`Program`](Program.md).[`reportDiagnostics`](Program.md#reportdiagnostics) + +*** + +### reportDuplicateSymbols() + +```ts +reportDuplicateSymbols(symbols): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `symbols` | `undefined` \| `SymbolTable` | + +#### Inherited from + +[`Program`](Program.md).[`reportDuplicateSymbols`](Program.md#reportduplicatesymbols) + +*** + +### resolveTypeReference() + +```ts +resolveTypeReference(reference): [undefined | Type, readonly Diagnostic[]] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `reference` | `string` | + +#### Inherited from + +[`Program`](Program.md).[`resolveTypeReference`](Program.md#resolvetypereference) + +*** + +### stateMap() + +```ts +stateMap(key): Map +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `symbol` | + +#### Inherited from + +[`Program`](Program.md).[`stateMap`](Program.md#statemap) + +*** + +### stateSet() + +```ts +stateSet(key): Set +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `symbol` | + +#### Inherited from + +[`Program`](Program.md).[`stateSet`](Program.md#stateset) + +*** + +### trace() + +```ts +trace(area, message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `area` | `string` | +| `message` | `string` | + +#### Inherited from + +[`Program`](Program.md).[`trace`](Program.md#trace) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Projection.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Projection.md new file mode 100644 index 0000000000..70137039a5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Projection.md @@ -0,0 +1,48 @@ +--- +jsApi: true +title: "[I] Projection" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Projection"` | - | [`BaseType`](BaseType.md).`kind` | +| `node` | `undefined` | - | [`BaseType`](BaseType.md).`node` | +| `nodeByKind` | `Map`<`string`, [`ProjectionStatementNode`](ProjectionStatementNode.md)\> | - | - | +| `nodeByType` | `Map`<[`Type`](../type-aliases/Type.md), [`ProjectionStatementNode`](ProjectionStatementNode.md)\> | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionApplication.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionApplication.md new file mode 100644 index 0000000000..d7f7018e6a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionApplication.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] ProjectionApplication" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `arguments` | [`DecoratorArgumentValue`](../type-aliases/DecoratorArgumentValue.md)[] | - | +| `direction?` | `"to"` \| `"from"` | - | +| `projectionName` | `string` | - | +| `scope?` | [`Type`](../type-aliases/Type.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionArithmeticExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionArithmeticExpressionNode.md new file mode 100644 index 0000000000..dbabf3f1f6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionArithmeticExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionArithmeticExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionArithmeticExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `left` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `op` | `"+"` \| `"-"` \| `"*"` \| `"/"` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `right` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionBlockExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionBlockExpressionNode.md new file mode 100644 index 0000000000..3cd344a2d3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionBlockExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionBlockExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionBlockExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `statements` | [`ProjectionExpressionStatementNode`](ProjectionExpressionStatementNode.md)[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionCallExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionCallExpressionNode.md new file mode 100644 index 0000000000..07e1dd56d6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionCallExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionCallExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md)[] | - | - | +| `readonly` | `callKind` | `"method"` \| `"template"` | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionCallExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionDecoratorReferenceExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionDecoratorReferenceExpressionNode.md new file mode 100644 index 0000000000..ecbf88c818 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionDecoratorReferenceExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionDecoratorReferenceExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionDecoratorReferenceExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionEnumMemberSelectorNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionEnumMemberSelectorNode.md new file mode 100644 index 0000000000..77b794d67d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionEnumMemberSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionEnumMemberSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionEnumMemberSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionEnumSelectorNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionEnumSelectorNode.md new file mode 100644 index 0000000000..fd423cd7a0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionEnumSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionEnumSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionEnumSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionEqualityExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionEqualityExpressionNode.md new file mode 100644 index 0000000000..ffab6af2ec --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionEqualityExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionEqualityExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionEqualityExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `left` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `op` | `"=="` \| `"!="` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `right` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionExpressionStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionExpressionStatementNode.md new file mode 100644 index 0000000000..48ceddd074 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionExpressionStatementNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionExpressionStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `expr` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionExpressionStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionIfExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionIfExpressionNode.md new file mode 100644 index 0000000000..5709c2bd7a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionIfExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionIfExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `alternate?` | [`ProjectionIfExpressionNode`](ProjectionIfExpressionNode.md) \| [`ProjectionBlockExpressionNode`](ProjectionBlockExpressionNode.md) | - | - | +| `readonly` | `consequent` | [`ProjectionBlockExpressionNode`](ProjectionBlockExpressionNode.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionIfExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `test` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionInterfaceSelectorNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionInterfaceSelectorNode.md new file mode 100644 index 0000000000..6d4ba90aa4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionInterfaceSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionInterfaceSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionInterfaceSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionLambdaExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionLambdaExpressionNode.md new file mode 100644 index 0000000000..ec3f666c25 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionLambdaExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionLambdaExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `body` | [`ProjectionBlockExpressionNode`](ProjectionBlockExpressionNode.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionLambdaExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | - | +| `readonly` | `parameters` | readonly [`ProjectionLambdaParameterDeclarationNode`](ProjectionLambdaParameterDeclarationNode.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionLambdaParameterDeclarationNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionLambdaParameterDeclarationNode.md new file mode 100644 index 0000000000..dfd6838af1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionLambdaParameterDeclarationNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionLambdaParameterDeclarationNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `ProjectionLambdaParameterDeclaration` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionLogicalExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionLogicalExpressionNode.md new file mode 100644 index 0000000000..1d6769f693 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionLogicalExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionLogicalExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionLogicalExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `left` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `op` | `"||"` \| `"&&"` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `right` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionMemberExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionMemberExpressionNode.md new file mode 100644 index 0000000000..d2470b7bd6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionMemberExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionMemberExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `base` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `ProjectionMemberExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `selector` | `"."` \| `"::"` | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelExpressionNode.md new file mode 100644 index 0000000000..12953310a6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionModelExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionModelExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `properties` | ([`ProjectionModelPropertyNode`](ProjectionModelPropertyNode.md) \| [`ProjectionModelSpreadPropertyNode`](ProjectionModelSpreadPropertyNode.md))[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelPropertyNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelPropertyNode.md new file mode 100644 index 0000000000..662c717103 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelPropertyNode.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] ProjectionModelPropertyNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `default?` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `ProjectionModelProperty` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `optional` | `boolean` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelPropertySelectorNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelPropertySelectorNode.md new file mode 100644 index 0000000000..17da083af1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelPropertySelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionModelPropertySelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionModelPropertySelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelSelectorNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelSelectorNode.md new file mode 100644 index 0000000000..82f3d98218 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionModelSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionModelSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelSpreadPropertyNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelSpreadPropertyNode.md new file mode 100644 index 0000000000..3cde0520c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionModelSpreadPropertyNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionModelSpreadPropertyNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionModelSpreadProperty` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionNode.md new file mode 100644 index 0000000000..7a5f624c20 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionNode.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[I] ProjectionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `body` | readonly [`ProjectionExpressionStatementNode`](ProjectionExpressionStatementNode.md)[] | - | - | +| `readonly` | `direction` | \| `"to"` \| `"from"` \| `"pre_to"` \| `"pre_from"` \| `""` | - | - | +| `readonly` | `directionId` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `Projection` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | - | +| `readonly` | `modifierIds` | readonly [`IdentifierNode`](IdentifierNode.md)[] | - | - | +| `readonly` | `parameters` | [`ProjectionParameterDeclarationNode`](ProjectionParameterDeclarationNode.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionOperationSelectorNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionOperationSelectorNode.md new file mode 100644 index 0000000000..188a022208 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionOperationSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionOperationSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionOperationSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionParameterDeclarationNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionParameterDeclarationNode.md new file mode 100644 index 0000000000..28340cac97 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionParameterDeclarationNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionParameterDeclarationNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `ProjectionParameterDeclaration` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionReferenceNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionReferenceNode.md new file mode 100644 index 0000000000..c85e901603 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionReferenceNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] ProjectionReferenceNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionReference` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionRelationalExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionRelationalExpressionNode.md new file mode 100644 index 0000000000..d79122b315 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionRelationalExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionRelationalExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionRelationalExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `left` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `op` | `"<="` \| `">="` \| `"<"` \| `">"` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `right` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionStatementNode.md new file mode 100644 index 0000000000..d7fa6316aa --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionStatementNode.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[I] ProjectionStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `from?` | [`ProjectionNode`](ProjectionNode.md) | - | - | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `ProjectionStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `preFrom?` | [`ProjectionNode`](ProjectionNode.md) | - | - | +| `readonly` | `preTo?` | [`ProjectionNode`](ProjectionNode.md) | - | - | +| `readonly` | `projections` | readonly [`ProjectionNode`](ProjectionNode.md)[] | - | - | +| `readonly` | `selector` | \| [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) \| [`ProjectionModelSelectorNode`](ProjectionModelSelectorNode.md) \| [`ProjectionModelPropertySelectorNode`](ProjectionModelPropertySelectorNode.md) \| [`ProjectionInterfaceSelectorNode`](ProjectionInterfaceSelectorNode.md) \| [`ProjectionOperationSelectorNode`](ProjectionOperationSelectorNode.md) \| [`ProjectionEnumSelectorNode`](ProjectionEnumSelectorNode.md) \| [`ProjectionEnumMemberSelectorNode`](ProjectionEnumMemberSelectorNode.md) \| [`ProjectionUnionSelectorNode`](ProjectionUnionSelectorNode.md) \| [`ProjectionUnionVariantSelectorNode`](ProjectionUnionVariantSelectorNode.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `to?` | [`ProjectionNode`](ProjectionNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionTupleExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionTupleExpressionNode.md new file mode 100644 index 0000000000..872452c7bc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionTupleExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionTupleExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionTupleExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `values` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md)[] | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionUnaryExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionUnaryExpressionNode.md new file mode 100644 index 0000000000..958f09466e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionUnaryExpressionNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] ProjectionUnaryExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionUnaryExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `op` | `"!"` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionUnionSelectorNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionUnionSelectorNode.md new file mode 100644 index 0000000000..b3abf4cc23 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionUnionSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionUnionSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionUnionSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionUnionVariantSelectorNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionUnionVariantSelectorNode.md new file mode 100644 index 0000000000..5f05eecedc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ProjectionUnionVariantSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionUnionVariantSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionUnionVariantSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Projector.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Projector.md new file mode 100644 index 0000000000..d4e048c656 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Projector.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[I] Projector" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `parentProjector?` | [`Projector`](Projector.md) | - | +| `projectedGlobalNamespace?` | [`Namespace`](Namespace.md) | - | +| `projectedStartNode?` | [`Type`](../type-aliases/Type.md) | - | +| `projectedTypes` | `Map`<[`Type`](../type-aliases/Type.md), [`Type`](../type-aliases/Type.md)\> | - | +| `projections` | [`ProjectionApplication`](ProjectionApplication.md)[] | - | + +## Methods + +### projectType() + +```ts +projectType(type): Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/RecordModelType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/RecordModelType.md new file mode 100644 index 0000000000..293139afb8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/RecordModelType.md @@ -0,0 +1,59 @@ +--- +jsApi: true +title: "[I] RecordModelType" + +--- +## Extends + +- [`Model`](Model.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `baseModel?` | [`Model`](Model.md) | Model this model extends. This represent inheritance. | [`Model`](Model.md).`baseModel` | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`Model`](Model.md).`decorators` | +| `derivedModels` | [`Model`](Model.md)[] | Direct children. This is the reverse relation of [baseModel](ArrayModelType.md) | [`Model`](Model.md).`derivedModels` | +| `indexer` | `object` | - | [`Model`](Model.md).`indexer` | +| `indexer.key` | [`Scalar`](Scalar.md) | - | - | +| `indexer.value` | [`Type`](../type-aliases/Type.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`Model`](Model.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`Model`](Model.md).`isFinished` | +| `kind` | `"Model"` | - | [`Model`](Model.md).`kind` | +| `name` | `string` | - | [`Model`](Model.md).`name` | +| `namespace?` | [`Namespace`](Namespace.md) | - | [`Model`](Model.md).`namespace` | +| `node?` | [`ModelStatementNode`](ModelStatementNode.md) \| [`ModelExpressionNode`](ModelExpressionNode.md) \| [`IntersectionExpressionNode`](IntersectionExpressionNode.md) \| [`ProjectionModelExpressionNode`](ProjectionModelExpressionNode.md) | - | [`Model`](Model.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`Model`](Model.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`Model`](Model.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`Model`](Model.md).`projector` | +| `properties` | `RekeyableMap`<`string`, [`ModelProperty`](ModelProperty.md)\> | The properties of the model.

Properties are ordered in the order that they appear in source.
Properties obtained via `model is` appear before properties defined in
the model body. Properties obtained via `...` are inserted where the
spread appears in source.

Properties inherited via `model extends` are not included. Use
[walkPropertiesInherited](../functions/walkPropertiesInherited.md) to enumerate all properties in the
inheritance hierarchy. | [`Model`](Model.md).`properties` | +| `sourceModel?` | [`Model`](Model.md) | The model that is referenced via `model is`. | [`Model`](Model.md).`sourceModel` | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`Model`](Model.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`Model`](Model.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`Model`](Model.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`Model`](Model.md).[`projectionsByName`](Model.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolveCompilerOptionsOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolveCompilerOptionsOptions.md new file mode 100644 index 0000000000..28cdf7a4c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolveCompilerOptionsOptions.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[I] ResolveCompilerOptionsOptions" + +--- +## Extends + +- `ConfigToOptionsOptions` + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `args?` | `Record`<`string`, `string`\> | Any arguments to interpolate the config. | ConfigToOptionsOptions.args | +| `configPath?` | `string` | Explicit config path. | - | +| `cwd` | `string` | Current working directory. This will be used to interpolate `{cwd}` in the config. | ConfigToOptionsOptions.cwd | +| `entrypoint` | `string` | Absolute entrypoint path | - | +| `env?` | `Record`<`string`, `undefined` \| `string`\> | Environment variables. | ConfigToOptionsOptions.env | +| `overrides?` | `Partial`<`TypeSpecConfig`\> | Compiler options to override the config | ConfigToOptionsOptions.overrides | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolveModuleHost.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolveModuleHost.md new file mode 100644 index 0000000000..078679676d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolveModuleHost.md @@ -0,0 +1,52 @@ +--- +jsApi: true +title: "[I] ResolveModuleHost" + +--- +## Methods + +### readFile() + +```ts +readFile(path): Promise +``` + +Read a utf-8 encoded file. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### realpath() + +```ts +realpath(path): Promise +``` + +Resolve the real path for the current host. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### stat() + +```ts +stat(path): Promise +``` + +Get information about the given path + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolveModuleOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolveModuleOptions.md new file mode 100644 index 0000000000..51aa932045 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolveModuleOptions.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] ResolveModuleOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `baseDir` | `string` | - | +| `directoryIndexFiles?` | `string`[] | When resolution reach a directory without package.json look for those files to load in order.

**Default**

` ["index.mjs", "index.js"] ` | +| `resolveMain?` | (`pkg`) => `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolvedFile.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolvedFile.md new file mode 100644 index 0000000000..371c9095d4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolvedFile.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ResolvedFile" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | - | +| `type` | `"file"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolvedModule.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolvedModule.md new file mode 100644 index 0000000000..15f57df7ad --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ResolvedModule.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] ResolvedModule" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `mainFile` | `string` | Resolved main file for the module. | +| `manifest` | [`NodePackage`](NodePackage.md) | Value of package.json. | +| `path` | `string` | Root of the package. (Same level as package.json) | +| `type` | `"module"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ReturnExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ReturnExpressionNode.md new file mode 100644 index 0000000000..54c1f0736f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ReturnExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ReturnExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `Return` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ReturnRecord.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ReturnRecord.md new file mode 100644 index 0000000000..5b0340c8eb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ReturnRecord.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ReturnRecord" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `kind` | `"Return"` | - | +| `value` | [`Type`](../type-aliases/Type.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/RmOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/RmOptions.md new file mode 100644 index 0000000000..4633ef9b42 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/RmOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] RmOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `recursive?` | `boolean` | If `true`, perform a recursive directory removal. In
recursive mode, errors are not reported if `path` does not exist, and
operations are retried on failure.

**Default**

` false ` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Scalar.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Scalar.md new file mode 100644 index 0000000000..839d509377 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Scalar.md @@ -0,0 +1,54 @@ +--- +jsApi: true +title: "[I] Scalar" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md).[`TemplatedTypeBase`](TemplatedTypeBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `baseScalar?` | [`Scalar`](Scalar.md) | Scalar this scalar extends. | - | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `derivedScalars` | [`Scalar`](Scalar.md)[] | Direct children. This is the reverse relation of

**See**

baseScalar | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Scalar"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | Namespace the scalar was defined in. | - | +| `node` | [`ScalarStatementNode`](ScalarStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ScalarStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ScalarStatementNode.md new file mode 100644 index 0000000000..7e8fa55554 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ScalarStatementNode.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] ScalarStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `extends?` | [`TypeReferenceNode`](TypeReferenceNode.md) | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `ScalarStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Scanner.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Scanner.md new file mode 100644 index 0000000000..d3cd27e70a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Scanner.md @@ -0,0 +1,91 @@ +--- +jsApi: true +title: "[I] Scanner" + +--- +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `file` | [`SourceFile`](SourceFile.md) | The source code being scanned. | +| `readonly` | `position` | `number` | The offset in UTF-16 code units to the current position at the start of the next token. | +| `readonly` | `token` | [`Token`](../enumerations/Token.md) | The current token | +| `readonly` | `tokenFlags` | [`TokenFlags`](../enumerations/TokenFlags.md) | The flags on the current token. | +| `readonly` | `tokenPosition` | `number` | The offset in UTF-16 code units to the start of the current token. | + +## Methods + +### eof() + +```ts +eof(): boolean +``` + +Determine if the scanner has reached the end of the input. + +*** + +### getTokenText() + +```ts +getTokenText(): string +``` + +The exact spelling of the current token. + +*** + +### getTokenValue() + +```ts +getTokenValue(): string +``` + +The value of the current token. + +String literals are escaped and unquoted, identifiers are normalized, +and all other tokens return their exact spelling sames as +getTokenText(). + +*** + +### scan() + +```ts +scan(): Token +``` + +Advance one token. + +*** + +### scanDoc() + +```ts +scanDoc(): DocToken +``` + +Advance one token inside DocComment. Use inside [scanRange](Scanner.md#scanrange) callback over DocComment range. + +*** + +### scanRange() + +```ts +scanRange(range, callback): T +``` + +Reset the scanner to the given start and end positions, invoke the callback, and then restore scanner state. + +#### Type parameters + +| Parameter | +| :------ | +| `T` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `range` | [`TextRange`](TextRange.md) | +| `callback` | () => `T` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SemanticToken.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SemanticToken.md new file mode 100644 index 0000000000..e49a1e1d5f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SemanticToken.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] SemanticToken" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `end` | `number` | - | +| `kind` | [`SemanticTokenKind`](../enumerations/SemanticTokenKind.md) | - | +| `pos` | `number` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Server.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Server.md new file mode 100644 index 0000000000..1c732148fb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Server.md @@ -0,0 +1,306 @@ +--- +jsApi: true +title: "[I] Server" + +--- +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `pendingMessages` | readonly `string`[] | - | +| `readonly` | `workspaceFolders` | readonly [`ServerWorkspaceFolder`](ServerWorkspaceFolder.md)[] | - | + +## Methods + +### buildSemanticTokens() + +```ts +buildSemanticTokens(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `SemanticTokensParams` | + +*** + +### checkChange() + +```ts +checkChange(change): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `change` | `TextDocumentChangeEvent`<`TextDocument`\> | + +*** + +### compile() + +```ts +compile(document): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `document` | `TextDocument` \| `TextDocumentIdentifier` | + +*** + +### complete() + +```ts +complete(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `CompletionParams` | + +*** + +### documentClosed() + +```ts +documentClosed(change): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `change` | `TextDocumentChangeEvent`<`TextDocument`\> | + +*** + +### findDocumentHighlight() + +```ts +findDocumentHighlight(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `DocumentHighlightParams` | + +*** + +### findReferences() + +```ts +findReferences(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `ReferenceParams` | + +*** + +### formatDocument() + +```ts +formatDocument(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `DocumentFormattingParams` | + +*** + +### getDocumentSymbols() + +```ts +getDocumentSymbols(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `DocumentSymbolParams` | + +*** + +### getFoldingRanges() + +```ts +getFoldingRanges(getFoldingRanges): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `getFoldingRanges` | `FoldingRangeParams` | + +*** + +### getHover() + +```ts +getHover(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `HoverParams` | + +*** + +### getSemanticTokens() + +```ts +getSemanticTokens(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `SemanticTokensParams` | + +*** + +### getSignatureHelp() + +```ts +getSignatureHelp(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `SignatureHelpParams` | + +*** + +### gotoDefinition() + +```ts +gotoDefinition(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `DefinitionParams` | + +*** + +### initialize() + +```ts +initialize(params): Promise> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `InitializeParams` | + +*** + +### initialized() + +```ts +initialized(params): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `InitializedParams` | + +*** + +### log() + +```ts +log(message, details?): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | +| `details`? | `any` | + +*** + +### prepareRename() + +```ts +prepareRename(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `PrepareRenameParams` | + +*** + +### rename() + +```ts +rename(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `RenameParams` | + +*** + +### watchedFilesChanged() + +```ts +watchedFilesChanged(params): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `DidChangeWatchedFilesParams` | + +*** + +### workspaceFoldersChanged() + +```ts +workspaceFoldersChanged(e): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `e` | `WorkspaceFoldersChangeEvent` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServerHost.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServerHost.md new file mode 100644 index 0000000000..b912a5e8e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServerHost.md @@ -0,0 +1,53 @@ +--- +jsApi: true +title: "[I] ServerHost" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `compilerHost` | [`CompilerHost`](CompilerHost.md) | - | +| `throwInternalErrors?` | `boolean` | - | + +## Methods + +### getOpenDocumentByURL() + +```ts +getOpenDocumentByURL(url): undefined | TextDocument +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `url` | `string` | + +*** + +### log() + +```ts +log(message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | + +*** + +### sendDiagnostics() + +```ts +sendDiagnostics(params): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `PublishDiagnosticsParams` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServerSourceFile.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServerSourceFile.md new file mode 100644 index 0000000000..f50a90d0ce --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServerSourceFile.md @@ -0,0 +1,53 @@ +--- +jsApi: true +title: "[I] ServerSourceFile" + +--- +## Extends + +- [`SourceFile`](SourceFile.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `document?` | `TextDocument` | - | - | +| `readonly` | `path` | `string` | The source file path.

This is used only for diagnostics. The command line compiler will populate
it with the actual path from which the file was read, but it can actually
be an arbitrary name for other scenarios. | [`SourceFile`](SourceFile.md).`path` | +| `readonly` | `text` | `string` | The source code text. | [`SourceFile`](SourceFile.md).`text` | + +## Methods + +### getLineAndCharacterOfPosition() + +```ts +getLineAndCharacterOfPosition(position): LineAndCharacter +``` + +Converts a one-dimensional position in the document (measured in UTF-16 +code units) to line number and offset from line start. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `position` | `number` | + +#### Inherited from + +[`SourceFile`](SourceFile.md).[`getLineAndCharacterOfPosition`](SourceFile.md#getlineandcharacterofposition) + +*** + +### getLineStarts() + +```ts +getLineStarts(): readonly number[] +``` + +Array of positions in the text where each line begins. There is one entry +per line, in order of lines, and each entry represents the offset in UTF-16 +code units from the start of the document to the beginning of the line. + +#### Inherited from + +[`SourceFile`](SourceFile.md).[`getLineStarts`](SourceFile.md#getlinestarts) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServerWorkspaceFolder.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServerWorkspaceFolder.md new file mode 100644 index 0000000000..982da160b0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServerWorkspaceFolder.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[I] ServerWorkspaceFolder" + +--- +## Extends + +- `WorkspaceFolder` + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `name` | `string` | The name of the workspace folder. Used to refer to this
workspace folder in the user interface. | WorkspaceFolder.name | +| `path` | `string` | - | - | +| `uri` | `string` | The associated URI for this workspace folder. | WorkspaceFolder.uri | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Service.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Service.md new file mode 100644 index 0000000000..c5895d499e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Service.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[I] Service" + +--- +## Extends + +- [`ServiceDetails`](ServiceDetails.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `title?` | `string` | - | [`ServiceDetails`](ServiceDetails.md).`title` | +| `type` | [`Namespace`](Namespace.md) | - | - | +| `version?` | `string` | - | [`ServiceDetails`](ServiceDetails.md).`version` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServiceDetails.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServiceDetails.md new file mode 100644 index 0000000000..c6af2118ae --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ServiceDetails.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] ServiceDetails" + +--- +## Extended By + +- [`Service`](Service.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `title?` | `string` | - | +| `version?` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SourceFile.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SourceFile.md new file mode 100644 index 0000000000..96ecc3a7de --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SourceFile.md @@ -0,0 +1,44 @@ +--- +jsApi: true +title: "[I] SourceFile" + +--- +## Extended By + +- [`ServerSourceFile`](ServerSourceFile.md) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `path` | `string` | The source file path.

This is used only for diagnostics. The command line compiler will populate
it with the actual path from which the file was read, but it can actually
be an arbitrary name for other scenarios. | +| `readonly` | `text` | `string` | The source code text. | + +## Methods + +### getLineAndCharacterOfPosition() + +```ts +getLineAndCharacterOfPosition(position): LineAndCharacter +``` + +Converts a one-dimensional position in the document (measured in UTF-16 +code units) to line number and offset from line start. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `position` | `number` | + +*** + +### getLineStarts() + +```ts +getLineStarts(): readonly number[] +``` + +Array of positions in the text where each line begins. There is one entry +per line, in order of lines, and each entry represents the offset in UTF-16 +code units from the start of the document to the beginning of the line. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SourceLocation.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SourceLocation.md new file mode 100644 index 0000000000..f017413ccf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SourceLocation.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[I] SourceLocation" + +--- +## Extends + +- [`TextRange`](TextRange.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`TextRange`](TextRange.md).`end` | +| `public` | `file` | [`SourceFile`](SourceFile.md) | - | - | +| `public` | `isSynthetic?` | `boolean` | - | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`TextRange`](TextRange.md).`pos` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SourceLocationOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SourceLocationOptions.md new file mode 100644 index 0000000000..3cd8d892df --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SourceLocationOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] SourceLocationOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `locateId?` | `boolean` | If trying to resolve the location of a type with an ID, show the location of the ID node instead of the entire type.
This makes sure that the location range is not too large and hard to read. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/StringLiteral.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/StringLiteral.md new file mode 100644 index 0000000000..78db796f29 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/StringLiteral.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] StringLiteral" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"String"` | - | [`BaseType`](BaseType.md).`kind` | +| `node?` | [`StringLiteralNode`](StringLiteralNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `value` | `string` | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/StringLiteralNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/StringLiteralNode.md new file mode 100644 index 0000000000..90140a9794 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/StringLiteralNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] StringLiteralNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `StringLiteral` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | `string` | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SuppressDirective.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SuppressDirective.md new file mode 100644 index 0000000000..b578a32134 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SuppressDirective.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[I] SuppressDirective" + +--- +## Extends + +- [`DirectiveBase`](DirectiveBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `code` | `string` | - | - | +| `message` | `string` | - | - | +| `name` | `"suppress"` | - | - | +| `node` | [`DirectiveExpressionNode`](DirectiveExpressionNode.md) | - | [`DirectiveBase`](DirectiveBase.md).`node` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Sym.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Sym.md new file mode 100644 index 0000000000..06e634f494 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Sym.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[I] Sym" + +--- +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `declarations` | readonly [`Node`](../type-aliases/Node.md)[] | Nodes which contribute to this declaration | +| `readonly` | `exports?` | `SymbolTable` | Externally visible symbols contained inside this symbol. E.g. all declarations
in a namespace, or members of an enum. | +| `readonly` | `flags` | [`SymbolFlags`](../enumerations/SymbolFlags.md) | - | +| `readonly` | `id?` | `number` | A unique identifier for this symbol. Used to look up the symbol links. | +| `readonly` | `members?` | `SymbolTable` | Symbols for members of this symbol which must be referenced off the parent symbol
and cannot be referenced by other means (i.e. by unqualified lookup of the symbol
name). | +| `readonly` | `metatypeMembers?` | `SymbolTable` | Symbol table | +| `readonly` | `name` | `string` | The name of the symbol | +| `readonly` | `parent?` | [`Sym`](Sym.md) | The symbol containing this symbol, if any. E.g. for things declared in
a namespace, this refers to the namespace. | +| `readonly` | `symbolSource?` | [`Sym`](Sym.md) | For using symbols, this is the used symbol. | +| `readonly` | `type?` | [`Type`](../type-aliases/Type.md) | For late-bound symbols, this is the type referenced by the symbol. | +| `readonly` | `value?` | (...`args`) => `any` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SymbolLinks.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SymbolLinks.md new file mode 100644 index 0000000000..e36931875f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SymbolLinks.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] SymbolLinks" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `declaredType?` | [`Type`](../type-aliases/Type.md) | - | +| `instantiations?` | [`TypeInstantiationMap`](TypeInstantiationMap.md) | - | +| `type?` | [`Type`](../type-aliases/Type.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SyntheticLocationContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SyntheticLocationContext.md new file mode 100644 index 0000000000..a45cd6cad5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/SyntheticLocationContext.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] SyntheticLocationContext" + +--- +Refer to a type that was not declared in a file + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `type` | `"synthetic"` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplateDeclarationNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplateDeclarationNode.md new file mode 100644 index 0000000000..8167575c7c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplateDeclarationNode.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[I] TemplateDeclarationNode" + +--- +## Extended By + +- [`OperationStatementNode`](OperationStatementNode.md) +- [`ModelStatementNode`](ModelStatementNode.md) +- [`ScalarStatementNode`](ScalarStatementNode.md) +- [`InterfaceStatementNode`](InterfaceStatementNode.md) +- [`UnionStatementNode`](UnionStatementNode.md) +- [`AliasStatementNode`](AliasStatementNode.md) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `locals?` | `SymbolTable` | - | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplateParameter.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplateParameter.md new file mode 100644 index 0000000000..c9b333f356 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplateParameter.md @@ -0,0 +1,48 @@ +--- +jsApi: true +title: "[I] TemplateParameter" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `constraint?` | [`Type`](../type-aliases/Type.md) \| [`ValueType`](ValueType.md) | - | - | +| `default?` | [`Type`](../type-aliases/Type.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"TemplateParameter"` | - | [`BaseType`](BaseType.md).`kind` | +| `node` | [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplateParameterDeclarationNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplateParameterDeclarationNode.md new file mode 100644 index 0000000000..2ac7bb59d3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplateParameterDeclarationNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] TemplateParameterDeclarationNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `constraint?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `default?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `TemplateParameterDeclaration` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`TemplateableNode`](../type-aliases/TemplateableNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplatedTypeBase.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplatedTypeBase.md new file mode 100644 index 0000000000..987e48f7a6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TemplatedTypeBase.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[I] TemplatedTypeBase" + +--- +## Extended By + +- [`Model`](Model.md) +- [`Scalar`](Scalar.md) +- [`Interface`](Interface.md) +- [`Operation`](Operation.md) +- [`Union`](Union.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TextRange.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TextRange.md new file mode 100644 index 0000000000..cabae13e55 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TextRange.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[I] TextRange" + +--- +## Extended By + +- [`BaseNode`](BaseNode.md) +- [`LineComment`](LineComment.md) +- [`BlockComment`](BlockComment.md) +- [`SourceLocation`](SourceLocation.md) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Tracer.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Tracer.md new file mode 100644 index 0000000000..3a3f9861be --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Tracer.md @@ -0,0 +1,39 @@ +--- +jsApi: true +title: "[I] Tracer" + +--- +## Methods + +### sub() + +```ts +sub(subarea): Tracer +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `subarea` | `string` | + +*** + +### trace() + +```ts +trace( + area, + message, + target?): void +``` + +Trace + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `area` | `string` | | +| `message` | `string` | | +| `target`? | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TracerOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TracerOptions.md new file mode 100644 index 0000000000..145b6400fb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TracerOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] TracerOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `filter?` | `string`[] | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Tuple.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Tuple.md new file mode 100644 index 0000000000..2fceb725ba --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Tuple.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] Tuple" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Tuple"` | - | [`BaseType`](BaseType.md).`kind` | +| `node` | [`TupleExpressionNode`](TupleExpressionNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `values` | [`Type`](../type-aliases/Type.md)[] | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TupleExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TupleExpressionNode.md new file mode 100644 index 0000000000..3a0251e246 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TupleExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] TupleExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `TupleExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `values` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeInstantiationMap.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeInstantiationMap.md new file mode 100644 index 0000000000..23d9ed98f8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeInstantiationMap.md @@ -0,0 +1,35 @@ +--- +jsApi: true +title: "[I] TypeInstantiationMap" + +--- +Maps type arguments to instantiated type. + +## Methods + +### get() + +```ts +get(args): undefined | Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `args` | readonly [`Type`](../type-aliases/Type.md)[] | + +*** + +### set() + +```ts +set(args, type): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `args` | readonly [`Type`](../type-aliases/Type.md)[] | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeMapper.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeMapper.md new file mode 100644 index 0000000000..974a74ff32 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeMapper.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] TypeMapper" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `args` | readonly [`Type`](../type-aliases/Type.md)[] | - | +| `partial` | `boolean` | - | + +## Methods + +### getMappedType() + +```ts +getMappedType(type): Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`TemplateParameter`](TemplateParameter.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeNameOptions.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeNameOptions.md new file mode 100644 index 0000000000..8b4ff0574e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeNameOptions.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] TypeNameOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `namespaceFilter?` | (`ns`) => `boolean` | - | +| `printable?` | `boolean` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeReferenceNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeReferenceNode.md new file mode 100644 index 0000000000..85a89e6b07 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeReferenceNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] TypeReferenceNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `TypeReference` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecCompletionItem.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecCompletionItem.md new file mode 100644 index 0000000000..ac1c10531e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecCompletionItem.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] TypeSpecCompletionItem" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `label?` | `string` | Optional label if different from the text to complete. | +| `sym` | [`Sym`](Sym.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecLibrary.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecLibrary.md new file mode 100644 index 0000000000..13585f50c4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecLibrary.md @@ -0,0 +1,105 @@ +--- +jsApi: true +title: "[I] TypeSpecLibrary" + +--- +Definition of a TypeSpec library + +## Extends + +- [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md)<`T`, `E`\> + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `E` extends `Record`<`string`, `any`\> | `Record`<`string`, `never`\> | + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `diagnostics` | [`DiagnosticMap`](../type-aliases/DiagnosticMap.md)<`T`\> | Map of potential diagnostics that can be emitted in this library where the key is the diagnostic code. | [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md).`diagnostics` | +| `readonly` | `emitter?` | `object` | Emitter configuration if library is an emitter. | [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md).`emitter` | +| `readonly` | `emitter.options?` | [`JSONSchemaType`](../type-aliases/JSONSchemaType.md)<`E`\> | - | - | +| `readonly` | `emitterOptionValidator?` | [`JSONSchemaValidator`](JSONSchemaValidator.md) | JSON Schema validator for emitter options | - | +| `readonly` | `linter?` | [`LinterDefinition`](LinterDefinition.md) | Configuration if library is providing linting rules/rulesets. | [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md).`linter` | +| `readonly` | `name` | `string` | Name of the library. Must match the package.json name. | [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md).`name` | +| `public` | `requireImports?` | readonly `string`[] | List of other library that should be imported when this is used as an emitter.
Compiler will emit an error if the libraries are not explicitly imported. | [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md).`requireImports` | + +## Methods + +### createDiagnostic() + +```ts +createDiagnostic(diag): Diagnostic +``` + +#### Type parameters + +| Parameter | +| :------ | +| `C` extends `string` \| `number` \| `symbol` | +| `M` extends `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diag` | [`DiagnosticReport`](../type-aliases/DiagnosticReport.md)<`T`, `C`, `M`\> | + +*** + +### createStateSymbol() + +```ts +createStateSymbol(name): symbol +``` + +Get or create a symbol with the given name unique for that library. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | Symbol name scoped with the library name. | + +*** + +### getTracer() + +```ts +getTracer(program): Tracer +``` + +Returns a tracer scopped to the current library. +All trace area logged via this tracer will be prefixed with the library name. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](Program.md) | + +*** + +### reportDiagnostic() + +```ts +reportDiagnostic(program, diag): void +``` + +#### Type parameters + +| Parameter | +| :------ | +| `C` extends `string` \| `number` \| `symbol` | +| `M` extends `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](Program.md) | +| `diag` | [`DiagnosticReport`](../type-aliases/DiagnosticReport.md)<`T`, `C`, `M`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecLibraryDef.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecLibraryDef.md new file mode 100644 index 0000000000..f7fae3e4e6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecLibraryDef.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[I] TypeSpecLibraryDef" + +--- +Definition of a TypeSpec library + +## Extended By + +- [`TypeSpecLibrary`](TypeSpecLibrary.md) + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `E` extends `Record`<`string`, `any`\> | `Record`<`string`, `never`\> | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `diagnostics` | [`DiagnosticMap`](../type-aliases/DiagnosticMap.md)<`T`\> | Map of potential diagnostics that can be emitted in this library where the key is the diagnostic code. | +| `readonly` | `emitter?` | `object` | Emitter configuration if library is an emitter. | +| `readonly` | `emitter.options?` | [`JSONSchemaType`](../type-aliases/JSONSchemaType.md)<`E`\> | - | +| `readonly` | `linter?` | [`LinterDefinition`](LinterDefinition.md) | Configuration if library is providing linting rules/rulesets. | +| `readonly` | `name` | `string` | Name of the library. Must match the package.json name. | +| `public` | `requireImports?` | readonly `string`[] | List of other library that should be imported when this is used as an emitter.
Compiler will emit an error if the libraries are not explicitly imported. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecManifest.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecManifest.md new file mode 100644 index 0000000000..67130a08b8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecManifest.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] TypeSpecManifest" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `commit` | `string` | Full commit sha. | +| `pr?` | `number` | Number of the pull request, if the build was from a pull request. | +| `version` | `string` | Version of the tsp compiler. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecScriptNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecScriptNode.md new file mode 100644 index 0000000000..b3ac438174 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/TypeSpecScriptNode.md @@ -0,0 +1,32 @@ +--- +jsApi: true +title: "[I] TypeSpecScriptNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `comments` | readonly [`Comment`](../type-aliases/Comment.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `file` | [`SourceFile`](SourceFile.md) | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `inScopeNamespaces` | readonly [`NamespaceStatementNode`](NamespaceStatementNode.md)[] | - | - | +| `readonly` | `kind` | `TypeSpecScript` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals` | `SymbolTable` | - | - | +| `readonly` | `namespaces` | [`NamespaceStatementNode`](NamespaceStatementNode.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `parseDiagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | - | - | +| `readonly` | `parseOptions` | [`ParseOptions`](ParseOptions.md) | - | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `printable` | `boolean` | - | - | +| `readonly` | `statements` | readonly [`Statement`](../type-aliases/Statement.md)[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `usings` | readonly [`UsingStatementNode`](UsingStatementNode.md)[] | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Union.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Union.md new file mode 100644 index 0000000000..1bcadb301d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/Union.md @@ -0,0 +1,55 @@ +--- +jsApi: true +title: "[I] Union" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md).[`TemplatedTypeBase`](TemplatedTypeBase.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `public` | `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `public` | `expression` | `boolean` | - | - | +| `public` | `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `public` | `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `public` | `kind` | `"Union"` | - | [`BaseType`](BaseType.md).`kind` | +| `public` | `name?` | `string` | - | - | +| `public` | `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `public` | `node` | [`UnionStatementNode`](UnionStatementNode.md) \| [`UnionExpressionNode`](UnionExpressionNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `readonly` | `options` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use variants | - | +| `public` | `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `public` | `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `public` | `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `public` | `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateArguments` | +| `public` | `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateMapper` | +| `public` | `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateNode` | +| `public` | `variants` | `RekeyableMap`<`string` \| `symbol`, [`UnionVariant`](UnionVariant.md)\> | The variants of the union.

Variants are ordered in order that they appear in source. | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionExpressionNode.md new file mode 100644 index 0000000000..14c5a5e550 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] UnionExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `UnionExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `options` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionStatementNode.md new file mode 100644 index 0000000000..1220ada39c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionStatementNode.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] UnionStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `UnionStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `options` | readonly [`UnionVariantNode`](UnionVariantNode.md)[] | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionVariant.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionVariant.md new file mode 100644 index 0000000000..94aba8a4f6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionVariant.md @@ -0,0 +1,50 @@ +--- +jsApi: true +title: "[I] UnionVariant" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"UnionVariant"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` \| `symbol` | - | - | +| `node` | `undefined` \| [`UnionVariantNode`](UnionVariantNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `type` | [`Type`](../type-aliases/Type.md) | - | - | +| `union` | [`Union`](Union.md) | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionVariantNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionVariantNode.md new file mode 100644 index 0000000000..e592839947 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnionVariantNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] UnionVariantNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id?` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `UnionVariant` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`UnionStatementNode`](UnionStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | [`Expression`](../type-aliases/Expression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnknownType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnknownType.md new file mode 100644 index 0000000000..3fa09ba62b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UnknownType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] UnknownType" + +--- +## Extends + +- [`IntrinsicType`](IntrinsicType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`IntrinsicType`](IntrinsicType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`IntrinsicType`](IntrinsicType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`IntrinsicType`](IntrinsicType.md).`kind` | +| `name` | `"unknown"` | - | [`IntrinsicType`](IntrinsicType.md).`name` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`IntrinsicType`](IntrinsicType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`IntrinsicType`](IntrinsicType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`IntrinsicType`](IntrinsicType.md).[`projectionsByName`](IntrinsicType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UsageTracker.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UsageTracker.md new file mode 100644 index 0000000000..777ceaa089 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UsageTracker.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] UsageTracker" + +--- +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `types` | readonly [`TrackableType`](../type-aliases/TrackableType.md)[] | - | + +## Methods + +### isUsedAs() + +```ts +isUsedAs(type, usage): boolean +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`TrackableType`](../type-aliases/TrackableType.md) | +| `usage` | [`UsageFlags`](../enumerations/UsageFlags.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UsingStatementNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UsingStatementNode.md new file mode 100644 index 0000000000..644117d12f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/UsingStatementNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] UsingStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `UsingStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `name` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ValueOfExpressionNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ValueOfExpressionNode.md new file mode 100644 index 0000000000..9c4c98a981 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ValueOfExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ValueOfExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ValueOfExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`Expression`](../type-aliases/Expression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ValueType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ValueType.md new file mode 100644 index 0000000000..894a39a776 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/ValueType.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ValueType" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `kind` | `"Value"` | - | +| `target` | [`Type`](../type-aliases/Type.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/VoidKeywordNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/VoidKeywordNode.md new file mode 100644 index 0000000000..6035a0d3b7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/VoidKeywordNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] VoidKeywordNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `VoidKeyword` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/VoidType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/VoidType.md new file mode 100644 index 0000000000..79d22f6062 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/interfaces/VoidType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] VoidType" + +--- +## Extends + +- [`IntrinsicType`](IntrinsicType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`IntrinsicType`](IntrinsicType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`IntrinsicType`](IntrinsicType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`IntrinsicType`](IntrinsicType.md).`kind` | +| `name` | `"void"` | - | [`IntrinsicType`](IntrinsicType.md).`name` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`IntrinsicType`](IntrinsicType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`IntrinsicType`](IntrinsicType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`IntrinsicType`](IntrinsicType.md).[`projectionsByName`](IntrinsicType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/BytesKnownEncoding.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/BytesKnownEncoding.md new file mode 100644 index 0000000000..d0d2a38d47 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/BytesKnownEncoding.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] BytesKnownEncoding" + +--- +```ts +type BytesKnownEncoding: "base64" | "base64url"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlCompletionItem.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlCompletionItem.md new file mode 100644 index 0000000000..3636164b4f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlCompletionItem.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] CadlCompletionItem" + +--- +```ts +type CadlCompletionItem: TypeSpecCompletionItem; +``` + +## Deprecated + +Use TypeSpecCompletionItem diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlLibrary.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlLibrary.md new file mode 100644 index 0000000000..439cb3d7a3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlLibrary.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[T] CadlLibrary" + +--- +```ts +type CadlLibrary: TypeSpecLibrary; +``` + +## Deprecated + +Use TypeSpecLibrary + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `E` extends `Record`<`string`, `any`\> | `Record`<`string`, `never`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlLibraryDef.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlLibraryDef.md new file mode 100644 index 0000000000..0406e7a139 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlLibraryDef.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[T] CadlLibraryDef" + +--- +```ts +type CadlLibraryDef: TypeSpecLibraryDef; +``` + +## Deprecated + +Use TypeSpecLibraryDef + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `E` extends `Record`<`string`, `any`\> | `Record`<`string`, `never`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlManifest.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlManifest.md new file mode 100644 index 0000000000..8dbe5c70e6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlManifest.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] CadlManifest" + +--- +```ts +type CadlManifest: TypeSpecManifest; +``` + +## Deprecated + +Use TypeSpecManifest diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlScriptNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlScriptNode.md new file mode 100644 index 0000000000..cc62bc8a92 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlScriptNode.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] CadlScriptNode" + +--- +```ts +type CadlScriptNode: TypeSpecScriptNode; +``` + +## Deprecated + +Use TypeSpecScriptNode diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlValue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlValue.md new file mode 100644 index 0000000000..7a0c2a0a20 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CadlValue.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] CadlValue" + +--- +```ts +type CadlValue: TypeSpecValue; +``` + +## Deprecated + +Use TypeSpecValue diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Comment.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Comment.md new file mode 100644 index 0000000000..cb9d83c25d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Comment.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] Comment" + +--- +```ts +type Comment: LineComment | BlockComment; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CreateTypeProps.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CreateTypeProps.md new file mode 100644 index 0000000000..09077fab54 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/CreateTypeProps.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] CreateTypeProps" + +--- +```ts +type CreateTypeProps: Omit; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DateTimeKnownEncoding.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DateTimeKnownEncoding.md new file mode 100644 index 0000000000..adb02250da --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DateTimeKnownEncoding.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DateTimeKnownEncoding" + +--- +```ts +type DateTimeKnownEncoding: "rfc3339" | "rfc7231" | "unixTimestamp"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Declaration.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Declaration.md new file mode 100644 index 0000000000..02ab5c9b0f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Declaration.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[T] Declaration" + +--- +```ts +type Declaration: + | ModelStatementNode + | ScalarStatementNode + | InterfaceStatementNode + | UnionStatementNode + | NamespaceStatementNode + | OperationStatementNode + | TemplateParameterDeclarationNode + | ProjectionStatementNode + | ProjectionParameterDeclarationNode + | ProjectionLambdaParameterDeclarationNode + | EnumStatementNode + | AliasStatementNode + | DecoratorDeclarationStatementNode + | FunctionDeclarationStatementNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DecoratorArgumentValue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DecoratorArgumentValue.md new file mode 100644 index 0000000000..08ae00dea0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DecoratorArgumentValue.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] DecoratorArgumentValue" + +--- +```ts +type DecoratorArgumentValue: Type | number | string | boolean; +``` + +Type System types diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticFormat.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticFormat.md new file mode 100644 index 0000000000..a8cda9bcb2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticFormat.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[T] DiagnosticFormat" + +--- +```ts +type DiagnosticFormat: T[C][M] extends CallableMessage ? object : Record; +``` + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `C` extends keyof `T` | - | +| `M` extends keyof `T`[`C`] | `"default"` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticHandler.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticHandler.md new file mode 100644 index 0000000000..08aa8b590d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticHandler.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] DiagnosticHandler" + +--- +```ts +type DiagnosticHandler: (diagnostic) => void; +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostic` | [`Diagnostic`](../interfaces/Diagnostic.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticMap.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticMap.md new file mode 100644 index 0000000000..914e233943 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticMap.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] DiagnosticMap" + +--- +```ts +type DiagnosticMap: { readonly [code in keyof T]: DiagnosticDefinition }; +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticReport.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticReport.md new file mode 100644 index 0000000000..4a3471badc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticReport.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[T] DiagnosticReport" + +--- +```ts +type DiagnosticReport: DiagnosticReportWithoutTarget & object; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `target` | [`DiagnosticTarget`](DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | - | + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `C` extends keyof `T` | - | +| `M` extends keyof `T`[`C`] | `"default"` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticReportWithoutTarget.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticReportWithoutTarget.md new file mode 100644 index 0000000000..5f28ab15e6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticReportWithoutTarget.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[T] DiagnosticReportWithoutTarget" + +--- +```ts +type DiagnosticReportWithoutTarget: object & DiagnosticFormat; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `code` | `C` | - | +| `messageId` | `M` | - | + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `C` extends keyof `T` | - | +| `M` extends keyof `T`[`C`] | `"default"` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticResult.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticResult.md new file mode 100644 index 0000000000..9f7bc17eeb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticResult.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[T] DiagnosticResult" + +--- +```ts +type DiagnosticResult: [T, readonly Diagnostic[]]; +``` + +Return type of accessor functions in TypeSpec. +Tuple composed of: +- 0: Actual result of an accessor function +- 1: List of diagnostics that were emitted while retrieving the data. + +## Type parameters + +| Parameter | +| :------ | +| `T` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticSeverity.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticSeverity.md new file mode 100644 index 0000000000..cb099c51c1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticSeverity.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DiagnosticSeverity" + +--- +```ts +type DiagnosticSeverity: "error" | "warning"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticTarget.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticTarget.md new file mode 100644 index 0000000000..186c4100a7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DiagnosticTarget.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DiagnosticTarget" + +--- +```ts +type DiagnosticTarget: TypeSpecDiagnosticTarget | SourceLocation; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Directive.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Directive.md new file mode 100644 index 0000000000..b60793174b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Directive.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] Directive" + +--- +```ts +type Directive: SuppressDirective | DeprecatedDirective; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DirectiveArgument.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DirectiveArgument.md new file mode 100644 index 0000000000..229b21308c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DirectiveArgument.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DirectiveArgument" + +--- +```ts +type DirectiveArgument: StringLiteralNode | IdentifierNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DocContent.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DocContent.md new file mode 100644 index 0000000000..2feb91bacc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DocContent.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DocContent" + +--- +```ts +type DocContent: DocTextNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DocTag.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DocTag.md new file mode 100644 index 0000000000..63dab4fe8f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DocTag.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[T] DocTag" + +--- +```ts +type DocTag: + | DocReturnsTagNode + | DocErrorsTagNode + | DocParamTagNode + | DocTemplateTagNode + | DocUnknownTagNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DocToken.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DocToken.md new file mode 100644 index 0000000000..2c143a86cf --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DocToken.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[T] DocToken" + +--- +```ts +type DocToken: + | Token.NewLine + | Token.Whitespace + | Token.ConflictMarker + | Token.Star + | Token.At + | Token.CloseBrace + | Token.Identifier + | Token.Hyphen + | Token.DocText + | Token.DocCodeSpan + | Token.DocCodeFenceDelimiter + | Token.EndOfFile; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DurationKnownEncoding.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DurationKnownEncoding.md new file mode 100644 index 0000000000..e40ff8e007 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/DurationKnownEncoding.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DurationKnownEncoding" + +--- +```ts +type DurationKnownEncoding: "ISO8601" | "seconds"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/EmitOptionsFor.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/EmitOptionsFor.md new file mode 100644 index 0000000000..50a0c41d5a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/EmitOptionsFor.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[T] EmitOptionsFor" + +--- +```ts +type EmitOptionsFor: C extends TypeSpecLibrary ? E : never; +``` + +Get the options for the onEmit of this library. + +## Type parameters + +| Parameter | +| :------ | +| `C` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/EmitterFunc.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/EmitterFunc.md new file mode 100644 index 0000000000..1c75463e4e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/EmitterFunc.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] EmitterFunc" + +--- +```ts +type EmitterFunc: (context) => Promise | void; +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`EmitContext`](../interfaces/EmitContext.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Expression.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Expression.md new file mode 100644 index 0000000000..eb40abc01e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Expression.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[T] Expression" + +--- +```ts +type Expression: + | ArrayExpressionNode + | MemberExpressionNode + | ModelExpressionNode + | TupleExpressionNode + | UnionExpressionNode + | IntersectionExpressionNode + | TypeReferenceNode + | ValueOfExpressionNode + | IdentifierNode + | StringLiteralNode + | NumericLiteralNode + | BooleanLiteralNode + | VoidKeywordNode + | NeverKeywordNode + | AnyKeywordNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/InferredCadlValue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/InferredCadlValue.md new file mode 100644 index 0000000000..da265fb262 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/InferredCadlValue.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[T] InferredCadlValue" + +--- +```ts +type InferredCadlValue: InferredTypeSpecValue; +``` + +## Deprecated + +Use InferredTypeSpecValue + +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](TypeKind.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/InferredTypeSpecValue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/InferredTypeSpecValue.md new file mode 100644 index 0000000000..3f5fdccbed --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/InferredTypeSpecValue.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] InferredTypeSpecValue" + +--- +```ts +type InferredTypeSpecValue: K extends "Any" ? TypeSpecValue : K extends infer T[] ? InferredTypeSpecValue : K extends "String" ? string : K extends "Number" ? number : K extends "Boolean" ? boolean : Type & object; +``` + +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](TypeKind.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/IntrinsicScalarName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/IntrinsicScalarName.md new file mode 100644 index 0000000000..46387c05fd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/IntrinsicScalarName.md @@ -0,0 +1,33 @@ +--- +jsApi: true +title: "[T] IntrinsicScalarName" + +--- +```ts +type IntrinsicScalarName: + | "bytes" + | "numeric" + | "integer" + | "float" + | "int64" + | "int32" + | "int16" + | "int8" + | "uint64" + | "uint32" + | "uint16" + | "uint8" + | "safeint" + | "float32" + | "float64" + | "decimal" + | "decimal128" + | "string" + | "plainDate" + | "plainTime" + | "utcDateTime" + | "offsetDateTime" + | "duration" + | "boolean" + | "url"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/JSONSchemaType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/JSONSchemaType.md new file mode 100644 index 0000000000..d1ede8cc96 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/JSONSchemaType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] JSONSchemaType" + +--- +```ts +type JSONSchemaType: AjvJSONSchemaType; +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LibraryMetadata.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LibraryMetadata.md new file mode 100644 index 0000000000..e0887bf732 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LibraryMetadata.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] LibraryMetadata" + +--- +```ts +type LibraryMetadata: FileLibraryMetadata | ModuleLibraryMetadata; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticFormat.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticFormat.md new file mode 100644 index 0000000000..2c6d055a69 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticFormat.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] LinterRuleDiagnosticFormat" + +--- +```ts +type LinterRuleDiagnosticFormat: T[M] extends CallableMessage ? object : Record; +``` + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends [`DiagnosticMessages`](../interfaces/DiagnosticMessages.md) | - | +| `M` extends keyof `T` | `"default"` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReport.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReport.md new file mode 100644 index 0000000000..6dcef34271 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReport.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[T] LinterRuleDiagnosticReport" + +--- +```ts +type LinterRuleDiagnosticReport: LinterRuleDiagnosticReportWithoutTarget & object; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `target` | [`DiagnosticTarget`](DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | - | + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends [`DiagnosticMessages`](../interfaces/DiagnosticMessages.md) | - | +| `M` extends keyof `T` | `"default"` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReportWithoutTarget.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReportWithoutTarget.md new file mode 100644 index 0000000000..4b5c72a898 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReportWithoutTarget.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[T] LinterRuleDiagnosticReportWithoutTarget" + +--- +```ts +type LinterRuleDiagnosticReportWithoutTarget: object & LinterRuleDiagnosticFormat; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `messageId` | `M` | - | + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends [`DiagnosticMessages`](../interfaces/DiagnosticMessages.md) | - | +| `M` extends keyof `T` | `"default"` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LiteralNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LiteralNode.md new file mode 100644 index 0000000000..d140813d91 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LiteralNode.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] LiteralNode" + +--- +```ts +type LiteralNode: StringLiteralNode | NumericLiteralNode | BooleanLiteralNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LiteralType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LiteralType.md new file mode 100644 index 0000000000..0418cc26d6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LiteralType.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] LiteralType" + +--- +```ts +type LiteralType: StringLiteral | NumericLiteral | BooleanLiteral; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LocationContext.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LocationContext.md new file mode 100644 index 0000000000..0b64651ee9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LocationContext.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] LocationContext" + +--- +```ts +type LocationContext: ProjectLocationContext | CompilerLocationContext | SyntheticLocationContext | LibraryLocationContext; +``` + +Represent a location context in the mind of the compiler. This can be: +- the user project +- a library +- the compiler(standard library) +- virtual diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LogLevel.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LogLevel.md new file mode 100644 index 0000000000..d7add61d1e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/LogLevel.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] LogLevel" + +--- +```ts +type LogLevel: "trace" | "warning" | "error"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MarshalledValue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MarshalledValue.md new file mode 100644 index 0000000000..899b184703 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MarshalledValue.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] MarshalledValue" + +--- +```ts +type MarshalledValue: Type extends StringLiteral ? string : Type extends NumericLiteral ? number : Type extends BooleanLiteral ? boolean : Type; +``` + +## Type parameters + +| Parameter | +| :------ | +| `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberContainerNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberContainerNode.md new file mode 100644 index 0000000000..a2e623dab8 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberContainerNode.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] MemberContainerNode" + +--- +```ts +type MemberContainerNode: + | ModelStatementNode + | ModelExpressionNode + | InterfaceStatementNode + | EnumStatementNode + | UnionStatementNode; +``` + +Node types that can have referencable members diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberContainerType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberContainerType.md new file mode 100644 index 0000000000..f91bcc9915 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberContainerType.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] MemberContainerType" + +--- +```ts +type MemberContainerType: Model | Enum | Interface | Union; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberNode.md new file mode 100644 index 0000000000..c43ba0af08 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberNode.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] MemberNode" + +--- +```ts +type MemberNode: ModelPropertyNode | EnumMemberNode | OperationStatementNode | UnionVariantNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberType.md new file mode 100644 index 0000000000..80140f981e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/MemberType.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] MemberType" + +--- +```ts +type MemberType: ModelProperty | EnumMember | Operation | UnionVariant; +``` + +Type that can be used as members of a container type. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ModelIndexer.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ModelIndexer.md new file mode 100644 index 0000000000..e979ed290e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ModelIndexer.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] ModelIndexer" + +--- +```ts +type ModelIndexer: object; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `key` | [`Scalar`](../interfaces/Scalar.md) | - | +| `value` | [`Type`](Type.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Modifier.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Modifier.md new file mode 100644 index 0000000000..19ff00dcc4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Modifier.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] Modifier" + +--- +```ts +type Modifier: ExternKeywordNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ModuleResolutionResult.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ModuleResolutionResult.md new file mode 100644 index 0000000000..a38c9ee663 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ModuleResolutionResult.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] ModuleResolutionResult" + +--- +```ts +type ModuleResolutionResult: ResolvedFile | ResolvedModule; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/NeverIndexer.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/NeverIndexer.md new file mode 100644 index 0000000000..49d9389265 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/NeverIndexer.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] NeverIndexer" + +--- +```ts +type NeverIndexer: object; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `key` | [`NeverType`](../interfaces/NeverType.md) | - | +| `value` | `undefined` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/NewLine.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/NewLine.md new file mode 100644 index 0000000000..9a00fe40cd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/NewLine.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] NewLine" + +--- +```ts +type NewLine: "lf" | "crlf"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Node.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Node.md new file mode 100644 index 0000000000..82d14b0673 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Node.md @@ -0,0 +1,45 @@ +--- +jsApi: true +title: "[T] Node" + +--- +```ts +type Node: + | TypeSpecScriptNode + | JsSourceFileNode + | JsNamespaceDeclarationNode + | TemplateParameterDeclarationNode + | ProjectionParameterDeclarationNode + | ProjectionLambdaParameterDeclarationNode + | ModelPropertyNode + | UnionVariantNode + | OperationStatementNode + | OperationSignatureDeclarationNode + | OperationSignatureReferenceNode + | EnumMemberNode + | EnumSpreadMemberNode + | ModelSpreadPropertyNode + | DecoratorExpressionNode + | DirectiveExpressionNode + | Statement + | Expression + | FunctionParameterNode + | Modifier + | DocNode + | DocContent + | DocTag + | ProjectionStatementItem + | ProjectionExpression + | ProjectionModelSelectorNode + | ProjectionModelPropertySelectorNode + | ProjectionInterfaceSelectorNode + | ProjectionOperationSelectorNode + | ProjectionEnumSelectorNode + | ProjectionEnumMemberSelectorNode + | ProjectionUnionSelectorNode + | ProjectionUnionVariantSelectorNode + | ProjectionModelPropertyNode + | ProjectionModelSpreadPropertyNode + | ProjectionStatementNode + | ProjectionNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/NodeCallback.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/NodeCallback.md new file mode 100644 index 0000000000..d3ed4a633a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/NodeCallback.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[T] NodeCallback" + +--- +```ts +type NodeCallback: (c) => T; +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `c` | [`Node`](Node.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/OperationContainer.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/OperationContainer.md new file mode 100644 index 0000000000..67ffa61aa0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/OperationContainer.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] OperationContainer" + +--- +```ts +type OperationContainer: Namespace | Interface | Operation; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/OperationSignature.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/OperationSignature.md new file mode 100644 index 0000000000..f6bcceb7ea --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/OperationSignature.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] OperationSignature" + +--- +```ts +type OperationSignature: OperationSignatureDeclarationNode | OperationSignatureReferenceNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ProjectionExpression.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ProjectionExpression.md new file mode 100644 index 0000000000..6ed8c1e44e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ProjectionExpression.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[T] ProjectionExpression" + +--- +```ts +type ProjectionExpression: + | ProjectionLogicalExpressionNode + | ProjectionRelationalExpressionNode + | ProjectionEqualityExpressionNode + | ProjectionUnaryExpressionNode + | ProjectionArithmeticExpressionNode + | ProjectionCallExpressionNode + | ProjectionMemberExpressionNode + | ProjectionDecoratorReferenceExpressionNode + | ProjectionTupleExpressionNode + | ProjectionModelExpressionNode + | ProjectionIfExpressionNode + | ProjectionBlockExpressionNode + | ProjectionLambdaExpressionNode + | StringLiteralNode + | NumericLiteralNode + | BooleanLiteralNode + | IdentifierNode + | VoidKeywordNode + | NeverKeywordNode + | AnyKeywordNode + | ReturnExpressionNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ProjectionStatementItem.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ProjectionStatementItem.md new file mode 100644 index 0000000000..79861ce4f5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ProjectionStatementItem.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] ProjectionStatementItem" + +--- +```ts +type ProjectionStatementItem: ProjectionExpressionStatementNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ReferenceExpression.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ReferenceExpression.md new file mode 100644 index 0000000000..a255a58230 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ReferenceExpression.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[T] ReferenceExpression" + +--- +```ts +type ReferenceExpression: + | TypeReferenceNode + | MemberExpressionNode + | IdentifierNode + | VoidKeywordNode + | NeverKeywordNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/RuleRef.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/RuleRef.md new file mode 100644 index 0000000000..35404a94e3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/RuleRef.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] RuleRef" + +--- +```ts +type RuleRef: \${string}/${string}\; +``` + +Reference to a rule. In this format `:` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ScopeNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ScopeNode.md new file mode 100644 index 0000000000..9572988303 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/ScopeNode.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[T] ScopeNode" + +--- +```ts +type ScopeNode: + | NamespaceStatementNode + | ModelStatementNode + | InterfaceStatementNode + | AliasStatementNode + | TypeSpecScriptNode + | JsSourceFileNode + | ProjectionLambdaExpressionNode + | ProjectionNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/SemanticNodeListener.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/SemanticNodeListener.md new file mode 100644 index 0000000000..2a762c98f0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/SemanticNodeListener.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] SemanticNodeListener" + +--- +```ts +type SemanticNodeListener: object & TypeListeners; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `root` | (`context`) => `void` \| `undefined` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/SourceFileKind.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/SourceFileKind.md new file mode 100644 index 0000000000..f487dbb863 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/SourceFileKind.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] SourceFileKind" + +--- +```ts +type SourceFileKind: "typespec" | "js"; +``` + +Type of the source file that can be loaded via typespec diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Statement.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Statement.md new file mode 100644 index 0000000000..7ced5c24fe --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Statement.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[T] Statement" + +--- +```ts +type Statement: + | ImportStatementNode + | ModelStatementNode + | ScalarStatementNode + | NamespaceStatementNode + | InterfaceStatementNode + | UnionStatementNode + | UsingStatementNode + | EnumStatementNode + | AliasStatementNode + | OperationStatementNode + | DecoratorDeclarationStatementNode + | FunctionDeclarationStatementNode + | AugmentDecoratorStatementNode + | EmptyStatementNode + | InvalidStatementNode + | ProjectionStatementNode; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/StdTypeName.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/StdTypeName.md new file mode 100644 index 0000000000..34bdd549ab --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/StdTypeName.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] StdTypeName" + +--- +```ts +type StdTypeName: keyof StdTypes; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/StdTypes.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/StdTypes.md new file mode 100644 index 0000000000..be0108f4eb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/StdTypes.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] StdTypes" + +--- +```ts +type StdTypes: object & Record; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `Array` | [`Model`](../interfaces/Model.md) | - | +| `Record` | [`Model`](../interfaces/Model.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TemplateableNode.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TemplateableNode.md new file mode 100644 index 0000000000..238c8df672 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TemplateableNode.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[T] TemplateableNode" + +--- +```ts +type TemplateableNode: + | ModelStatementNode + | ScalarStatementNode + | AliasStatementNode + | InterfaceStatementNode + | OperationStatementNode + | UnionStatementNode; +``` + +Node that can be used as template diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TemplatedType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TemplatedType.md new file mode 100644 index 0000000000..bdd12a15b4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TemplatedType.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] TemplatedType" + +--- +```ts +type TemplatedType: Model | Operation | Interface | Union; +``` + +Union of all the types that implement TemplatedTypeBase diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TrackableType.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TrackableType.md new file mode 100644 index 0000000000..2d33af62e6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TrackableType.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] TrackableType" + +--- +```ts +type TrackableType: Model | Enum | Union | Tuple; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Type.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Type.md new file mode 100644 index 0000000000..7a0d78772b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/Type.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[T] Type" + +--- +```ts +type Type: + | Model + | ModelProperty + | Scalar + | Interface + | Enum + | EnumMember + | TemplateParameter + | Namespace + | Operation + | StringLiteral + | NumericLiteral + | BooleanLiteral + | Tuple + | Union + | UnionVariant + | IntrinsicType + | FunctionType + | Decorator + | FunctionParameter + | ObjectType + | Projection; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeKind.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeKind.md new file mode 100644 index 0000000000..47f3dbd39e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeKind.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] TypeKind" + +--- +```ts +type TypeKind: Type["kind"] | "Any"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeListeners.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeListeners.md new file mode 100644 index 0000000000..48751a2117 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeListeners.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] TypeListeners" + +--- +```ts +type TypeListeners: UnionToIntersection>; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeOfDiagnostics.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeOfDiagnostics.md new file mode 100644 index 0000000000..60f8ed84bc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeOfDiagnostics.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] TypeOfDiagnostics" + +--- +```ts +type TypeOfDiagnostics: T extends DiagnosticMap ? D : never; +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends [`DiagnosticMap`](DiagnosticMap.md)<`any`\> | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeOrReturnRecord.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeOrReturnRecord.md new file mode 100644 index 0000000000..77849b7f48 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeOrReturnRecord.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] TypeOrReturnRecord" + +--- +```ts +type TypeOrReturnRecord: Type | ReturnRecord; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeSpecDiagnosticTarget.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeSpecDiagnosticTarget.md new file mode 100644 index 0000000000..d33434f295 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeSpecDiagnosticTarget.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] TypeSpecDiagnosticTarget" + +--- +```ts +type TypeSpecDiagnosticTarget: Node | Type | Sym; +``` + +Diagnostic target that can be used when working with TypeSpec types. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeSpecValue.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeSpecValue.md new file mode 100644 index 0000000000..09800df195 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/TypeSpecValue.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] TypeSpecValue" + +--- +```ts +type TypeSpecValue: Type | string | number | boolean; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/WriteLine.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/WriteLine.md new file mode 100644 index 0000000000..359c880693 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/type-aliases/WriteLine.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] WriteLine" + +--- +```ts +type WriteLine: (text?) => void; +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `text`? | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/CadlPrettierPlugin.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/CadlPrettierPlugin.md new file mode 100644 index 0000000000..56a2802bcd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/CadlPrettierPlugin.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[V] CadlPrettierPlugin" + +--- +```ts +const CadlPrettierPlugin: __module = TypeSpecPrettierPlugin; +``` + +## Deprecated + +Use TypeSpecPrettierPlugin diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/MANIFEST.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/MANIFEST.md new file mode 100644 index 0000000000..66e2bed0a2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/MANIFEST.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] MANIFEST" + +--- +```ts +const MANIFEST: TypeSpecManifest = manifest; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/NoTarget.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/NoTarget.md new file mode 100644 index 0000000000..bdfc6f2016 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/NoTarget.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[V] NoTarget" + +--- +```ts +const NoTarget: *typeof* NoTarget; +``` + +Used to explicitly specify that a diagnostic has no target. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/NodeHost.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/NodeHost.md new file mode 100644 index 0000000000..7c3a174ffc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/NodeHost.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[V] NodeHost" + +--- +```ts +const NodeHost: CompilerHost; +``` + +Implementation of the + +## See + +CompilerHost using the real file system. +This is the the CompilerHost used by TypeSpec CLI. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/TypeSpecPrettierPlugin.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/TypeSpecPrettierPlugin.md new file mode 100644 index 0000000000..141b137e60 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/TypeSpecPrettierPlugin.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] TypeSpecPrettierPlugin" + +--- +```ts +const TypeSpecPrettierPlugin: __module = formatter; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/altDirectorySeparator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/altDirectorySeparator.md new file mode 100644 index 0000000000..07ee28a1cb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/altDirectorySeparator.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] altDirectorySeparator" + +--- +```ts +const altDirectorySeparator: "\\" = "\\"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/cadlVersion.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/cadlVersion.md new file mode 100644 index 0000000000..f72ab444e2 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/cadlVersion.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[V] cadlVersion" + +--- +```ts +const cadlVersion: any = typespecVersion; +``` + +## Deprecated + +Use typespecVersion diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/directorySeparator.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/directorySeparator.md new file mode 100644 index 0000000000..52fa3817c9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/directorySeparator.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[V] directorySeparator" + +--- +```ts +const directorySeparator: "/" = "/"; +``` + +Internally, we represent paths as strings with '/' as the directory separator. +When we make system calls (eg: LanguageServiceHost.getDirectory()), +we expect the host to correctly handle paths in our specified format. diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..4868929ecc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec" = "TypeSpec"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/typespecVersion.md b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/typespecVersion.md new file mode 100644 index 0000000000..3039c72099 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/reference/js-api/variables/typespecVersion.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] typespecVersion" + +--- +```ts +const typespecVersion: any = manifest.version; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/cheat-sheet.md b/packages/website-astro/src/content/docs/current/standard-library/rest/cheat-sheet.md new file mode 100644 index 0000000000..6640604aee --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/cheat-sheet.md @@ -0,0 +1,12 @@ +--- +title: Cheat sheet +--- + +## Resource Routing + +_Details: [Resource Routing](./resource-routing.md)_ + +| Feature | Example | Resolved Route | +| ------------------------ | ----------------------------------------------------------------------------------- | -------------- | +| Auto route | `@autoRoute op get(@segment("pets") @path id: string): void` | `/pets/{id}` | +| Custom segment seperator | `@autoRoute op get(@segment("pets") @path @segmentSeparator(":") id: string): void` | `:pets/{id}` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/data-types.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/data-types.md new file mode 100644 index 0000000000..5db8bbc42d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/data-types.md @@ -0,0 +1,149 @@ +--- +title: "Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Data types + +## TypeSpec.Rest + +### `ResourceLocation` {#TypeSpec.Rest.ResourceLocation} + +A URL that points to a resource. + +```typespec +scalar TypeSpec.Rest.ResourceLocation +``` + +## TypeSpec.Rest.Resource + +### `CollectionWithNextLink` {#TypeSpec.Rest.Resource.CollectionWithNextLink} + +Structure for a paging response using `value` and `nextLink` to represent pagination. +This only provides the model structure and not actual pagination support. +See https://github.com/microsoft/typespec/issues/705 for general paging support. + +```typespec +model TypeSpec.Rest.Resource.CollectionWithNextLink +``` + +#### Template Parameters + +| Name | Description | +| ---- | ------------------------------------ | +| T | The resource type of the collection. | + +### `KeysOf` {#TypeSpec.Rest.Resource.KeysOf} + +Dynamically gathers keys of the model type T. + +```typespec +model TypeSpec.Rest.Resource.KeysOf +``` + +#### Template Parameters + +| Name | Description | +| ---- | ----------------- | +| T | The target model. | + +### `ParentKeysOf` {#TypeSpec.Rest.Resource.ParentKeysOf} + +Dynamically gathers parent keys of the model type T. + +```typespec +model TypeSpec.Rest.Resource.ParentKeysOf +``` + +#### Template Parameters + +| Name | Description | +| ---- | ----------------- | +| T | The target model. | + +### `ResourceCollectionParameters` {#TypeSpec.Rest.Resource.ResourceCollectionParameters} + +Represents collection operation parameters for resource TResource. + +```typespec +model TypeSpec.Rest.Resource.ResourceCollectionParameters +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | + +### `ResourceCreatedResponse` {#TypeSpec.Rest.Resource.ResourceCreatedResponse} + +Resource create operation completed successfully. + +```typespec +model TypeSpec.Rest.Resource.ResourceCreatedResponse +``` + +#### Template Parameters + +| Name | Description | +| ---- | ------------------------------------ | +| T | The resource model that was created. | + +### `ResourceCreateModel` {#TypeSpec.Rest.Resource.ResourceCreateModel} + +Resource create operation model. + +```typespec +model TypeSpec.Rest.Resource.ResourceCreateModel +``` + +#### Template Parameters + +| Name | Description | +| --------- | ----------------------------- | +| TResource | The resource model to create. | + +### `ResourceCreateOrUpdateModel` {#TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel} + +Resource create or update operation model. + +```typespec +model TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel +``` + +#### Template Parameters + +| Name | Description | +| --------- | --------------------------------------- | +| TResource | The resource model to create or update. | + +### `ResourceDeletedResponse` {#TypeSpec.Rest.Resource.ResourceDeletedResponse} + +Resource deleted successfully. + +```typespec +model TypeSpec.Rest.Resource.ResourceDeletedResponse +``` + +### `ResourceError` {#TypeSpec.Rest.Resource.ResourceError} + +The default error response for resource operations. + +```typespec +model TypeSpec.Rest.Resource.ResourceError +``` + +### `ResourceParameters` {#TypeSpec.Rest.Resource.ResourceParameters} + +Represents operation parameters for resource TResource. + +```typespec +model TypeSpec.Rest.Resource.ResourceParameters +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/decorators.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/decorators.md new file mode 100644 index 0000000000..5163353f55 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/decorators.md @@ -0,0 +1,307 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.Rest + +### `@action` {#@TypeSpec.Rest.action} + +Specify this operation is an action. (Scoped to a resource item /pets/{petId}/my-action) + +```typespec +@TypeSpec.Rest.action(name?: valueof string) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ---- | ----------------------- | ----------------------------------------------------------------------------- | +| name | `valueof scalar string` | Name of the action. If not specified, the name of the operation will be used. | + +### `@actionSeparator` {#@TypeSpec.Rest.actionSeparator} + +Defines the separator string that is inserted before the action name in auto-generated routes for actions. + +```typespec +@TypeSpec.Rest.actionSeparator(seperator: valueof / | : | /:) +``` + +#### Target + +`union Model | ModelProperty | Operation` + +#### Parameters + +| Name | Type | Description | +| --------- | ---------------------------- | ---------------------------------------------------------------- | +| seperator | `valueof union / \| : \| /:` | Seperator seperating the action segment from the rest of the url | + +### `@autoRoute` {#@TypeSpec.Rest.autoRoute} + +This interface or operation should resolve its route automatically. To be used with resource types where the route segments area defined on the models. + +```typespec +@TypeSpec.Rest.autoRoute +``` + +#### Target + +`union Interface | Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@autoRoute +interface Pets { + get(@segment("pets") @path id: string): void; //-> route: /pets/{id} +} +``` + +### `@collectionAction` {#@TypeSpec.Rest.collectionAction} + +Specify this operation is a collection action. (Scopped to a resource, /pets/my-action) + +```typespec +@TypeSpec.Rest.collectionAction(resourceType: Model, name?: valueof string) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ----------------------- | ----------------------------------------------------------------------------- | +| resourceType | `Model` | Resource marked with | +| name | `valueof scalar string` | Name of the action. If not specified, the name of the operation will be used. | + +### `@copyResourceKeyParameters` {#@TypeSpec.Rest.copyResourceKeyParameters} + +Copy the resource key parameters on the model + +```typespec +@TypeSpec.Rest.copyResourceKeyParameters(filter?: valueof string) +``` + +#### Target + +`Model` + +#### Parameters + +| Name | Type | Description | +| ------ | ----------------------- | ------------------------------------- | +| filter | `valueof scalar string` | Filter to exclude certain properties. | + +### `@createsOrReplacesResource` {#@TypeSpec.Rest.createsOrReplacesResource} + +Specify that this is a CreateOrReplace operation for a given resource. + +```typespec +@TypeSpec.Rest.createsOrReplacesResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@createsOrUpdatesResource` {#@TypeSpec.Rest.createsOrUpdatesResource} + +Specify that this is a CreatesOrUpdate operation for a given resource. + +```typespec +@TypeSpec.Rest.createsOrUpdatesResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@createsResource` {#@TypeSpec.Rest.createsResource} + +Specify that this is a Create operation for a given resource. + +```typespec +@TypeSpec.Rest.createsResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@deletesResource` {#@TypeSpec.Rest.deletesResource} + +Specify that this is a Delete operation for a given resource. + +```typespec +@TypeSpec.Rest.deletesResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@listsResource` {#@TypeSpec.Rest.listsResource} + +Specify that this is a List operation for a given resource. + +```typespec +@TypeSpec.Rest.listsResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@parentResource` {#@TypeSpec.Rest.parentResource} + +Mark model as a child of the given parent resource. + +```typespec +@TypeSpec.Rest.parentResource(parent: Model) +``` + +#### Target + +`Model` + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------- | +| parent | `Model` | Parent model. | + +### `@readsResource` {#@TypeSpec.Rest.readsResource} + +Specify that this is a Read operation for a given resource. + +```typespec +@TypeSpec.Rest.readsResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@resource` {#@TypeSpec.Rest.resource} + +Mark this model as a resource type with a name. + +```typespec +@TypeSpec.Rest.resource(collectionName: valueof string) +``` + +#### Target + +`Model` + +#### Parameters + +| Name | Type | Description | +| -------------- | ----------------------- | ---------------------- | +| collectionName | `valueof scalar string` | type's collection name | + +### `@segment` {#@TypeSpec.Rest.segment} + +Defines the preceding path segment for a + +```typespec +@TypeSpec.Rest.segment(name: valueof string) +``` + +#### Target + +`union Model | ModelProperty | Operation` + +#### Parameters + +| Name | Type | Description | +| ---- | ----------------------- | ---------------------------------------------------------------------------------------------- | +| name | `valueof scalar string` | Segment that will be inserted into the operation route before the path parameter's name field. | + +#### Examples + +### `@segmentOf` {#@TypeSpec.Rest.segmentOf} + +Returns the URL segment of a given model if it has `@segment` and `@key` decorator. + +```typespec +@TypeSpec.Rest.segmentOf(type: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ------------ | +| type | `Model` | Target model | + +### `@updatesResource` {#@TypeSpec.Rest.updatesResource} + +Specify that this is a Update operation for a given resource. + +```typespec +@TypeSpec.Rest.updatesResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/index.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/index.md new file mode 100644 index 0000000000..158097c6d3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/index.md @@ -0,0 +1,93 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec REST protocol binding + +## Install + + + + +```bash +npm install @typespec/rest +``` + + + + +```bash +npm install --save-peer @typespec/rest +``` + + + + +## TypeSpec.Rest + +### Decorators + +- [`@action`](./decorators.md#@TypeSpec.Rest.action) +- [`@actionSeparator`](./decorators.md#@TypeSpec.Rest.actionSeparator) +- [`@autoRoute`](./decorators.md#@TypeSpec.Rest.autoRoute) +- [`@collectionAction`](./decorators.md#@TypeSpec.Rest.collectionAction) +- [`@copyResourceKeyParameters`](./decorators.md#@TypeSpec.Rest.copyResourceKeyParameters) +- [`@createsOrReplacesResource`](./decorators.md#@TypeSpec.Rest.createsOrReplacesResource) +- [`@createsOrUpdatesResource`](./decorators.md#@TypeSpec.Rest.createsOrUpdatesResource) +- [`@createsResource`](./decorators.md#@TypeSpec.Rest.createsResource) +- [`@deletesResource`](./decorators.md#@TypeSpec.Rest.deletesResource) +- [`@listsResource`](./decorators.md#@TypeSpec.Rest.listsResource) +- [`@parentResource`](./decorators.md#@TypeSpec.Rest.parentResource) +- [`@readsResource`](./decorators.md#@TypeSpec.Rest.readsResource) +- [`@resource`](./decorators.md#@TypeSpec.Rest.resource) +- [`@segment`](./decorators.md#@TypeSpec.Rest.segment) +- [`@segmentOf`](./decorators.md#@TypeSpec.Rest.segmentOf) +- [`@updatesResource`](./decorators.md#@TypeSpec.Rest.updatesResource) + +## TypeSpec.Rest.Resource + +### Interfaces + +- [`ExtensionResourceCollectionOperations`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations) +- [`ExtensionResourceCreate`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceCreate) +- [`ExtensionResourceCreateOrUpdate`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceCreateOrUpdate) +- [`ExtensionResourceDelete`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceDelete) +- [`ExtensionResourceInstanceOperations`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations) +- [`ExtensionResourceList`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceList) +- [`ExtensionResourceOperations`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceOperations) +- [`ExtensionResourceRead`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceRead) +- [`ExtensionResourceUpdate`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceUpdate) +- [`ResourceCollectionOperations`](./interfaces.md#TypeSpec.Rest.Resource.ResourceCollectionOperations) +- [`ResourceCreate`](./interfaces.md#TypeSpec.Rest.Resource.ResourceCreate) +- [`ResourceCreateOrReplace`](./interfaces.md#TypeSpec.Rest.Resource.ResourceCreateOrReplace) +- [`ResourceCreateOrUpdate`](./interfaces.md#TypeSpec.Rest.Resource.ResourceCreateOrUpdate) +- [`ResourceDelete`](./interfaces.md#TypeSpec.Rest.Resource.ResourceDelete) +- [`ResourceInstanceOperations`](./interfaces.md#TypeSpec.Rest.Resource.ResourceInstanceOperations) +- [`ResourceList`](./interfaces.md#TypeSpec.Rest.Resource.ResourceList) +- [`ResourceOperations`](./interfaces.md#TypeSpec.Rest.Resource.ResourceOperations) +- [`ResourceRead`](./interfaces.md#TypeSpec.Rest.Resource.ResourceRead) +- [`ResourceUpdate`](./interfaces.md#TypeSpec.Rest.Resource.ResourceUpdate) +- [`SingletonResourceOperations`](./interfaces.md#TypeSpec.Rest.Resource.SingletonResourceOperations) +- [`SingletonResourceRead`](./interfaces.md#TypeSpec.Rest.Resource.SingletonResourceRead) +- [`SingletonResourceUpdate`](./interfaces.md#TypeSpec.Rest.Resource.SingletonResourceUpdate) + +### Models + +- [`CollectionWithNextLink`](./data-types.md#TypeSpec.Rest.Resource.CollectionWithNextLink) +- [`KeysOf`](./data-types.md#TypeSpec.Rest.Resource.KeysOf) +- [`ParentKeysOf`](./data-types.md#TypeSpec.Rest.Resource.ParentKeysOf) +- [`ResourceCollectionParameters`](./data-types.md#TypeSpec.Rest.Resource.ResourceCollectionParameters) +- [`ResourceCreatedResponse`](./data-types.md#TypeSpec.Rest.Resource.ResourceCreatedResponse) +- [`ResourceCreateModel`](./data-types.md#TypeSpec.Rest.Resource.ResourceCreateModel) +- [`ResourceCreateOrUpdateModel`](./data-types.md#TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel) +- [`ResourceDeletedResponse`](./data-types.md#TypeSpec.Rest.Resource.ResourceDeletedResponse) +- [`ResourceError`](./data-types.md#TypeSpec.Rest.Resource.ResourceError) +- [`ResourceParameters`](./data-types.md#TypeSpec.Rest.Resource.ResourceParameters) diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/interfaces.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/interfaces.md new file mode 100644 index 0000000000..ba064c720b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/interfaces.md @@ -0,0 +1,647 @@ +--- +title: "Interfaces and Operations" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Interfaces and Operations + +## TypeSpec.Rest.Resource + +### `ExtensionResourceCollectionOperations` {#TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations} + +Extension resource operation templates for extension resource collections. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceCollectionOperations.create` {#TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.create} + +Creates a new instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TExtension | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +#### `ExtensionResourceCollectionOperations.list` {#TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.list} + +Lists all instances of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ExtensionResourceCreate` {#TypeSpec.Rest.Resource.ExtensionResourceCreate} + +Extension resource create operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceCreate +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceCreate.create` {#TypeSpec.Rest.Resource.ExtensionResourceCreate.create} + +Creates a new instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceCreate.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TExtension | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +### `ExtensionResourceCreateOrUpdate` {#TypeSpec.Rest.Resource.ExtensionResourceCreateOrUpdate} + +Extension resource create or update operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceCreateOrUpdate +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceCreateOrUpdate.createOrUpdate` {#TypeSpec.Rest.Resource.ExtensionResourceCreateOrUpdate.createOrUpdate} + +Creates or update an instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceCreateOrUpdate.createOrUpdate(resource: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TExtension | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +### `ExtensionResourceDelete` {#TypeSpec.Rest.Resource.ExtensionResourceDelete} + +Extension resource delete operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceDelete +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceDelete.delete` {#TypeSpec.Rest.Resource.ExtensionResourceDelete.delete} + +Deletes an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceDelete.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +### `ExtensionResourceInstanceOperations` {#TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations} + +Extension resource operation templates for extension resource instances. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceInstanceOperations.get` {#TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.get} + +Gets an instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.get(): TExtension | TError +``` + +#### `ExtensionResourceInstanceOperations.update` {#TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.update} + +Updates an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TExtension | TError +``` + +#### `ExtensionResourceInstanceOperations.delete` {#TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.delete} + +Deletes an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +### `ExtensionResourceList` {#TypeSpec.Rest.Resource.ExtensionResourceList} + +Extension resource list operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceList +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceList.list` {#TypeSpec.Rest.Resource.ExtensionResourceList.list} + +Lists all instances of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceList.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ExtensionResourceOperations` {#TypeSpec.Rest.Resource.ExtensionResourceOperations} + +Extension resource operation templates for extension resource instances and collections. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceOperations +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceOperations.get` {#TypeSpec.Rest.Resource.ExtensionResourceOperations.get} + +Gets an instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceOperations.get(): TExtension | TError +``` + +#### `ExtensionResourceOperations.update` {#TypeSpec.Rest.Resource.ExtensionResourceOperations.update} + +Updates an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceOperations.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TExtension | TError +``` + +#### `ExtensionResourceOperations.delete` {#TypeSpec.Rest.Resource.ExtensionResourceOperations.delete} + +Deletes an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceOperations.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +#### `ExtensionResourceOperations.create` {#TypeSpec.Rest.Resource.ExtensionResourceOperations.create} + +Creates a new instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceOperations.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TExtension | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +#### `ExtensionResourceOperations.list` {#TypeSpec.Rest.Resource.ExtensionResourceOperations.list} + +Lists all instances of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ExtensionResourceRead` {#TypeSpec.Rest.Resource.ExtensionResourceRead} + +Extension resource read operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceRead +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceRead.get` {#TypeSpec.Rest.Resource.ExtensionResourceRead.get} + +Gets an instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceRead.get(): TExtension | TError +``` + +### `ExtensionResourceUpdate` {#TypeSpec.Rest.Resource.ExtensionResourceUpdate} + +Extension resource update operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceUpdate +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceUpdate.update` {#TypeSpec.Rest.Resource.ExtensionResourceUpdate.update} + +Updates an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceUpdate.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TExtension | TError +``` + +### `ResourceCollectionOperations` {#TypeSpec.Rest.Resource.ResourceCollectionOperations} + +Resource operation templates for resource collections. + +```typespec +interface TypeSpec.Rest.Resource.ResourceCollectionOperations +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | +| TError | The error response. | + +#### `ResourceCollectionOperations.create` {#TypeSpec.Rest.Resource.ResourceCollectionOperations.create} + +Creates a new instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceCollectionOperations.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TResource | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +#### `ResourceCollectionOperations.list` {#TypeSpec.Rest.Resource.ResourceCollectionOperations.list} + +Lists all instances of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceCollectionOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ResourceCreate` {#TypeSpec.Rest.Resource.ResourceCreate} + +Resource create operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceCreate +``` + +#### Template Parameters + +| Name | Description | +| --------- | ----------------------------- | +| TResource | The resource model to create. | +| TError | The error response. | + +#### `ResourceCreate.create` {#TypeSpec.Rest.Resource.ResourceCreate.create} + +Creates a new instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceCreate.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TResource | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +### `ResourceCreateOrReplace` {#TypeSpec.Rest.Resource.ResourceCreateOrReplace} + +Resource create or replace operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceCreateOrReplace +``` + +#### Template Parameters + +| Name | Description | +| --------- | ---------------------------------------- | +| TResource | The resource model to create or replace. | +| TError | The error response. | + +#### `ResourceCreateOrReplace.createOrReplace` {#TypeSpec.Rest.Resource.ResourceCreateOrReplace.createOrReplace} + +Creates or replaces a instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceCreateOrReplace.createOrReplace(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TResource | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +### `ResourceCreateOrUpdate` {#TypeSpec.Rest.Resource.ResourceCreateOrUpdate} + +Resource create or update operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceCreateOrUpdate +``` + +#### Template Parameters + +| Name | Description | +| --------- | --------------------------------------- | +| TResource | The resource model to create or update. | +| TError | The error response. | + +#### `ResourceCreateOrUpdate.createOrUpdate` {#TypeSpec.Rest.Resource.ResourceCreateOrUpdate.createOrUpdate} + +Creates or update an instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceCreateOrUpdate.createOrUpdate(resource: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TResource | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +### `ResourceDelete` {#TypeSpec.Rest.Resource.ResourceDelete} + +Resource delete operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceDelete +``` + +#### Template Parameters + +| Name | Description | +| --------- | ----------------------------- | +| TResource | The resource model to delete. | +| TError | The error response. | + +#### `ResourceDelete.delete` {#TypeSpec.Rest.Resource.ResourceDelete.delete} + +Deletes an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceDelete.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +### `ResourceInstanceOperations` {#TypeSpec.Rest.Resource.ResourceInstanceOperations} + +Resource operation templates for resource instances. + +```typespec +interface TypeSpec.Rest.Resource.ResourceInstanceOperations +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | +| TError | The error response. | + +#### `ResourceInstanceOperations.get` {#TypeSpec.Rest.Resource.ResourceInstanceOperations.get} + +Gets an instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceInstanceOperations.get(): TResource | TError +``` + +#### `ResourceInstanceOperations.update` {#TypeSpec.Rest.Resource.ResourceInstanceOperations.update} + +Updates an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceInstanceOperations.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TResource | TError +``` + +#### `ResourceInstanceOperations.delete` {#TypeSpec.Rest.Resource.ResourceInstanceOperations.delete} + +Deletes an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceInstanceOperations.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +### `ResourceList` {#TypeSpec.Rest.Resource.ResourceList} + +Resource list operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceList +``` + +#### Template Parameters + +| Name | Description | +| --------- | --------------------------- | +| TResource | The resource model to list. | +| TError | The error response. | + +#### `ResourceList.list` {#TypeSpec.Rest.Resource.ResourceList.list} + +Lists all instances of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceList.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ResourceOperations` {#TypeSpec.Rest.Resource.ResourceOperations} + +Resource operation templates for resources. + +```typespec +interface TypeSpec.Rest.Resource.ResourceOperations +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | +| TError | The error response. | + +#### `ResourceOperations.get` {#TypeSpec.Rest.Resource.ResourceOperations.get} + +Gets an instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceOperations.get(): TResource | TError +``` + +#### `ResourceOperations.update` {#TypeSpec.Rest.Resource.ResourceOperations.update} + +Updates an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceOperations.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TResource | TError +``` + +#### `ResourceOperations.delete` {#TypeSpec.Rest.Resource.ResourceOperations.delete} + +Deletes an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceOperations.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +#### `ResourceOperations.create` {#TypeSpec.Rest.Resource.ResourceOperations.create} + +Creates a new instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceOperations.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TResource | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +#### `ResourceOperations.list` {#TypeSpec.Rest.Resource.ResourceOperations.list} + +Lists all instances of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ResourceRead` {#TypeSpec.Rest.Resource.ResourceRead} + +Represent the resource GET operation. + +```typespec +interface TypeSpec.Rest.Resource.ResourceRead +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | +| TError | The error response. | + +#### `ResourceRead.get` {#TypeSpec.Rest.Resource.ResourceRead.get} + +Gets an instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceRead.get(): TResource | TError +``` + +### `ResourceUpdate` {#TypeSpec.Rest.Resource.ResourceUpdate} + +Resource update operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceUpdate +``` + +#### Template Parameters + +| Name | Description | +| --------- | ----------------------------- | +| TResource | The resource model to update. | +| TError | The error response. | + +#### `ResourceUpdate.update` {#TypeSpec.Rest.Resource.ResourceUpdate.update} + +Updates an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceUpdate.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TResource | TError +``` + +### `SingletonResourceOperations` {#TypeSpec.Rest.Resource.SingletonResourceOperations} + +Singleton resource operation templates for singleton resource instances. + +```typespec +interface TypeSpec.Rest.Resource.SingletonResourceOperations +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TSingleton | The singleton resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `SingletonResourceOperations.get` {#TypeSpec.Rest.Resource.SingletonResourceOperations.get} + +Gets the singleton resource. + +```typespec +op TypeSpec.Rest.Resource.SingletonResourceOperations.get(): TSingleton | TError +``` + +#### `SingletonResourceOperations.update` {#TypeSpec.Rest.Resource.SingletonResourceOperations.update} + +Updates the singleton resource. + +```typespec +op TypeSpec.Rest.Resource.SingletonResourceOperations.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TSingleton | TError +``` + +### `SingletonResourceRead` {#TypeSpec.Rest.Resource.SingletonResourceRead} + +Singleton resource read operation template. + +```typespec +interface TypeSpec.Rest.Resource.SingletonResourceRead +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TSingleton | The singleton resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `SingletonResourceRead.get` {#TypeSpec.Rest.Resource.SingletonResourceRead.get} + +Gets the singleton resource. + +```typespec +op TypeSpec.Rest.Resource.SingletonResourceRead.get(): TSingleton | TError +``` + +### `SingletonResourceUpdate` {#TypeSpec.Rest.Resource.SingletonResourceUpdate} + +Singleton resource update operation template. + +```typespec +interface TypeSpec.Rest.Resource.SingletonResourceUpdate +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TSingleton | The singleton resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `SingletonResourceUpdate.update` {#TypeSpec.Rest.Resource.SingletonResourceUpdate.update} + +Updates the singleton resource. + +```typespec +op TypeSpec.Rest.Resource.SingletonResourceUpdate.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TSingleton | TError +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$action.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$action.md new file mode 100644 index 0000000000..b8c79cde6b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$action.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $action" + +--- +```ts +$action( + context, + entity, + name?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `name`? | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$actionSegment.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$actionSegment.md new file mode 100644 index 0000000000..608e9a438b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$actionSegment.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $actionSegment" + +--- +```ts +$actionSegment( + context, + entity, + name): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `name` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$actionSeparator.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$actionSeparator.md new file mode 100644 index 0000000000..2a8cb0f621 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$actionSeparator.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] $actionSeparator" + +--- +```ts +$actionSeparator( + context, + entity, + separator): void +``` + +`@actionSeparator` defines the separator string that is used to precede the action name + in auto-generated actions. + +`@actionSeparator` can only be applied to model properties, operation parameters, or operations. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` \| `ModelProperty` \| `Operation` | +| `separator` | `"/"` \| `":"` \| `"/:"` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$autoRoute.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$autoRoute.md new file mode 100644 index 0000000000..f379e56a4c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$autoRoute.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $autoRoute" + +--- +```ts +$autoRoute(context, entity): void +``` + +`@autoRoute` enables automatic route generation for an operation or interface. + +When applied to an operation, it automatically generates the operation's route based on path parameter +metadata. When applied to an interface, it causes all operations under that scope to have +auto-generated routes. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Interface` \| `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$collectionAction.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$collectionAction.md new file mode 100644 index 0000000000..a078bb5423 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$collectionAction.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $collectionAction" + +--- +```ts +$collectionAction( + context, + entity, + resourceType, + name?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | +| `name`? | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$copyResourceKeyParameters.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$copyResourceKeyParameters.md new file mode 100644 index 0000000000..1d28121be9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$copyResourceKeyParameters.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $copyResourceKeyParameters" + +--- +```ts +$copyResourceKeyParameters( + context, + entity, + filter?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` | +| `filter`? | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$createsOrReplacesResource.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$createsOrReplacesResource.md new file mode 100644 index 0000000000..aa1451cc01 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$createsOrReplacesResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $createsOrReplacesResource" + +--- +```ts +$createsOrReplacesResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$createsOrUpdatesResource.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$createsOrUpdatesResource.md new file mode 100644 index 0000000000..836b143410 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$createsOrUpdatesResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $createsOrUpdatesResource" + +--- +```ts +$createsOrUpdatesResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$createsResource.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$createsResource.md new file mode 100644 index 0000000000..24c285285c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$createsResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $createsResource" + +--- +```ts +$createsResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$deletesResource.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$deletesResource.md new file mode 100644 index 0000000000..ad1a79193d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$deletesResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $deletesResource" + +--- +```ts +$deletesResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$listsResource.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$listsResource.md new file mode 100644 index 0000000000..27e48d0d07 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$listsResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $listsResource" + +--- +```ts +$listsResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$onValidate.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$onValidate.md new file mode 100644 index 0000000000..df5dda0051 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$onValidate.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] $onValidate" + +--- +```ts +$onValidate(program): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$parentResource.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$parentResource.md new file mode 100644 index 0000000000..e57db3d602 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$parentResource.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] $parentResource" + +--- +```ts +$parentResource( + context, + entity, + parentType): void +``` + +`@parentResource` marks a model with a reference to its parent resource type + +The first argument should be a reference to a model type which will be treated as the parent +type of the target model type. This will cause the `@key` properties of all parent types of +the target type to show up in operations of the `Resource*` interfaces defined in this library. + +`@parentResource` can only be applied to models. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Type` | +| `parentType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$readsResource.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$readsResource.md new file mode 100644 index 0000000000..670763f28f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$readsResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $readsResource" + +--- +```ts +$readsResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$resource.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$resource.md new file mode 100644 index 0000000000..c79bb590b5 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$resource.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] $resource" + +--- +```ts +$resource( + context, + entity, + collectionName): void +``` + +`@resource` marks a model as a resource type. + +The first argument should be the name of the collection that the resources +belong to. For example, a resource type `Widget` might have a collection +name of `widgets`. + +`@resource` can only be applied to models. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` | +| `collectionName` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$resourceLocation.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$resourceLocation.md new file mode 100644 index 0000000000..008d4f2697 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$resourceLocation.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $resourceLocation" + +--- +```ts +$resourceLocation( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$resourceTypeForKeyParam.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$resourceTypeForKeyParam.md new file mode 100644 index 0000000000..8aa67e2a52 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$resourceTypeForKeyParam.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $resourceTypeForKeyParam" + +--- +```ts +$resourceTypeForKeyParam( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Type` | +| `resourceType` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$segment.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$segment.md new file mode 100644 index 0000000000..46b4a3f89c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$segment.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[F] $segment" + +--- +```ts +$segment( + context, + entity, + name): void +``` + +`@segment` defines the preceding path segment for a `@path` parameter in auto-generated routes + +The first argument should be a string that will be inserted into the operation route before the +path parameter's name field. + +`@segment` can only be applied to model properties, operation parameters, or operations. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` \| `ModelProperty` \| `Operation` | +| `name` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$segmentOf.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$segmentOf.md new file mode 100644 index 0000000000..63972a9f8f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$segmentOf.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $segmentOf" + +--- +```ts +$segmentOf( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$updatesResource.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$updatesResource.md new file mode 100644 index 0000000000..c81d7bd331 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/$updatesResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $updatesResource" + +--- +```ts +$updatesResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getAction.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getAction.md new file mode 100644 index 0000000000..094e46508c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getAction.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getAction" + +--- +```ts +getAction(program, operation): string | null | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | + +## Returns + +## Deprecated + +Use getActionDetails instead. diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getActionDetails.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getActionDetails.md new file mode 100644 index 0000000000..e7514c1146 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getActionDetails.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getActionDetails" + +--- +```ts +getActionDetails(program, operation): ActionDetails | undefined +``` + +Gets the ActionDetails for the specified operation if it has previously been marked with @action. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getActionSegment.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getActionSegment.md new file mode 100644 index 0000000000..697444b0bc --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getActionSegment.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getActionSegment" + +--- +```ts +getActionSegment(program, entity): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getActionSeparator.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getActionSeparator.md new file mode 100644 index 0000000000..696b47f937 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getActionSeparator.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getActionSeparator" + +--- +```ts +getActionSeparator(program, entity): string | undefined +``` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | the TypeSpec program | +| `entity` | `Type` | the target entity | + +## Returns + +the action separator string diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getCollectionAction.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getCollectionAction.md new file mode 100644 index 0000000000..875637d6c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getCollectionAction.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getCollectionAction" + +--- +```ts +getCollectionAction(program, operation): string | null | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | + +## Returns + +## Deprecated + +Use getCollectionActionDetails instead. diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getCollectionActionDetails.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getCollectionActionDetails.md new file mode 100644 index 0000000000..f5ff439bf0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getCollectionActionDetails.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getCollectionActionDetails" + +--- +```ts +getCollectionActionDetails(program, operation): ActionDetails | undefined +``` + +Gets the ActionDetails for the specified operation if it has previously been marked with @collectionAction. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getParentResource.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getParentResource.md new file mode 100644 index 0000000000..3cec874c50 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getParentResource.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getParentResource" + +--- +```ts +getParentResource(program, resourceType): Model | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceLocationType.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceLocationType.md new file mode 100644 index 0000000000..59d4ad5148 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceLocationType.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getResourceLocationType" + +--- +```ts +getResourceLocationType(program, entity): Model | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Scalar` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceOperation.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceOperation.md new file mode 100644 index 0000000000..cd7f24bd49 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceOperation.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getResourceOperation" + +--- +```ts +getResourceOperation(program, typespecOperation): ResourceOperation | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `typespecOperation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceTypeForKeyParam.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceTypeForKeyParam.md new file mode 100644 index 0000000000..2c4ecf6200 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceTypeForKeyParam.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getResourceTypeForKeyParam" + +--- +```ts +getResourceTypeForKeyParam(program, param): Model | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `param` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceTypeKey.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceTypeKey.md new file mode 100644 index 0000000000..899bb55b59 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getResourceTypeKey.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getResourceTypeKey" + +--- +```ts +getResourceTypeKey(program, resourceType): ResourceKey | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getSegment.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getSegment.md new file mode 100644 index 0000000000..53465e3684 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/getSegment.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getSegment" + +--- +```ts +getSegment(program, entity): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/isAutoRoute.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/isAutoRoute.md new file mode 100644 index 0000000000..8805220b75 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/isAutoRoute.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isAutoRoute" + +--- +```ts +isAutoRoute(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Interface` \| `Operation` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/isListOperation.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/isListOperation.md new file mode 100644 index 0000000000..5879329c16 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/isListOperation.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] isListOperation" + +--- +```ts +isListOperation(program, target): boolean +``` + +Returns `true` if the given operation is marked as a list operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | the TypeSpec program | +| `target` | `Operation` | the target operation | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/setResourceOperation.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/setResourceOperation.md new file mode 100644 index 0000000000..35e6b99a80 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/setResourceOperation.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] setResourceOperation" + +--- +```ts +setResourceOperation( + context, + entity, + resourceType, + operation): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | +| `operation` | [`ResourceOperations`](../type-aliases/ResourceOperations.md) | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/setResourceTypeKey.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/setResourceTypeKey.md new file mode 100644 index 0000000000..455af87b5e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/functions/setResourceTypeKey.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] setResourceTypeKey" + +--- +```ts +setResourceTypeKey( + program, + resourceType, + keyProperty): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `resourceType` | `Model` | +| `keyProperty` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/index.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/index.md new file mode 100644 index 0000000000..63e09fe11a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/index.md @@ -0,0 +1,61 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Interfaces + +- [ActionDetails](interfaces/ActionDetails.md) +- [AutoRouteOptions](interfaces/AutoRouteOptions.md) +- [FilteredRouteParam](interfaces/FilteredRouteParam.md) +- [ResourceKey](interfaces/ResourceKey.md) +- [ResourceOperation](interfaces/ResourceOperation.md) + +### Type Aliases + +- [ResourceOperations](type-aliases/ResourceOperations.md) + +### Variables + +- [namespace](variables/namespace.md) + +### Functions + +- [$action](functions/$action.md) +- [$actionSegment](functions/$actionSegment.md) +- [$actionSeparator](functions/$actionSeparator.md) +- [$autoRoute](functions/$autoRoute.md) +- [$collectionAction](functions/$collectionAction.md) +- [$copyResourceKeyParameters](functions/$copyResourceKeyParameters.md) +- [$createsOrReplacesResource](functions/$createsOrReplacesResource.md) +- [$createsOrUpdatesResource](functions/$createsOrUpdatesResource.md) +- [$createsResource](functions/$createsResource.md) +- [$deletesResource](functions/$deletesResource.md) +- [$listsResource](functions/$listsResource.md) +- [$onValidate](functions/$onValidate.md) +- [$parentResource](functions/$parentResource.md) +- [$readsResource](functions/$readsResource.md) +- [$resource](functions/$resource.md) +- [$resourceLocation](functions/$resourceLocation.md) +- [$resourceTypeForKeyParam](functions/$resourceTypeForKeyParam.md) +- [$segment](functions/$segment.md) +- [$segmentOf](functions/$segmentOf.md) +- [$updatesResource](functions/$updatesResource.md) +- [getAction](functions/getAction.md) +- [getActionDetails](functions/getActionDetails.md) +- [getActionSegment](functions/getActionSegment.md) +- [getActionSeparator](functions/getActionSeparator.md) +- [getCollectionAction](functions/getCollectionAction.md) +- [getCollectionActionDetails](functions/getCollectionActionDetails.md) +- [getParentResource](functions/getParentResource.md) +- [getResourceLocationType](functions/getResourceLocationType.md) +- [getResourceOperation](functions/getResourceOperation.md) +- [getResourceTypeForKeyParam](functions/getResourceTypeForKeyParam.md) +- [getResourceTypeKey](functions/getResourceTypeKey.md) +- [getSegment](functions/getSegment.md) +- [isAutoRoute](functions/isAutoRoute.md) +- [isListOperation](functions/isListOperation.md) +- [setResourceOperation](functions/setResourceOperation.md) +- [setResourceTypeKey](functions/setResourceTypeKey.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/ActionDetails.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/ActionDetails.md new file mode 100644 index 0000000000..449ba33cf4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/ActionDetails.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] ActionDetails" + +--- +Provides details about an action or collection action. + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `kind` | `"automatic"` \| `"specified"` | Identifies whether the action's name was generated from the original
operation name or if it was explicitly specified. | +| `name` | `string` | The name of the action | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/AutoRouteOptions.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/AutoRouteOptions.md new file mode 100644 index 0000000000..b7d977cb6b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/AutoRouteOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] AutoRouteOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `routeParamFilter?` | (`op`, `param`) => `undefined` \| [`FilteredRouteParam`](FilteredRouteParam.md) | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/FilteredRouteParam.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/FilteredRouteParam.md new file mode 100644 index 0000000000..5fc5a97d34 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/FilteredRouteParam.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] FilteredRouteParam" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `excludeFromOperationParams?` | `boolean` | - | +| `routeParamString?` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/ResourceKey.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/ResourceKey.md new file mode 100644 index 0000000000..7e1ed93dd0 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/ResourceKey.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ResourceKey" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `keyProperty` | `ModelProperty` | - | +| `resourceType` | `Model` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/ResourceOperation.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/ResourceOperation.md new file mode 100644 index 0000000000..87e7f1cfe7 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/interfaces/ResourceOperation.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ResourceOperation" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `operation` | `string` | - | +| `resourceType` | `Model` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/type-aliases/ResourceOperations.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/type-aliases/ResourceOperations.md new file mode 100644 index 0000000000..e8588cc52a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/type-aliases/ResourceOperations.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] ResourceOperations" + +--- +```ts +type ResourceOperations: + | "read" + | "create" + | "createOrReplace" + | "createOrUpdate" + | "update" + | "delete" + | "list"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..014e97e58f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.Rest" = "TypeSpec.Rest"; +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/rest/resource-routing.md b/packages/website-astro/src/content/docs/current/standard-library/rest/resource-routing.md new file mode 100644 index 0000000000..a76d4b6070 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/rest/resource-routing.md @@ -0,0 +1,102 @@ +--- +title: Resource and routes +--- + +# Resources & routes + +Resources are operations that are grouped in a namespace. You declare such a namespace by adding the `@route` decorator to provide the path to that resource: + +```typespec +using TypeSpec.Http; + +@route("/pets") +namespace Pets { + +} +``` + +To define an operation on this resource, you need to provide the HTTP verb for the route using the `@get`, `@head` `@post`, `@put`, `@patch`, or `@delete` decorators. If an HTTP method decorator is not specified then the default is post if there is a body and get otherwise. Lets add an operation to our `Pets` resource: + +```typespec +@route("/pets") +namespace Pets { + op list(): Pet[]; + + // or you could also use + @get op listPets(): Pet[]; +} +``` + +If `@route` is applied to an interface, that route is not "portable". It will be applied to that interface but will not carry over if another interface extends it. + +```typespec +// Operations prepended with /pets +@route("/pets") +interface PetOps { + list(): Pet[] +} + +// Operations will *not* be prepended with /pets +interface MyPetOps extends PetOps { + ... +} +``` + +### Automatic route generation + +Instead of manually specifying routes using the `@route` decorator, you automatically generate routes from operation parameters by applying the `@autoRoute` decorator to an operation or interface containing operations. + +For this to work, an operation's path parameters (those marked with `@path`) must also be marked with +the `@segment` decorator to define the preceding path segment. + +This is especially useful when reusing common parameter sets defined as model types. + +For example: + +```typespec +model CommonParameters { + @path + @segment("tenants") + tenantId: string; + + @path + @segment("users") + userName: string; +} + +@autoRoute +interface UserOperations { + @get + getUser(...CommonParameters): User | Error; + + @put + updateUser(...CommonParameters, user: User): User | Error; +} +``` + +This will result in the following route for both operations + +```text +/tenants/{tenantId}/users/{userName} +``` + +If `@autoRoute` is applied to an interface, it is not "portable". It will be applied to that interface but will not carry over if another interface extends it. + +```typespec +// Operations prepended with /pets +@autoRoute +interface PetOps { + action(@path @segment("pets") id: string): void; +} + +// Operations will *not* be prepended with /pets +interface MyPetOps extends PetOps { + ... +} +``` + +### Customizing Automatic Route Generation + +Instead of manually specifying routes using the `@route` decorator, you automatically generate +routes from operation parameters by applying the `@autoRoute` decorator to an operation, namespace, +or interface containing operations. diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/guide.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/guide.md new file mode 100644 index 0000000000..d3347cd379 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/guide.md @@ -0,0 +1,184 @@ +--- +title: Guide +--- + +## Creating Versioned APIs + +The primary purpose of the TypeSpec.Versioning library is to provide a way to version APIs. Let's start with an unversioned API. + +```typespec +@service({ + title: "Contoso Widget Manager", +}) +namespace Contoso.WidgetManager; +``` + +To make this API versioned, we need to add the `@versioned` decorator to the namespace and declare an enum that identifies the supported versions. + +```typespec +@service({ + title: "Contoso Widget Manager", +}) +@versioned(Contoso.WidgetManager.Versions) +namespace Contoso.WidgetManager; + +enum Versions { + v1, +} +``` + +## Declaring Versioned Dependencies + +Both versioned and unversioned services can declare their dependency on versioned TypeSpec libraries. To declare a dependency on a versioned library, use the `@useDependency` decorator. For unversioned services, this will be declared on the namespace. For versioned services, this will be declared on the versioned enum. + +For example, if our unversioned WidgetManager service has a dependency on the Azure.Core library, we would declare it like this: + +```typespec +@service({ + title: "Contoso Widget Manager Unversioned", +}) +@useDependency(Azure.Core.v1_0_Preview_1) +namespace Contoso.WidgetManager.Unversioned; +``` + +If our versioned WidgetManager service has a dependency on the Azure.Core library, we would declare it like this: + +```typespec +@service({ + title: "Contoso Widget Manager", +}) +@versioned(Contoso.WidgetManager.Versions) +namespace Contoso.WidgetManager; + +enum Versions { + @useDependency(Azure.Core.v1_0_Preview_1) + v1, +} +``` + +Let's assume we add a new version to our service, and it takes advantage of features in a newer version of the Azure.Core library. We can declare that dependency like this: + +```typespec +@service({ + title: "Contoso Widget Manager", +}) +@versioned(Contoso.WidgetManager.Versions) +namespace Contoso.WidgetManager; + +enum Versions { + @useDependency(Azure.Core.v1_0_Preview_1) + v1, + + @useDependency(Azure.Core.v1_0_Preview_2) + v2, +} +``` + +## Versioning APIs + +The versioning library makes it easy to version APIs. Let's start with a simple example. Let's say we have a service that has a single API that returns a list of widgets. We can declare that API like this: + +```typespec +using TypeSpec.Versioning; +using TypeSpec.Rest; +using TypeSpec.Http; + +@service({ + title: "Contoso Widget Manager", +}) +@versioned(Contoso.WidgetManager.Versions) +namespace Contoso.WidgetManager; + +enum Versions { + v1, +} + +@error +model Error { + code: string; + message?: string; +} + +model Widget { + @key + id: string; + + name: string; +} + +op list(): Widget[] | Error; +``` + +Now let's say that in version 2 of the service, we add a get operation to retrieve a single widget. We can add that like this: + +```typespec +enum Versions { + v1, + v2, +} + +model Widget { + @key + id: string; + + name: string; +} + +@route("/widget") +op list(): Widget[] | Error; + +@added(Versions.v2) +@route("/widget/{id}") +op get(...Resource.KeysOf): Widget | Error; +``` + +Now let's say that in version 3 of the service, we realize that `name` is inaccurate and that this field should be called `description`. Also, you +don't always have a description, so you decide it should be optional, not required. We can make these changes like this: + +```typespec +model Widget { + @key + widgetId: string; + + @renamedFrom(Versions.v3, "name") + @madeOptional(Versions.v3) + description?: string; +} +``` + +You can see that we made the change to the actual model property so that it now reflects the correct name and optional nature of the property. Both the +`@renamedFrom` and `@madeOptional` decorators identify the version in which the change was made, and the `@renamedFrom` decorator also identifies the +previous name of the property. This allows us to generate code that is aware of the change and can handle it appropriately. + +The OpenAPI defintion of `Widget` for version 3 reflects the change: + +```yaml +Widget: + type: object + properties: + id: + type: string + description: + type: string + required: + - id +``` + +But the OpenAPI definition for versions 1 and 2 still reflect the original name and required nature of the property: + +```yaml +Widget: + type: object + properties: + id: + type: string + name: + type: string + required: + - id + - name +``` + +This is the common pattern with the versioning decorators. The TypeSpec should reflect the _current state_ of the API. The decorators identify the +version at which this definition became true and, depending on the decorator, the other parameters reflect the preview values in order to preserve +that information. diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/decorators.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/decorators.md new file mode 100644 index 0000000000..a9e9040218 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/decorators.md @@ -0,0 +1,244 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.Versioning + +### `@added` {#@TypeSpec.Versioning.added} + +Identifies when the target was added. + +```typespec +@TypeSpec.Versioning.added(version: EnumMember) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | ------------ | ----------------------------------------- | +| version | `EnumMember` | The version that the target was added in. | + +#### Examples + +```tsp +@added(Versions.v2) +op addedInV2(): void; + +@added(Versions.v2) +model AlsoAddedInV2 {} + +model Foo { + name: string; + + @added(Versions.v3) + addedInV3: string; +} +``` + +### `@madeOptional` {#@TypeSpec.Versioning.madeOptional} + +Identifies when a target was made optional. + +```typespec +@TypeSpec.Versioning.madeOptional(version: EnumMember) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | ------------ | ------------------------------------------------- | +| version | `EnumMember` | The version that the target was made optional in. | + +#### Examples + +```tsp +model Foo { + name: string; + + @madeOptional(Versions.v2) + nickname: string; +} +``` + +### `@removed` {#@TypeSpec.Versioning.removed} + +Identifies when the target was removed. + +```typespec +@TypeSpec.Versioning.removed(version: EnumMember) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | ------------ | ------------------------------------------- | +| version | `EnumMember` | The version that the target was removed in. | + +#### Examples + +```tsp +@removed(Versions.v2) +op removedInV2(): void; + +@removed(Versions.v2) +model AlsoRemovedInV2 {} + +model Foo { + name: string; + + @removed(Versions.v3) + removedInV3: string; +} +``` + +### `@renamedFrom` {#@TypeSpec.Versioning.renamedFrom} + +Identifies when the target has been renamed. + +```typespec +@TypeSpec.Versioning.renamedFrom(version: EnumMember, oldName: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | ----------------------- | ------------------------------------------- | +| version | `EnumMember` | The version that the target was renamed in. | +| oldName | `valueof scalar string` | The previous name of the target. | + +#### Examples + +```tsp +@renamedFrom(Versions.v2, "oldName") +op newName(): void; +``` + +### `@returnTypeChangedFrom` {#@TypeSpec.Versioning.returnTypeChangedFrom} + +Identifies when the target type changed. + +```typespec +@TypeSpec.Versioning.returnTypeChangedFrom(version: EnumMember, oldType: unknown) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------- | --------------------- | -------------------------------------------- | +| version | `EnumMember` | The version that the target type changed in. | +| oldType | `(intrinsic) unknown` | The previous type of the target. | + +### `@typeChangedFrom` {#@TypeSpec.Versioning.typeChangedFrom} + +Identifies when the target type changed. + +```typespec +@TypeSpec.Versioning.typeChangedFrom(version: EnumMember, oldType: unknown) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | --------------------- | -------------------------------------------- | +| version | `EnumMember` | The version that the target type changed in. | +| oldType | `(intrinsic) unknown` | The previous type of the target. | + +### `@useDependency` {#@TypeSpec.Versioning.useDependency} + +Identifies that a namespace or a given versioning enum member relies upon a versioned package. + +```typespec +@TypeSpec.Versioning.useDependency(...versionRecords: EnumMember[]) +``` + +#### Target + +`union EnumMember | Namespace` + +#### Parameters + +| Name | Type | Description | +| -------------- | -------------------- | --------------------------------------------------------------------- | +| versionRecords | `model EnumMember[]` | The dependent library version(s) for the target namespace or version. | + +#### Examples + +##### Select a single version of `MyLib` to use + +```tsp +@useDependency(MyLib.Versions.v1_1) +namespace NonVersionedService; +``` + +##### Select which version of the library match to which version of the service. + +```tsp +@versioned(Versions) +namespace MyService1; +enum Version { + @useDependency(MyLib.Versions.v1_1) // V1 use lib v1_1 + v1, + @useDependency(MyLib.Versions.v1_1) // V2 use lib v1_1 + v2, + @useDependency(MyLib.Versions.v2) // V3 use lib v2 + v3, +} +``` + +### `@versioned` {#@TypeSpec.Versioning.versioned} + +Identifies that the decorated namespace is versioned by the provided enum. + +```typespec +@TypeSpec.Versioning.versioned(versions: Enum) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | ----------------------------------------------- | +| versions | `Enum` | The enum that describes the supported versions. | + +#### Examples + +```tsp +@versioned(Versions) +namespace MyService; +enum Versions { + v1, + v2, + v3, +} +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/index.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/index.md new file mode 100644 index 0000000000..c5bc25693d --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/index.md @@ -0,0 +1,45 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec library for declaring and emitting versioned APIs + +## Install + + + + +```bash +npm install @typespec/versioning +``` + + + + +```bash +npm install --save-peer @typespec/versioning +``` + + + + +## TypeSpec.Versioning + +### Decorators + +- [`@added`](./decorators.md#@TypeSpec.Versioning.added) +- [`@madeOptional`](./decorators.md#@TypeSpec.Versioning.madeOptional) +- [`@removed`](./decorators.md#@TypeSpec.Versioning.removed) +- [`@renamedFrom`](./decorators.md#@TypeSpec.Versioning.renamedFrom) +- [`@returnTypeChangedFrom`](./decorators.md#@TypeSpec.Versioning.returnTypeChangedFrom) +- [`@typeChangedFrom`](./decorators.md#@TypeSpec.Versioning.typeChangedFrom) +- [`@useDependency`](./decorators.md#@TypeSpec.Versioning.useDependency) +- [`@versioned`](./decorators.md#@TypeSpec.Versioning.versioned) diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/classes/VersionMap.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/classes/VersionMap.md new file mode 100644 index 0000000000..b026409955 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/classes/VersionMap.md @@ -0,0 +1,55 @@ +--- +jsApi: true +title: "[C] VersionMap" + +--- +## Constructors + +### new VersionMap(namespace, enumType) + +```ts +new VersionMap(namespace, enumType): VersionMap +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `namespace` | `Namespace` | +| `enumType` | `Enum` | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `private` | `map` | `Map`<`EnumMember`, [`Version`](../interfaces/Version.md)\> | - | + +## Accessors + +### size + +```ts +get size(): number +``` + +## Methods + +### getVersionForEnumMember() + +```ts +getVersionForEnumMember(member): undefined | Version +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `member` | `EnumMember` | + +*** + +### getVersions() + +```ts +getVersions(): Version[] +``` diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/enumerations/Availability.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/enumerations/Availability.md new file mode 100644 index 0000000000..464521f3b6 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/enumerations/Availability.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[E] Availability" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Added` | `"Added"` | +| `Available` | `"Available"` | +| `Removed` | `"Removed"` | +| `Unavailable` | `"Unavailable"` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$added.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$added.md new file mode 100644 index 0000000000..1fdad62384 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$added.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $added" + +--- +```ts +$added( + context, + t, + v): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `t` | `Type` | +| `v` | `EnumMember` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$madeOptional.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$madeOptional.md new file mode 100644 index 0000000000..7decbe579a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$madeOptional.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $madeOptional" + +--- +```ts +$madeOptional( + context, + t, + v): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `t` | `ModelProperty` | +| `v` | `EnumMember` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$onValidate.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$onValidate.md new file mode 100644 index 0000000000..df5dda0051 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$onValidate.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] $onValidate" + +--- +```ts +$onValidate(program): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$removed.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$removed.md new file mode 100644 index 0000000000..a7a031f468 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$removed.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $removed" + +--- +```ts +$removed( + context, + t, + v): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `t` | `Type` | +| `v` | `EnumMember` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$renamedFrom.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$renamedFrom.md new file mode 100644 index 0000000000..363443640e --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$renamedFrom.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $renamedFrom" + +--- +```ts +$renamedFrom( + context, + t, + v, + oldName): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `t` | `Type` | +| `v` | `EnumMember` | +| `oldName` | `string` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$returnTypeChangedFrom.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$returnTypeChangedFrom.md new file mode 100644 index 0000000000..ef23d3f31a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$returnTypeChangedFrom.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $returnTypeChangedFrom" + +--- +```ts +$returnTypeChangedFrom( + context, + op, + v, + oldReturnType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `op` | `Operation` | +| `v` | `EnumMember` | +| `oldReturnType` | `any` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$typeChangedFrom.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$typeChangedFrom.md new file mode 100644 index 0000000000..24b4e25952 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$typeChangedFrom.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $typeChangedFrom" + +--- +```ts +$typeChangedFrom( + context, + prop, + v, + oldType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `prop` | `ModelProperty` | +| `v` | `EnumMember` | +| `oldType` | `any` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$useDependency.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$useDependency.md new file mode 100644 index 0000000000..fc0546cc72 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$useDependency.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $useDependency" + +--- +```ts +$useDependency( + context, + target, ... + versionRecords): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `EnumMember` \| `Namespace` | +| ...`versionRecords` | `EnumMember`[] | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$versioned.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$versioned.md new file mode 100644 index 0000000000..1a260ccab4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/$versioned.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $versioned" + +--- +```ts +$versioned( + context, + t, + versions): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `t` | `Namespace` | +| `versions` | `Enum` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/buildVersionProjections.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/buildVersionProjections.md new file mode 100644 index 0000000000..cd8a640c27 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/buildVersionProjections.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] buildVersionProjections" + +--- +```ts +buildVersionProjections(program, rootNs): VersionProjections[] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `rootNs` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/existsAtVersion.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/existsAtVersion.md new file mode 100644 index 0000000000..0e98a7e3a3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/existsAtVersion.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] existsAtVersion" + +--- +```ts +existsAtVersion( + p, + type, + versionKey): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `type` | `Type` | +| `versionKey` | `ObjectType` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/findVersionedNamespace.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/findVersionedNamespace.md new file mode 100644 index 0000000000..fdf0acd7c1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/findVersionedNamespace.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] findVersionedNamespace" + +--- +```ts +findVersionedNamespace(program, namespace): Namespace | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getAddedOnVersions.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getAddedOnVersions.md new file mode 100644 index 0000000000..9655c1964b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getAddedOnVersions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getAddedOnVersions" + +--- +```ts +getAddedOnVersions(p, t): Version[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getAvailabilityMap.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getAvailabilityMap.md new file mode 100644 index 0000000000..7f972bc15f --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getAvailabilityMap.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getAvailabilityMap" + +--- +```ts +getAvailabilityMap(program, type): Map | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getAvailabilityMapInTimeline.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getAvailabilityMapInTimeline.md new file mode 100644 index 0000000000..9802f6339c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getAvailabilityMapInTimeline.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getAvailabilityMapInTimeline" + +--- +```ts +getAvailabilityMapInTimeline( + program, + type, + timeline): Map | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | +| `timeline` | `VersioningTimeline` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getMadeOptionalOn.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getMadeOptionalOn.md new file mode 100644 index 0000000000..24d90d946c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getMadeOptionalOn.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getMadeOptionalOn" + +--- +```ts +getMadeOptionalOn(p, t): Version | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | + +## Returns + +version when the given type was made optional if applicable. diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getNameAtVersion.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getNameAtVersion.md new file mode 100644 index 0000000000..d170922f5b --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getNameAtVersion.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getNameAtVersion" + +--- +```ts +getNameAtVersion( + p, + t, + versionKey): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | +| `versionKey` | `ObjectType` | + +## Returns + +get old name if applicable. diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getRemovedOnVersions.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getRemovedOnVersions.md new file mode 100644 index 0000000000..12ed5476db --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getRemovedOnVersions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getRemovedOnVersions" + +--- +```ts +getRemovedOnVersions(p, t): Version[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getRenamedFrom.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getRenamedFrom.md new file mode 100644 index 0000000000..3d53fc7ce9 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getRenamedFrom.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getRenamedFrom" + +--- +```ts +getRenamedFrom(p, t): RenamedFrom[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | + +## Returns + +the array of RenamedFrom metadata if applicable. diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getRenamedFromVersions.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getRenamedFromVersions.md new file mode 100644 index 0000000000..1da63f3937 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getRenamedFromVersions.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getRenamedFromVersions" + +--- +```ts +getRenamedFromVersions(p, t): Version[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | + +## Returns + +the list of versions for which this decorator has been applied diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getReturnTypeBeforeVersion.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getReturnTypeBeforeVersion.md new file mode 100644 index 0000000000..abfe677663 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getReturnTypeBeforeVersion.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getReturnTypeBeforeVersion" + +--- +```ts +getReturnTypeBeforeVersion( + p, + t, + versionKey): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | +| `versionKey` | `ObjectType` | + +## Returns + +get old type if applicable. diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getReturnTypeChangedFrom.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getReturnTypeChangedFrom.md new file mode 100644 index 0000000000..aca2124e35 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getReturnTypeChangedFrom.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getReturnTypeChangedFrom" + +--- +```ts +getReturnTypeChangedFrom(p, t): Map | undefined +``` + +Returns the mapping of versions to old return type values, if applicable + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `p` | `Program` | TypeSpec program | +| `t` | `Type` | type to query | + +## Returns + +Map of versions to old types, if any diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getTypeBeforeVersion.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getTypeBeforeVersion.md new file mode 100644 index 0000000000..2be8a03bba --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getTypeBeforeVersion.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getTypeBeforeVersion" + +--- +```ts +getTypeBeforeVersion( + p, + t, + versionKey): Type | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | +| `versionKey` | `ObjectType` | + +## Returns + +get old type if applicable. diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getTypeChangedFrom.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getTypeChangedFrom.md new file mode 100644 index 0000000000..7039315ede --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getTypeChangedFrom.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getTypeChangedFrom" + +--- +```ts +getTypeChangedFrom(p, t): Map | undefined +``` + +Returns the mapping of versions to old type values, if applicable + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `p` | `Program` | TypeSpec program | +| `t` | `Type` | type to query | + +## Returns + +Map of versions to old types, if any diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getUseDependencies.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getUseDependencies.md new file mode 100644 index 0000000000..6fc9813ab1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getUseDependencies.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getUseDependencies" + +--- +```ts +getUseDependencies( + program, + target, + searchEnum): Map | Version> | undefined +``` + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `program` | `Program` | `undefined` | +| `target` | `Enum` \| `Namespace` | `undefined` | +| `searchEnum` | `boolean` | `true` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersion.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersion.md new file mode 100644 index 0000000000..7ba5549b34 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersion.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getVersion" + +--- +```ts +getVersion(program, namespace): VersionMap | undefined +``` + +Get the version map of the namespace. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersionDependencies.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersionDependencies.md new file mode 100644 index 0000000000..60f81f8d17 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersionDependencies.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getVersionDependencies" + +--- +```ts +getVersionDependencies(program, namespace): Map | Version> | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersionForEnumMember.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersionForEnumMember.md new file mode 100644 index 0000000000..124598d405 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersionForEnumMember.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getVersionForEnumMember" + +--- +```ts +getVersionForEnumMember(program, member): Version | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `member` | `EnumMember` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersions.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersions.md new file mode 100644 index 0000000000..c728ea66a4 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getVersions" + +--- +```ts +getVersions(p, t): [Namespace, VersionMap] | [] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersionsForEnum.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersionsForEnum.md new file mode 100644 index 0000000000..f1d43817dd --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/getVersionsForEnum.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getVersionsForEnum" + +--- +```ts +getVersionsForEnum(program, en): [Namespace, VersionMap] | [] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `en` | `Enum` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/hasDifferentNameAtVersion.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/hasDifferentNameAtVersion.md new file mode 100644 index 0000000000..8c00bdee96 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/hasDifferentNameAtVersion.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] hasDifferentNameAtVersion" + +--- +```ts +hasDifferentNameAtVersion( + p, + type, + version): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `type` | `Type` | +| `version` | `ObjectType` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/hasDifferentReturnTypeAtVersion.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/hasDifferentReturnTypeAtVersion.md new file mode 100644 index 0000000000..5621b96796 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/hasDifferentReturnTypeAtVersion.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] hasDifferentReturnTypeAtVersion" + +--- +```ts +hasDifferentReturnTypeAtVersion( + p, + type, + version): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `type` | `Type` | +| `version` | `ObjectType` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/hasDifferentTypeAtVersion.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/hasDifferentTypeAtVersion.md new file mode 100644 index 0000000000..18fcdb6065 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/hasDifferentTypeAtVersion.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] hasDifferentTypeAtVersion" + +--- +```ts +hasDifferentTypeAtVersion( + p, + type, + version): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `type` | `Type` | +| `version` | `ObjectType` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/madeOptionalAfter.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/madeOptionalAfter.md new file mode 100644 index 0000000000..6d79ee513c --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/madeOptionalAfter.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] madeOptionalAfter" + +--- +```ts +madeOptionalAfter( + program, + type, + versionKey): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | +| `versionKey` | `ObjectType` | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/resolveVersions.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/resolveVersions.md new file mode 100644 index 0000000000..20172beec1 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/functions/resolveVersions.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] resolveVersions" + +--- +```ts +resolveVersions(program, rootNs): VersionResolution[] +``` + +Resolve the version to use for all namespace for each of the root namespace versions. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | | +| `rootNs` | `Namespace` | Root namespace. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/index.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/index.md new file mode 100644 index 0000000000..4897908191 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/index.md @@ -0,0 +1,61 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Enumerations + +- [Availability](enumerations/Availability.md) + +### Classes + +- [VersionMap](classes/VersionMap.md) + +### Interfaces + +- [Version](interfaces/Version.md) +- [VersionResolution](interfaces/VersionResolution.md) + +### Variables + +- [namespace](variables/namespace.md) + +### Functions + +- [$added](functions/$added.md) +- [$madeOptional](functions/$madeOptional.md) +- [$onValidate](functions/$onValidate.md) +- [$removed](functions/$removed.md) +- [$renamedFrom](functions/$renamedFrom.md) +- [$returnTypeChangedFrom](functions/$returnTypeChangedFrom.md) +- [$typeChangedFrom](functions/$typeChangedFrom.md) +- [$useDependency](functions/$useDependency.md) +- [$versioned](functions/$versioned.md) +- [buildVersionProjections](functions/buildVersionProjections.md) +- [existsAtVersion](functions/existsAtVersion.md) +- [findVersionedNamespace](functions/findVersionedNamespace.md) +- [getAddedOnVersions](functions/getAddedOnVersions.md) +- [getAvailabilityMap](functions/getAvailabilityMap.md) +- [getAvailabilityMapInTimeline](functions/getAvailabilityMapInTimeline.md) +- [getMadeOptionalOn](functions/getMadeOptionalOn.md) +- [getNameAtVersion](functions/getNameAtVersion.md) +- [getRemovedOnVersions](functions/getRemovedOnVersions.md) +- [getRenamedFrom](functions/getRenamedFrom.md) +- [getRenamedFromVersions](functions/getRenamedFromVersions.md) +- [getReturnTypeBeforeVersion](functions/getReturnTypeBeforeVersion.md) +- [getReturnTypeChangedFrom](functions/getReturnTypeChangedFrom.md) +- [getTypeBeforeVersion](functions/getTypeBeforeVersion.md) +- [getTypeChangedFrom](functions/getTypeChangedFrom.md) +- [getUseDependencies](functions/getUseDependencies.md) +- [getVersion](functions/getVersion.md) +- [getVersionDependencies](functions/getVersionDependencies.md) +- [getVersionForEnumMember](functions/getVersionForEnumMember.md) +- [getVersions](functions/getVersions.md) +- [getVersionsForEnum](functions/getVersionsForEnum.md) +- [hasDifferentNameAtVersion](functions/hasDifferentNameAtVersion.md) +- [hasDifferentReturnTypeAtVersion](functions/hasDifferentReturnTypeAtVersion.md) +- [hasDifferentTypeAtVersion](functions/hasDifferentTypeAtVersion.md) +- [madeOptionalAfter](functions/madeOptionalAfter.md) +- [resolveVersions](functions/resolveVersions.md) diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/interfaces/Version.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/interfaces/Version.md new file mode 100644 index 0000000000..1832bccbeb --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/interfaces/Version.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] Version" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `enumMember` | `EnumMember` | - | +| `index` | `number` | - | +| `name` | `string` | - | +| `namespace` | `Namespace` | - | +| `value` | `string` | - | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/interfaces/VersionResolution.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/interfaces/VersionResolution.md new file mode 100644 index 0000000000..384e3f346a --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/interfaces/VersionResolution.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] VersionResolution" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `rootVersion` | `undefined` \| [`Version`](Version.md) | Version for the root namespace. `undefined` if not versioned. | +| `versions` | `Map`<`Namespace`, [`Version`](Version.md)\> | Resolved version for all the referenced namespaces. | diff --git a/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..9c54508ab3 --- /dev/null +++ b/packages/website-astro/src/content/docs/current/standard-library/versioning/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.Versioning" = "TypeSpec.Versioning"; +``` diff --git a/packages/website-astro/src/content/docs/index.mdx b/packages/website-astro/src/content/docs/index.mdx new file mode 100644 index 0000000000..b37523fefa --- /dev/null +++ b/packages/website-astro/src/content/docs/index.mdx @@ -0,0 +1,6 @@ +--- +title: Welcome to Starlight +description: Get started building your docs site with Starlight. +--- + +[Go to docs](/current/introduction/introduction/) diff --git a/packages/website-astro/src/content/docs/latest/extending-typespec/basics.md b/packages/website-astro/src/content/docs/latest/extending-typespec/basics.md new file mode 100644 index 0000000000..da9bfd2a5b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/extending-typespec/basics.md @@ -0,0 +1,314 @@ +--- +id: basics +title: Creating a TypeSpec Library +--- + +# Creating a TypeSpec library + +TypeSpec libraries are packages that contain TypeSpec types, decorators, emitters, linters, and other bits of reusable code. TypeSpec libraries are [npm packages](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry) with some additional typespec-specific metadata and conventions. The following will show how to establish a new TypeSpec library, add some types to it, and distribute it on the public npm registry. Later sections will cover more details on how to write [decorators](create-decorators.md), [emitters](./emitters-basics.md) and [linters](./linters.md). + +This document assumes you will be using [TypeScript](https://typescriptlang.org) to develop your library, but you should feel free to skip the TypeScript steps if you want to use plain JavaScript. + +## Prerequisites + +You will need both node and npm installed. Additionally, if you intend to develop multiple libraries together, you will likely want to establish a monorepo as this will make developing the libraries in tandem much easier. TypeSpec itself uses [rush.js](https://rushjs.io/). + +## Canonical package structure + +The following is a high level overview of the contents of a TypeSpec package. These files are explained in more detail in the subsequent sections. + +- **dist/index.js** - the main file for your node library +- **lib/main.tsp** - the main file for your TypeSpec types (optional) +- **src/index.ts** - the main file for your node library in TypeScript +- **src/lib.ts** - the TypeSpec library definition file +- **package.json** - metadata about your TypeSpec package + +## Initial setup + +### 1. Initialize your package directory & package.json + +Run the following commands: + +```bash +> mkdir myLibrary +> cd myLibrary +> npm init +``` + +After filling out the wizard, you will have a package.json file that defines your typespec library. + +Unlike node libraries which support CommonJS (cjs), TypeSpec libraries must be Ecmascript Modules. So open your `package.json` and add the following top-level configuration key: + +```json + "type": "module" +``` + +### 2. Install TypeSpec dependencies + +Run the following command: + +```bash +npm install --save-peer @typespec/compiler +``` + +You may have need of other dependencies in the TypeSpec standard library depending on what you are doing. E.g. if you want to use the metadata found in `@typespec/openapi` you will need to install that as well. + +See [dependency section](#defining-dependencies) for information on how to define your dependencies. + +### 2. Define your main files + +Your package.json needs to refer to two main files: your node module main file, and your TypeSpec main. The node module main file is the `"main"` key in your package.json file, and defines the entrypoint for your library when consumed as a node library, and must reference a js file. The TypeSpec main defines the entrypoint for your library when consumed from a TypeSpec program, and may reference either a js file (when your library doesn't contain any typespec types) or a TypeSpec file. + +```json + "main": "dist/index.js", + "tspMain": "lib/main.tsp" +``` + +### 3. Install and initialize TypeScript + +Run the following commands: + +```bash +npm install -D typescript +npx tsc --init --strict +``` + +This will create `tsconfig.json`. But we need to make a couple changes to this. Open `tsconfig.json` and set the following settings: + +```json + "module": "Node16", // This and next setting tells TypeScript to use the new ESM import system to resolve types. + "moduleResolution": "Node16", + "target": "es2019", + "rootDir": "./src", + "outDir": "./dist", +``` + +### 4. Create `lib.ts` + +Open `./src/lib.ts` and create your library definition that registers your library with the TypeSpec compiler and defines any diagnostics your library will emit. Make sure to export the library definition as `$lib`. + +:::warn +If `$lib` is not accessible from your library package (`import {$lib} from "my-library";`) some functionality will be unavailable like validation of emitter options, linter rules, etc. +::: + +The following shows an example: + +```typescript +import { createTypeSpecLibrary } from "@typespec/compiler"; + +export const $lib = createTypeSpecLibrary({ + name: "myLibrary", + diagnostics: {}, +} as const); + +// Optional but convenient, those are meant to be used locally in your library. +export const { reportDiagnostic, createDiagnostic, createStateSymbol } = myLibrary; +``` + +Diagnostics are used for linters and decorators which are covered in subsequent topics. + +### 5. Create `index.ts` + +Open `./src/index.ts` and import your library definition: + +```typescript +// Re-export $lib to the compiler can get access to it and register your library correctly. +export { $lib } from "./lib.js"; +``` + +### 6. Build TypeScript + +TypeSpec can only import JavaScript files, so any time changes are made to TypeScript sources, they need to be compiled before they are visible to TypeSpec. To do so, run `npx tsc -p .` in your library's root directory. You can also run `npx tsc -p --watch` if you would like to re-run the TypeScript compiler whenever files are changed. + +### 7. Add your main TypeSpec file + +Open `./lib/main.tsp` and import your JS entrypoint. This ensures that when typespec imports your library, the code to define the library is run. In later topics when we add decorators, this import will ensure those get exposed as well. + +```typespec +import "../dist/index.js"; +``` + +## Adding TypeSpec types to your library + +Open `./lib/main.tsp` and add any types you want to be available when users import this library. It is also strongly recommended you put these types in a namespace that corresponds with the library name. For example, your `./lib/main.tsp` file might look like: + +```typespec +import "../dist/index.js"; + +namespace MyLibrary; +model Person { + name: string; + age: uint8; +} +``` + +## Defining Dependencies + +Defining dependencies in a TypeSpec library should be following these rules: + +- use `peerDependencies` for all TypeSpec libraries(+ compiler) that you use in your own library/emitter +- use `devDependencies` for the other typespec libraries used only in tests +- use `dependencies`/`devDependencies` for any other packages depending if using in library code or in test/dev scripts + +TypeSpec libraries are defined using `peerDependencies` so we don't end-up with multiple versions of the compiler/library running at the same time. + +**Example** + +```jsonc +{ + "dependencies": { + "yaml": "~2.3.1" // This is a regular package this library/emitter will use + }, + "peerDependencies": { + // Those are all TypeSpec libraries this library/emitter depend on + "@typespec/compiler": "~0.43.0", + "@typespec/http": "~0.43.1", + "@typespec/openapi": "~0.43.0" + }, + "devDependencies": { + // This TypeSpec library is only used in the tests but is not required to use this library. + "@typespec/versioning": "~0.43.0", + // Typescript is only used during development + "typescript": "~5.0.2" + } +} +``` + +## Publishing your TypeSpec library + +To publish to the public npm registry, follow [their documentation](https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages). + +## Importing your TypeSpec library + +Once your TypeSpec library is published, your users can install and use it just like any of the TypeSpec standard libraries. First, they have to install it: + +```bash +npm install $packageName +``` + +Next, they import it into their TypeSpec program and use the namespace (if desired): + +```typespec +import "MyLibrary"; +using MyLibrary; + +model Employee extends Person { + job: string; +} +``` + +## Next steps + +TypeSpec libraries can contain more than just types. Read the subsequent topics for more details on how to write [decorators](./create-decorators.md), [emitters](./emitters-basics.md) and [linters](./linters.md). + +## Testing + +TypeSpec provides a testing framework to help testing libraries. Examples here are shown using `mocha` but any other JS test framework can be used. + +### Define the testing library + +First step is to define how your library can be loaded from the test framework. This will let your library to be reused by other library test. + +1. Create a new file `./src/testing/index.ts` with the following content + +```ts +export const MyTestLibrary = createTestLibrary({ + name: "", + // Set this to the absolute path to the root of the package. (e.g. in this case this file would be compiled to ./dist/src/testing/index.js) + packageRoot: resolvePath(fileURLToPath(import.meta.url), "../../../../"), +}); +``` + +2. Add an `exports` for the `testing` endpoint to `package.json` (update with correct paths) + +```json +{ + // ... + "main": "dist/src/index.js", + "exports": { + ".": "./dist/src/index.js", + "./testing": "./dist/src/testing/index.js" + }, + "typesVersions": { + "*": { + "*": ["./dist/src/index.d.ts"], + "testing": ["./dist/src/testing/index.d.ts"] + } + } +} +``` + +### Define the test host and test runner for your library + +Define some of the test framework base pieces that will be used in the tests. There is 2 functions: + +- `createTestHost`: This is a lower level api that provide a virtual file system. +- `createTestRunner`: This is a wrapper on top of the test host that will automatically add a `main.tsp` file and automatically import libraries. + +Create a new file `test/test-host.js` (change `test` to be your test folder) + +```ts +import { createTestHost, createTestWrapper } from "@typespec/compiler/testing"; +import { RestTestLibrary } from "@typespec/rest/testing"; +import { MyTestLibrary } from "../src/testing/index.js"; + +export async function createMyTestHost() { + return createTestHost({ + libraries: [RestTestLibrary, MyTestLibrary], // Add other libraries you depend on in your tests + }); +} +export async function createMyTestRunner() { + const host = await createOpenAPITestHost(); + return createTestWrapper(host, { autoUsings: ["My"] }); +} +``` + +### Write tests + +After setting up that infrastructure you can start writing tests. + +```ts +import { createMyTestRunner } from "./test-host.js"; + +describe("my library", () => { + let runner: BasicTestRunner; + + beforeEach(async () => { + runner = await createMyTestRunner(); + }); + + // Check everything works fine + it("does this", () => { + const { Foo } = runner.compile(` + @test model Foo {} + `); + strictEqual(Foo.kind, "Model"); + }); + + // Check diagnostics are emitted + it("errors", () => { + const diagnostics = runner.diagnose(` + model Bar {} + `); + expectDiagnostics(diagnostics, { code: "...", message: "..." }); + }); +}); +``` + +#### `@test` decorator + +The `@test` decorator is a decorator loaded in the test environment. It can be used to collect any decorable type. +When using the `compile` method it will return a `Record` which is a map of all the types annoted with the `@test` decorator. + +```ts +const { Foo, CustomName } = runner.compile(` + @test model Foo {} + + model Bar { + @test("CustomName") name: string + } +`); + +Foo; // type of: model Foo {} +CustomName; // type of : Bar.name +``` diff --git a/packages/website-astro/src/content/docs/latest/extending-typespec/create-decorators.md b/packages/website-astro/src/content/docs/latest/extending-typespec/create-decorators.md new file mode 100644 index 0000000000..ac0727e597 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/extending-typespec/create-decorators.md @@ -0,0 +1,209 @@ +--- +id: create-decorators +title: Creating TypeSpec Decorators +--- + +# Creating TypeSpec decorators + +TypeSpec decorator are implemented as JavaScript function. Declarating a decorator can be done in 1 or 2 part: + +1. [(Optional) Declare the decorator signature in typespec](#declaring-a-decorator-signature) +2. [Implement the decorator in Javascript](#implement-the-decorator-in-js) + +## Declaring a decorator signature + +This part is optional but provides great value: + +- Type checking for the parameters +- IDE IntelliSense + +A decorator signature can be declared using the `dec` keyword. As we are implementing the decorator in JS (only choice right now), we must apply the `extern` modifier as well. + +```typespec +extern dec logType(target: unknown, name: string); +``` + +## Decorator target + +The first parameter of the decorator represents the typespec type(s) that the decorator can be applied on. + +You can specify multiple potential target type using an `union expression` + +```typespec +using TypeSpec.Reflection; + +extern dec track(target: Model | Enum); +``` + +### Optional parameters + +A decorator parameter can be marked optional using `?` + +```typespec +extern dec track(target: Model | Enum, name?: valueof string); +``` + +### Rest parameters + +A decorator's last parameter can be prefixed with `...` to collect all the remaining arguments. The type of that parameter must be an `array expression` + +```typespec +extern dec track(target: Model | Enum, ...names: valueof string[]); +``` + +## Ask for a value type + +It is common that decorators parameter will expect a value(e.g. a string or a number). However just using `: string` as the type will also allow a user of the decorator to pass `string` itself or a custom scalar extending string as well as union of strings. +Instead the decorator can use `valueof ` to specify that it is expecting a value of that kind. + +| Example | Description | +| ----------------- | ---------------- | +| `valueof string` | Expect a string | +| `valueof float64` | Expect a float | +| `valueof int32` | Expect a number | +| `valueof boolean` | Expect a boolean | + +```tsp +extern dec tag(target: unknown, value: valueof string); + +// bad +@tag(string) + +// good +@tag("This is the tag name") +``` + +## Implement the decorator in JS + +Decorators can be implemented in JavaScript by prefixing the function name with `$`. A decorator function must have the following parameters: + +- `1`: `context` of type `DecoratorContext` +- `2`: `target` The TypeSpec type target. (`Namespace`, `Interface`, etc.) +- `3+`: Any arguments of the decorators. + +```ts +// model.ts +import type { DecoratorContext, Type } from "@typespec/compiler"; + +export function $logType(context: DecoratorContext, target: Type, name: valueof string) { + console.log(name + ": " + targetType.kind); +} +``` + +or in pure JS + +```ts +// model.js +export function $logType(context, target, name) { + console.log(name + ": " + targetType.kind); +} +``` + +The decorator can then be consumed this way + +```typespec +// main.tsp +import "./model.js"; + +@logType("Dog type") +model Dog { + @logType("Name type") + name: string; +} +``` + +### Decorator parameter marshalling + +For certain TypeSpec types(Literal types) the decorator do not receive the actual type but a marshalled value if the decorator parmaeter type is a `valueof`. This is to simplify the most common cases. + +| TypeSpec Type | Marshalled value in JS | +| ----------------- | ---------------------- | +| `valueof string` | `string` | +| `valueof numeric` | `number` | +| `valueof boolean` | `boolean` | + +for all the other types they are not transformed. + +```ts +export function $tag( + context: DecoratorContext, + target: Type, + stringArg: string, // Here instead of receiving a `StringLiteral` the string value is being sent. + modelArg: Model // Model has no special handling so we receive the Model type +) {} +``` + +### Adding metadata with decorators + +Decorators can be used to register some metadata. For this you can use the `context.program.stateMap` or `context.program.stateSet` to insert data that will be tied to the current execution. + +❌ Do not save the data in a global variable. + +```ts +import type { DecoratorContext, Type } from "@typespec/compiler"; +import type { createStateSymbol } from "./lib.js"; + +// Create a unique key +const key = createStateSymbol("customName"); +export function $customName(context: DecoratorContext, target: Type, name: string) { + // Keep a mapping between the target and a value. + context.program.stateMap(key).set(target, name); + + // Keep an index of a type. + context.program.stateSet(key).add(target); +} +``` + +### Reporting diagnostic on decorator or arguments + +Decorator context provide the `decoratorTarget` and `getArgumentTarget` helpers + +```ts +import type { DecoratorContext, Type } from "@typespec/compiler"; +import type { reportDiagnostic } from "./lib.js"; + +export function $customName(context: DecoratorContext, target: Type, name: string) { + reportDiagnostic({ + code: "custom-name-invalid", + target: context.decoratorTarget, // Get location of @customName decorator in typespec document. + }); + reportDiagnostic({ + code: "bad-name", + target: context.getArgumentTarget(0), // Get location of {name} argument in typespec document. + }); +} +``` + +## Declaration - implementation link + +Decorator signatures are linked to the implementation of the same name in the same namespace + +```typespec +import "./lib.js"; +extern dec customName(target: Type, name: StringLiteral); + +namespace MyLib { + extern dec tableName(target: Type, name: StringLiteral); +} +``` + +is linked the the following in `lib.js` + +```ts +export function $customName(context: DecoratorContext, name: string) {} + +export function $tableName(context: DecoratorContext, name: string) {} +setTypeSpecNamespace("MyLib", $tableName); +``` + +## Troubleshooting + +### Extern declation must have an implementation in JS file + +Potential issues: + +- JS function is not prefixed with `$`. For a decorator called `@decorate` the JS function must be called `$decoratate` +- JS function is not in the same namespace as the the `extern dec` +- Error is only showing in the IDE? Restart the TypeSpec server or the IDE. + +You can use `--trace bind.js.decorator` to log debug information about decorator loading in JS file that should help pinning down which of those is the issue. diff --git a/packages/website-astro/src/content/docs/latest/extending-typespec/diagnostics.md b/packages/website-astro/src/content/docs/latest/extending-typespec/diagnostics.md new file mode 100644 index 0000000000..ef67bd7aa0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/extending-typespec/diagnostics.md @@ -0,0 +1,127 @@ +--- +title: Diagnostics +--- + +TypeSpec compiler report errors and warnings in the spec using the diagnostic API. + +## Best practices + +- ❌ Do not use `throw` to report errors. Any exception thrown like this will be presented as a bug in your library to the user. +- ✅ Use diagnostic API to report expected errors and warnings. + - ✅ Use `reportDiagnostic` in a decorator, `$onValidate` or `$onEmit` + - ❌ Do not use `reportDiagnostic` in an accessor(A function meant to be consumed in another library or emitter). See [collect diagnostics section](#collect-diagnostics) + +## Diagnostic specification + +- Each diagnostic MUST have a `code`. The full code is the the library name followed by the declared code. (`/`) +- Each diagnostic MUST have a `severity`. It can be `error`, `warning`. Errors cannot be suppressed +- Each diagnostics MUST have at least one message. Using `default` as the `messageId` will allow it to be the default selected. +- Each diagnostics message MAY have parameters to interpolate information into the message + +## Usage + +### Declare the diagnostics you are reporting + +```ts +// in lib.js +export const { reportDiagnostic, createDiagnostic, createStateSymbol } = createTypeSpecLibrary({ + name: "@typespec/my-lib", + diagnostics: { + // Basic diagnostic with a fixed message + "no-array": { + severity: "error", + messages: { + default: `Array is not allowed in my-lib models.`, + }, + }, + + // Parameterized message + "duplicate-route": { + severity: "error", + messages: { + default: paramMessage`Route '${"path"}' is being referenced in 2 different operations.`, + }, + }, + + // Multiple messages + "duplicate-name": { + severity: "warning", + messages: { + default: paramMessage`Duplicate type name: '${"value"}'.`, + parameter: paramMessage`Duplicate parameter key: '${"value"}'.`, + }, + }, + }, +} as const); +``` + +This will represent 3 different diagnostics with full name of + +- `@typespec/my-lib/no-array` +- `@typespec/my-lib/duplicate-route` +- `@typespec/my-lib/duplicate-name` + +### Report diagnostics + +```ts +import { reportDiagnostic } from "./lib.js"; + +// Basic diagnostic with a fixed message +reportDiagnostic(program, { + code: "no-array", + target: diagnosticTarget, +}); + +// Parameterized message +reportDiagnostic(program, { + code: "duplicate-route", + format: {path: "/foo"} + target: diagnosticTarget, +}); + +// Multiple messages +reportDiagnostic(program, { + code: "duplicate-name", + messageId: "parmaeter", + format: {value: "$select"}, + target: diagnosticTarget, +}); +``` + +### Collect diagnostics + +When trying to report diagnostic in an accessor a good pattern is not to report the diagnostic to the program directly but return a tuple to let the user decide what to do. +This prevent duplicate diagnostics emitter if the accessor is called multiple times. + +```ts +import { createDiagnosticCollector, Diagnostic } from "@typespec/compiler"; + +function getRoutes(): [Route, readonly Diagnostic] { + const diagnostics = createDiagnosticCollector(); + diagnostics.add( + createDiagnostic(program, { + code: "no-array", + target: diagnosticTarget, + }) + ); + const result = diagnostic.pipe(getParameters()); // to pipe diagnostics returned by `getParameters` + return diagnostics.wrap(routes); +} +``` + +or manually + +```ts +import { Diagnostic } from "@typespec/compiler"; + +function getRoutes(): [Route, readonly Diagnostic] { + const diagnostics = []; + diagnostics.push( + createDiagnostic(program, { + code: "no-array", + target: diagnosticTarget, + }) + ); + return [routes, diagnostics]; +} +``` diff --git a/packages/website-astro/src/content/docs/latest/extending-typespec/emitter-framework.md b/packages/website-astro/src/content/docs/latest/extending-typespec/emitter-framework.md new file mode 100644 index 0000000000..3fa78f5ebc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/extending-typespec/emitter-framework.md @@ -0,0 +1,359 @@ +--- +id: emitter-framework +title: Emitter framework +--- + +The emitter framework makes writing emitters from TypeSpec to other assets a fair bit easier than manually consuming the type graph. The framework gives you an easy way to handle all the types TypeSpec might throw at you and know when you're "feature complete". It also handles a lot of hard problems for you, such as how to construct references between types, how to handle circular references, or how to propagate the context of the types you're emitting based on their containers or where they're referenced from. Lastly, it provides a class-based inheritance model that makes it fairly painless to extend and customize existing emitters. + +## Getting Started + +Make sure to read the getting started section under the [emitter basics](./emitters-basics.md) topic. To use the framework, you will need an emitter library and `$onEmit` function ready to go. + +## Implementing your emitter + +Implementing an emitter using the emitter framework will use a variety of types from the framework. To give you a high level overview, these are: + +- `AssetEmitter`: The asset emitter is the main type you will interact with in your `$onEmit` function. You can pass the asset emitter types to emit, and tell it to write types to disk or give you source files for you to process in other ways. +- `TypeEmitter`: The type emitter is the base class for most of your emit logic. Every TypeSpec type has a corresponding method on TypeEmitter. It also is where you will manage your emit context, making it easy to answer such questions as "is this type inside something I care about" or "was this type referenced from something". +- `CodeTypeEmitter`: A subclass of `TypeEmitter` that makes building source code easier. +- `StringBuilder`, `ObjectBuilder`, `ArrayBuilder`: when implementing your `TypeEmitter` you will likely use these classes to help you build strings and object graphs. These classes take care of handling the placeholders that result from circular references. + +Let's walk through each of these types in turn. + +### `AssetEmitter` + +The asset emitter is responsible for driving the emit process. It has methods for taking TypeSpec types to emit, and maintains the state of your current emit process including the declarations you've accumulated, current emit context, and converting your emitted content into files on disk. + +To create your asset emitter, call `createAssetEmitter` on your emit context in `$onEmit`. It takes the TypeEmitter which is covered in the next section. Once created, you can call `emitProgram()` to emit every type in the TypeSpec graph. Otherwise, you can call `emitType(someType)` to emit specific types instead. + +```typescript +export async function $onEmit(context: EmitContext) { + const assetEmitter = context.createAssetEmitter(MyTypeEmitter); + + // emit my entire typespec program + assetEmitter.emitProgram(); + // or, maybe emit types just in a specific namespace + const ns = context.program.resolveTypeReference("MyNamespace")!; + assetEmitter.emitType(ns); + + // lastly, write your emit output into the output directory + await assetEmitter.writeOutput(); +} +``` + +### `TypeEmitter` + +This is the base class for writing logic to convert TypeSpec types into assets in your target language. Every TypeSpec type has at least one method on this base class, and many have multiple methods. For example, models have both `ModelDeclaration` and `ModelLiteral` methods to handle `model Pet { }` declarations and `{ anonymous: boolean }` literals respectively. + +To support emitting all TypeSpec types, you should expect to implement all of these methods. But if you don't want to support emitting all TypeSpec types, you can either throw or just not implement the method, in which case the type will not be emitted. + +The generic type parameter `T` is the type of emit output you are building. For example, if you're emitting source code, `T` will be `string`. If you're building an object graph like JSON, `T` will be `object`. If your `T` is `string`, i.e. you are building source code, you will probably want to use the `CodeTypeEmitter` subclass which is a bit more convenient, but `TypeEmitter` will also work fine. + +A simple emitter that doesn't do much yet might look like: + +```typescript +class MyCodeEmitter extends CodeTypeEmitter { + modelDeclaration(model: Model, name: string) { + console.log("Emitting a model named", name); + } +} +``` + +Passing this to `createAssetEmitter` and calling `assetEmitter.emitProgram()` will console.log all the models in the program. + +#### EmitterOutput + +Most methods of the `TypeEmitter` must either return `T` or an `EmitterOutput`. There are four kinds of `EmitterOutput`: + +- `Declaration`: A declaration, which has a name and is declared in a scope, and so can be referenced by other emitted types (more on References later). Declarations are created by calling `this.emitter.result.declaration(name, value)` in your emitter methods. Scopes come from your current context, which is covered later in this document. +- `RawCode`: Output that is in some way concatenated into the output but cannot be referenced (e.g. things like type literals). Raw code is created by calling `this.emitter.result.rawCode(value)` in your emitter methods. +- `NoEmit`: The type does not contribute any output. This is created by calling `this.emitter.result.none()` in your emitter methods. +- `CircularEmit`: Indicates that a circular reference was encountered, which is generally handled by the framework with Placeholders (see the next section). You do not need to create this result yourself, the framework will produce this when required. + +When an emitter returns `T` or a `Placeholder`, it behaves as if it returned `RawCode` with that value. + +To create these results, you use the `result.*()` APIs on `AssetEmitter`, which can be accessed via `this.emitter.result` in your methods. + +With this in mind, we can make `MyCodeEmitter` a bit more functional: + +```typescript +class MyCodeEmitter extends CodeTypeEmitter { + // context and scope are covered later in this document + programContext(program: Program): Context { + const sourceFile = this.emitter.createSourceFile("test.txt"); + return { + scope: sourceFile.globalScope, + }; + } + + modelDeclaration(model: Model, name: string) { + const props = this.emitter.emitModelProperties(model); + return this.emitter.result.declaration(name, `declaration of ${name}`); + } +} +``` + +If we have a typespec program that looks like: + +```typespec +model Pet {} +``` + +and we call `assetEmitter.writeOutput()`, we'll find `test.txt` contains the contents `"declaration of Pet"`. + +In order to emit properties of `Pet`, we'll need to concatenate the properties of pets with the declaration we made and leverage builders to make that easy. These topics are covered in the next two sections. + +#### Concatenating results + +It is very rare that you only want to emit a declaration and nothing else. Probably your declaration will have various parts to it, and those parts will depend on the emit output of the parts of the type your emitting. For example, a declaration from a TypeSpec model will likely include members based on the members declared in the TypeSpec. + +This is accomplished by calling `emit` or other `emit*` methods on the asset emitter from inside your `AssetEmitter` methods. For example, to emit the properties of a model declaration, we can call `this.emitter.emitModelProperties(model)`. This will invoke your the corresponding `AssetEmitter` method and return you the `EmitterOutput` result. + +It is unlikely that you want to concatenate this result directly. For declarations and raw code, the `value` property is likely what you're interested in, but there are other complexities as well. So in order to concatenate results together, you probably want to use a builder. + +#### Builders + +Builders are helpers that make it easy to concatenate output into your final emitted asset. They do two things of note: they handle extracting the value from `Declaration` and `rawCode` output, and they handle `Placeholder` values that crop up due to circular references. Three `builders` are provided: + +- Strings: Using the `code` template literal tag, you can concatenate `EmitterOutput`s together into a final string. +- Object: Constructing an `ObjectBuilder` with an object will replace any `EmitterOutput` in the object with its value and handle placeholders as necessary. +- Array: Constructing an `ArrayBuilder` will let you push `EmitterOutput` and pull out the value and placeholders as necessary. + +Now with these tools, we can make `MyCodeEmitter` even more functional: + +```typescript +class MyCodeEmitter extends CodeTypeEmitter { + // context is covered later in this document + programContext(program: Program): Context { + const sourceFile = this.emitter.createSourceFile("test.txt"); + return { + scope: sourceFile.globalScope, + }; + } + + modelDeclaration(model: Model, name: string) { + const props = this.emitter.emitModelProperties(model); + return this.emitter.result.declaration(name, code`declaration of ${name} with ${props}`); + } + + modelPropertyLiteral(property: ModelProperty): EmitterOutput { + return code`a property named ${property.name} and a type of ${this.emitter.emitType( + property.type + )}`; + } + + modelLiteral(model: Model) { + return `an object literal`; + } +} +``` + +Now given a typespec program like: + +```typespec +model Pet { + position: {}; +} +``` + +we will find `test.txt` contains the output + +> declaration of Pet with a property named position and a type of an object literal + +#### References between emitted types + +A common scenario when emitting to most targets is handling how to make references between types. This can get pretty complex, especially when the declarations are emitted into different scopes. The emitter framework does a lot of heavy lifting for you by calculating the scopes between your current context and the declaration you're trying to reference. + +How declarations arrive in different scopes is covered in the Context section later in this document. + +Let's look at the `reference` signature on the TypeEmitter: + +```typescript + reference( + targetDeclaration: Declaration, + pathUp: Scope[], + pathDown: Scope[], + commonScope: Scope | null + ): string | EmitEntity {} +``` + +The `reference` function is called with: + +- `targetDeclaration`: The declaration we're making a reference to. +- `pathUp`: The scopes between our current scope and the common scope. +- `pathDown`: The scopes between the common scope and the declaration we're referencing. +- `commonScope`: The nearest scope shared between our current scope and the target declaration. + +So let's imagine we have declarations under the following scopes: + +``` +source file + namespace A + namespace B + model M1 + namespace C + model M2 +``` + +If M1 references M2, `reference` will be called with the following arguments: + +- `targetDeclaration`: M2 +- `pathUp`: [namespace B, namespace A] +- `pathDown`: [namespace C] +- `commonScope`: source file + +For languages which walk up a scope chain in order to find a reference (e.g. TypeScript, C#, Java, etc.), you generally won't need `pathUp`, you can just join the scopes in the `pathDown` resulting in a reference like `C.M2`. Other times you may need to construct a more path-like reference, in which case you can emit for example a `../` for every item in `pathUp`, resulting in a reference like `../../C/M2`. + +When the declarations don't share any scope, `commonScope` will be null. This happens when the types are contained in different source files. In such cases, your emitter will likely need to import the target declaration's source file in addition to constructing a reference. The source file has an `imports` property that can hold a list of such imports. + +We can update our example emitter to generate references by adding an appropriate `references` method: + +```typescript +class MyCodeEmitter extends CodeTypeEmitter { + // snip out the methods we implemented previously + + // If the model is Person, put it into a special namespace. + // We will return to this in detail in the next section. + modelDeclarationContext(model: Model, name: string): Context { + if (model.name === "Person") { + const parentScope = this.emitter.getContext().scope; + const scope = this.emitter.createScope({}, "Namespace", parentScope); + + return { + scope, + }; + } else { + return {}; + } + } + + reference( + targetDeclaration: Declaration, + pathUp: Scope[], + pathDown: Scope[], + commonScope: Scope | null + ): string | EmitEntity { + const segments = pathDown.map((s) => s.name); + segments.push(targetDeclaration.name); + + return `a reference to ${segments.join(".")}`; + } +} +``` + +Now if we emit the following TypeSpec program: + +```typespec +model Pet { + person: Person; +} + +model Person { + pet: Pet; +} +``` + +We will find that `test.txt` contains the following text: + +> declaration of Pet with a property named person and a type of a reference to Namespace.Person + +#### Placeholders + +Consider the following TypeSpec program: + +```typespec +model Pet { + owner: Person; +} + +model Person { + pet: Pet; +} +``` + +In order to emit `Pet`, we need to emit `Person`, so we go to emit that. But in order to emit `Person`, we need to emit `Pet`, which is what we're already trying to do! We're at an impasse. This is a circular reference. + +The emitter framework handles circular references via `Placeholder`s. When a circular reference is encountered, the `value` of an `EmitterOutput` is set to a placeholder that is filled in when we've finished constructing the thing we referenced. So in the case above, when emitting `Person` and we come across the circular reference to `Pet`, we'll return a `Placeholder`. We'll then come back to `Pet`, finish it and return an `EmitterOutput` for it, and then set any `Placeholder`s waiting for `Pet` to that output. + +If you're using the `Builder`s that come with the framework, you will not need to worry about dealing with `Placeholder` yourself. + +#### Context + +A common need when emitting TypeSpec is to know what context you are emitting the type in. There is one piece of required context: `scope`, which tells the emitter framework where you want to place your declarations. But you might also want to easily answer questions like: am I emitting a model inside a particular namespace? Or am I emitting a model that is referenced from the return type of an operation? The emitter framework makes managing this context fairly trivial. + +Every method that results in an `EmitterOutput` has a corresponding method for setting lexical and reference context. We saw this above when we created `modelDeclarationContext` in order to put some models into a different namespace. + +##### Lexical Context + +Lexical context is available when emitting types that are lexically contained within the emitted entity in the source TypeSpec. For example, if we set `modelDeclarationContext`, that context will be visible when emitting the model's properties and any nested model literals. + +##### Reference Context + +Reference context is passed along when making references and otherwise propagates lexically. For example, if we set `modelDeclarationReferenceContext`, that context will be visible when emitting the model's properties and any nested model literals just like with lexical context. But unlike with lexical context, if the current model references another type, then the reference context will be visible when emitting the referenced model. + +Note that this means that we may emit the same model multiple times. Consider the following TypeSpec program: + +```typespec +model Pet {} +model Person { + pet: Pet; +} +``` + +If, when emitting Person, we set the reference context to `{ refByPerson: true }`, we will call `emitModel` for `Pet` twice, once with no context set, and once again with the context we set when emitting `Person`. This behavior is very handy when you want to emit the same model different ways depending on how it is used, e.g. when your emit differs whether a model is an input type or output type, or when a model's properties differ based on any `@visibility` decorators and the context the model appears in (e.g. for Resources, whether it's being read, updated, created, deleted, etc.). + +#### Scope + +The scope that declarations are created in is set in using context. When emitting all of your TypeSpec program into the same file, and not emitting types into any kind of namespace, it suffices to set scope once in `programContext`. Call `this.emitter.createSourceFile("filePath.txt")` to create a source file, which comes with a scope ready to use. + +To emit into different source files, e.g. if we want to emit using a "one class per file" pattern, move the into a more granular context method. For example, if we instead create source files in `modelDeclarationContext`, then declarations for each model will be in their own file. + +If we want to emit into namespaces under a source file, we can create scopes manually. Call `this.emitter.createScope(objectReference, name, parentScope)`. The `objectReference` is an object with metadata about the scope. You might use this to emit e.g. a namespace declaration in your target language, but often it can just be an empty object (`{}`). Name is the name of the scope, used when constructing references. And parent scope is the scope this is found under. + +Lets return to our previous example: + +```typescript + modelDeclarationContext(model: Model, name: string): Context { + if (model.name === "Person") { + const parentScope = this.emitter.getContext().scope; + const scope = this.emitter.createScope({}, "Namespace", parentScope); + + return { + scope, + }; + } else { + return {}; + } + } +``` + +We can now see how this results in the `Person` model being located in a nested scope - because we set `scope` on the context to a new scope we created via `this.emitter.setScope`. + +### Extending `TypeEmitter` + +TypeEmitters are classes and explicitly support subclassing, so you can customize an existing emitter by extending it and overriding any methods you want to customize in your subclass. In fact, emitters you find out in the ecosystem are likely not to work without creating a subclass, because they only know how to emit types, but you need to provide the scope for any declarations it wants to create. For example, if we have a base `TypeScriptEmitter` that can convert TypeSpec into TypeScript, we might extend it to tell it to put all declarations in the same file: + +```typescript +class MyTsEmitter extends TypeScriptEmitter { + programContext(program: Program): Context { + const sourceFile = this.emitter.createSourceFile("test.txt"); + return { + scope: sourceFile.globalScope, + }; + } +} +``` + +Or, if we want one class or interface per file, we might instead do something like: + +```typescript +class MyTsEmitter extends TypeScriptEmitter { + modelDeclarationContext(program: Program): Context { + const sourceFile = this.emitter.createSourceFile("test.txt"); + return { + scope: sourceFile.globalScope, + }; + } + // and similar for other declarations: Unions, Enums, Interfaces, and Operations. +} +``` diff --git a/packages/website-astro/src/content/docs/latest/extending-typespec/emitter-metadata-handling.md b/packages/website-astro/src/content/docs/latest/extending-typespec/emitter-metadata-handling.md new file mode 100644 index 0000000000..e06e888323 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/extending-typespec/emitter-metadata-handling.md @@ -0,0 +1,38 @@ +--- +id: emitter-metadata-handling +title: Handling metadata and visibility in emitters for REST API +--- + +# Handling metadata and visibility in emitters for REST API + +It's important that all emitters for REST API handle [automatic visibility](../standard-library/http/operations.md#automatic-visibility) and [metadata](../standard-library/http/operations.md#metadata) consistently. Make sure to read through the TypeSpec-author documentation of these features to understand how they work. This document will cover how to incorporate them correctly into your own emitter. + +The standard `@typespec/rest` library provides JavaScript API for emitters to interpret API written using its decorators. We'll look at the API that are particularly relevant to these features. + +Note that when we say that emitters must handle things consistently, we mean that they must agree on how data is sent and received over the wire. After all, a TypeSpec _specification_ must be able to serve as a source-of-truth on these details. Nevertheless, emitters are still free to _abstract_ things above this level and to make different choices in doing so. For example, the OpenAPI emitter will sometimes split a single TypeSpec model into multiple suffixed schemas with names like `UserCreate` and `UserUpdate` while a client SDK emitter may choose to emit a single `User` class that that can be serialized to a request or deserialized from a response with different fields present in different cases. In fact, these features were designed specifically to allow a TypeSpec specification to be written in terms of logical entities that emitters could then preserve. + +## Getting started + +If you haven't written an emitter before, start with [emitter basics](./emitters-basics.md). + +Then look at the [REST metadata emitter sample](https://github.com/microsoft/typespec/tree/main/packages/samples/rest-metadata-emitter). This emitter sample uses all of the API discussed below to write out a simple textual representation. It deliberately does not split types like the OpenAPI emitter in order to emphasize that this is not required. Instead, it adds contextual remarks to denote how data depends on context. + +However, if your emitter does want to split types as OpenAPI does, then it will still use the same API. Cross-referencing with where the official [OpenAPI emitter] calls these API can also be instructive. + +## Key API + +These are the main API involved in handling these features. See the linked API reference documentation for more details. + +- [`getRequestVisibility(HttpVerb): Visibility`](../standard-library/http/reference/js-api/index.md#getrequestvisibility) - Use this to determine the visibility implied for data in the request parameters or body. Also note that [`Visibility.Read`](../standard-library/http/reference/js-api/enumerations/Visibility.md#item) is always applied for response data and therefore there is no corresponding API for the response. + +- [`MetadataInfo`](../standard-library/http/reference/js-api/interfaces/MetadataInfo.md) - Create this once for each program using [`createMetadataInfo(Program, MetadataInfoOptions)`](../standard-library/http/reference/js-api/index.md#createmetadatainfo) then use it to reason about metadata and visibility implications with the API below. + +- [`MetadataInfo.getEffectivePayloadType(Type, Visibility): Type`](../standard-library/http/reference/js-api/interfaces/MetadataInfo.md#geteffectivepayloadtype) - Use this recursively on every type that is referenced. When given an anonymous model sourced entirely from a single named model after metadata is moved elsewhere or invisible properties are removed, it will recover the named model. This handles the commonly discussed case of seeing that `op something(...Thing)` receives a `Thing` in its request body, but also many other cases.. + +- [`MetadataInfo.isTransformed(Model, Visibility)`](../standard-library/http/reference/js-api/interfaces/MetadataInfo.md#istransformed) - Use this to check if a type undergoes any changes in shape due to visibility or metadata. If not, this can allow for simplifications in emit. + +- [`MetadataInfo.isPayloadProperty(ModelProperty, Visibility): boolean`](../standard-library/http/reference/js-api/interfaces/MetadataInfo.md#ispayloadproperty) - Use this to check if a property is transmitted as an object property in the payload and is not invisible or metadata sent elsewhere. + +- [`MetadataInfo.isOptional(ModelProperty, Visibility): boolean`](../standard-library/http/reference/js-api/interfaces/MetadataInfo.md#isoptional) - Use this to determine if a property is optional for the given visibility. This will differ from `ModelProperty.isOptional` when the Visibility is Update in which case the property is always considered optional. + +- [`Visibility.Item`](../standard-library/http/reference/js-api/enumerations/Visibility.md#item) - Add this flag when recursing into an array. This moves all metadata into the payload, which can be useful in scenarios like batching API calls. diff --git a/packages/website-astro/src/content/docs/latest/extending-typespec/emitters-basics.md b/packages/website-astro/src/content/docs/latest/extending-typespec/emitters-basics.md new file mode 100644 index 0000000000..68c629270d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/extending-typespec/emitters-basics.md @@ -0,0 +1,231 @@ +--- +id: emitters +title: Emitters +--- + +# Writing emitters + +TypeSpec emitters are libraries that use various TypeSpec compiler APIs to reflect on the typespec compilation and produce generated artifacts. The typespec standard library includes an emitter for OpenAPI version 3.0, but odds are good you will want to emit TypeSpec to another output format. In fact, one of TypeSpec's main benefits is how easy it is to use TypeSpec as a source of truth for all data shapes, and the ease of writing an emitter is a big part of that story. + +## Getting started + +TypeSpec emitters are a special kind of TypeSpec library and so have the same getting started instructions. Follow [these steps](#todo) to initialize a typespec library. + +## $onEmit + +A TypeSpec emitter exports a function named `$onEmit` from its main entrypoint. It receives two arguments: + +- _context_: The current context including the current progfam being compiled +- _options_: Custom configuration options selected for this emitter + +For example, the following will write a text file to the output directory: + +```typescript +import { EmitContext } from "@typespec/compiler"; +import Path from "path"; + +export async function $onEmit(context: EmitContext) { + const outputDir = Path.join(context.emitterOutputDir, "hello.txt"); + await context.program.host.writeFile(outputDir, "hello world!"); +} +``` + +You can now compile a TypeSpec program passing your library name to --emit, or add it to your `tspconfig.yaml`. + +### Custom configuration options + +To pass your emitter custom options, the options must be registered with the compiler by setting `emitter.options` in your library definition to the JSON schema for the options you want to take. The compiler has a helper to make this easier: + +- _JSONSchemaType_: Takes a TypeScript interface and returns a type that helps you fill in the JSON schema for that type. + +The following example extends the hello world emitter to be configured with a name: + +```typescript +import { JSONSchemaType, createTypeSpecLibrary } from "@typespec/compiler"; +import Path from "path"; + +export interface EmitterOptions { + "target-name": string; +} + +const EmitterOptionsSchema: JSONSchemaType = { + type: "object", + additionalProperties: false, + properties: { + "target-name": { type: "string", nullable: true }, + }, + required: [], +}; + +export const $lib = createTypeSpecLibrary({ + name: "MyEmitter", + diagnostics: {}, + emitter: { + options: EmitterOptionsSchema, + }, +}); + +export async function $onEmit(context: EmitContext) { + const outputDir = Path.join(context.emitterOutputDir, "hello.txt"); + const name = context.options.targetName; + await context.program.host.writeFile(outputDir, `hello ${name}!`); +} +``` + +### Configuration options convention + +- Name options `kebab-case`. So it can be inline with the rest of the cli +- An option called `output-dir` can be created and should override the compiler `output-dir` + +#### Emitter options vs. decorators + +The general guideline is to use a decorator when the customization is intrinsic to the API itself. In other words, when all uses of the TypeSpec program would use the same configuration. This is not the case for `outputFilename` because different users of the API might want to emit the files in different locations depending on how their code generation pipeline is set up. + +## Emitting TypeSpec types to assets on disk + +One of the main tasks of an emitter is finding types to emit. There are three main approaches: + +1. The [emitter framework](./emitter-framework.md), which makes it relatively easy to emit all your TypeSpec types (or a subset, if you wish). +1. The Semantic Walker, which lets you easily run code for every type in the program +1. Custom traversal, which gives you a lot more flexibility than either of the previous approaches at the cost of some complexity. + +### Emitter Framework + +The emitter framework provides handles a lot of hard problems for you while providing an easy-to-use API to convert your TypeSpec into source code or other object graphs. Visit the [emitter framework](./emitter-framework.md) page to learn more. + +### Semantic Walker + +The Semantic Walker will visit every type in the TypeSpec program and call any callbacks you provide for that type. To use, import `navigateProgram` from `@typespec/compiler`. Starting a walk needs two parameters - the program to walk, and an object with callbacks for each type. For example, if we want to do something for every model in the program, we could do the following in our `$onEmit` function: + +```typescript +navigateProgram(program, { + model(m) { + // emit m + }, +}); +``` + +You can provide a callback for every kind of TypeSpec type. The walker will call your callback pre-order, i.e. as soon as it sees a type for the first time it will invoke your callback. You can invoke callback post-order instead by prefixing the type name with `exit`, for example `exitModel(m)`. + +Note that the semantic walker will visit all types in the program including built-in TypeSpec types and typespec types defined by any libraries you're using. Care must be taken to filter out any types you do not intend to emit. Sometimes this is quite difficult, so a custom traversal may be easier. + +### Custom traversal + +Often times you will want to emit specific types, for example types that have a particular decorator or are in a particular namespace. In such cases it is often easier to write a custom traversal to find and emit those types. Once you have a type, you can access its [various fields](#todo) to and emit those types as well if needed. + +For example, let's say we want to emit a text file of model names but only if it has an `@emitThis` decorator. We could filter out such models in the Semantic Walker `model` callback, but it is more efficient to implement `@emitThis` such that it keeps a list of all the types its attached to and iterate that list. We can then traverse into types it references if needed. + +The following example will emit models with the `@emitThis` decorator and also any models referenced by that model. + +[See creating decorator documentation for more details](./create-decorators.md) + +```typescript +import { DecoratorContext, Model, createStateSymbol } from "@typespec/compiler"; + +// Decorator Setup Code + +const emitThisKey = createStateSymbol("emitThis"); + +// @emitThis decorator +export function $emitThis(context: DecoratorContext, target: Model) { + context.program.stateSet(emitThisKey).add(target); +} + +export async function $onEmit(context: EmitContext) { + for (const model of program.stateSet(emitThisKey)) { + emitModel(model); + } +} + +function emitModel(model: Model) { + // emit this model + for (const prop of model.properties.values()) { + // recursively emit models referenced by the parent model + emitModel(prop.type); + } +} +``` + +### Resolving a typespec type + +Sometimes you might want to get access to a known TypeSpec type in the type graph, for example a model that you have defined in your library. + +A helper is provided on the program to do that. + +```ts +program.resolveTypeReference(reference: string): Type | undefined; +``` + +The reference must be a valid typespec reference(Like you would have it in a typespec document) + +**Example** + +```ts +program.resolveTypeReference("TypeSpec.string"); // Resolve typespec string intrinsic type +program.resolveTypeReference("MyOrg.MyLibrary.MyEnum"); // Resolve `MyEnum` defined in `MyOrg.MyLibrary` namespace. +``` + +Error example + +```ts +program.resolveTypeReference("UnknownModel"); // Resolve `[undefined, diagnostics]` where diagnostics is an array of diagnostic explaining why reference is invalid. +program.resolveTypeReference("model Foo {}"); // Resolve `[undefined, diagnostics]` where diagnostics is an array of diagnostic explaining why reference is invalid. +``` + +## Emitting files to disk + +Since an emitter is a node library, you could use standard `fs` APIs to write files. However, this approach has a drawback - your emitter will not work in the browser, and will not work with the test framework that depends on storing emitted files in an in-memory file system. + +Instead, use the compiler [`host` interface](#todo) to access the file system. The API is equivalent to the node API but works in a wider range of scenarios. + +In order to know where to emit files, the emitter context has a `emitterOutputDir` property that is automatically resolved using the `emitter-output-dir` built-in emitter options. This is set to `{cwd}/tsp-output/{emitter-name}` by default, but can be overridden by the user. Do not use the `compilerOptions.outputDir` + +## Handling scalars + +Scalars are types in TypeSpec that most likely have a primitive or built-in datastructure representing those in the target language. + +Recommended logic for emitting scalar is to: + +1. If scalar is a known scalar(e.g. `int32`), emit the known mapping. +2. Otherwise check scalar `baseScalar` and go back to `1.` + 2.1 After resolving which scalar apply any decorators + +:::note +If the scalar is generic and doesn't have a mapping (e.g. integer), we recommend substituting it with the next closest mapping (e.g. integer->int64) and emitting a warning. +::: + +### Examples + +```tsp +@minValue(10) +scalar myInt32 extends int32; + +@minValue(20) +scalar specializedInt32 extends myInt32; +``` + +| Scalar | Expected type | Description | +| ------------------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| `int16` | `int16` | Simple case, emitter can know it is an int16 | +| `myInt32` | `int32` | Emitter doesn't know what myInt32 is. Check baseScalar, sees it is an int32, applies minValue decorator. | +| `specializedInt32` | `int32` | Emitter doesn't know what specializedInt32 is. Check baseScalar, finds myInt32 knows that it is an int32 now and applies minValue override. | +| `float` | `float64` | Emitter knows float but doesn't have a mapping. Emit `float64` and a warning. | + +## Handling Default Values + +Several TypeSpec types have a `default` property that can be used to specify a default value. For example, the following model has a default value of `true` for the `isActive` property: + +```tsp +model User { + isActive?: boolean = true; +} +``` + +These values can be accessed in the emitter using the `default` property on the `ModelProperty` type. + +```ts +const modelProp: ModelProperty = ...; // the isActive ModelProperty type +const defaultValue = modelProp.default; // value: true +``` + +It is important that emitters handle default values in a consistent way. Default values SHOULD NOT be used as client-side default values. Instead, they should be used as a way to specify a default value for the server-side implementation. For example, if a model property has a default value of `true`, the server-side implementation should use that value if the client does not provide a value. Default values SHOULD be expressed in documentation to properly communicate the service-side default. diff --git a/packages/website-astro/src/content/docs/latest/extending-typespec/linters.md b/packages/website-astro/src/content/docs/latest/extending-typespec/linters.md new file mode 100644 index 0000000000..c60191409b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/extending-typespec/linters.md @@ -0,0 +1,159 @@ +--- +id: linters +title: Linters +--- + +# Linters + +## Linter vs `onValidate` + +TypeSpec library can probide a `$onValidate` hook which can be used to validate the typespec program is valid in the eye of your library. + +A linter on the other hand might be a validation that is optional, the program is correct but there could be some improvements. For example requiring documentation on every type. This is not something that is needed to represent the typespec program but without it the end user experience might suffer. +Linters need to be explicitly enabled. `$onValidate` will be run automatically if that library is imported. + +## Writing a linter + +See examples in `packages/best-practices`. + +### 1. Define a rules + +```ts +import { createLinterRule } from "@typespec/compiler"; +import { reportDiagnostic } from "../lib.js"; + +export const requiredDocRule = createLinterRule({ + name: "no-model-doc", + severity: "warning", + // Short description of what this linter rule does. To be used for generated summary of a linter. + description: "Enforce documentation on models.", + messages: { + default: `Must be documented.`, + // Different messages can be provided + models: `Models must be documented.`, + + // Message can be parameterized + enums: paramMessage`Enum ${"enumName"} must be documented.`, + }, + create(context) { + return { + operation: (op) => { + if (!getDoc(context.program, op)) { + context.reportDiagnostic({ + target: model, + }); + } + }, + model: (model) => { + if (!getDoc(context.program, model)) { + context.reportDiagnostic({ + messageId: "models", + target: model, + }); + } + }, + enums: (type) => { + if (!getDoc(context.program, type)) { + context.reportDiagnostic({ + messageId: "enums", + format: {enumName: type.name} + target: model, + }); + } + }, + }; + }, +}); +``` + +#### Don'ts + +- ❌ Do not call `program.reportDiagnostic` or your library `reportDiagnostic` helper directly in a linter rule + +```ts +// ❌ Bad +program.reportDiagnostic({ + code: "other-code", + target, +}); +// ❌ Bad +reportDiagnostic(program, { + code: "other-code", + target, +}); + +// ✅ Good +context.reportDiagnostic({ + target, +}); +``` + +### Register the rules + + + +When defining your `$lib` with `createTypeSpecLibrary`([See](./basics.md#4-create-libts)) an additional entry for `linter` can be provided + +```ts +// Import the rule defined previously +import { requiredDocRule } from "./rules/required-doc.rule.js"; + +export const $lib = createTypeSpecLibrary({ + name: "@typespec/my-linter", + diagnostics: {}, + linter: { + // Include all the rules your linter is defining here. + rules: [requiredDocRule], + + // Optionally a linter can provide a set of rulesets + ruleSets: { + recommended: { + // (optional) A ruleset takes a map of rules to explicitly enable + enable: { [`@typespec/my-linter/${requiredDocRule.name}`]: true }, + + // (optional) A rule set can extend another rule set + extends: ["@typespec/best-practices/recommended"], + + // (optional) A rule set can disable a rule enabled in a ruleset it extended. + disable: { + "`@typespec/best-practices/no-a": "This doesn't apply in this ruleset.", + }, + }, + }, + }, +}); +``` + +When referencing a rule or ruleset(in `enable`, `extends`, `disable`) the rule or rule set id must be used which in this format: `/` + +## Testing a linter + +To test linter rule an rule tester is provided letting you test a specific rule without enabling the others. + +First you'll want to create an instance of the rule tester using `createLinterRuleTester` passing it the rule that is being tested. +You can then provide different test checking the rule pass or fails. + +```ts +import { RuleTester, createLinterRuleTester, createTestRunner } from "@typespec/compiler/testing"; +import { requiredDocRule } from "./rules/required-doc.rule.js"; + +describe("required-doc rule", () => { + let ruleTester: RuleTester; + + beforeEach(() => { + const runner = createTestRunner(); + ruleTester = createLinterRuleTester(runner, requiredDocRule, "@typespec/my-linter"); + }); + + it("emit diagnostics when using model named foo", async () => { + await ruleTester.expect(`model Foo {}`).toEmitDiagnostics({ + code: "@typespec/my-linter/no-foo-model", + message: "Cannot name a model with 'Foo'", + }); + }); + + it("should be valid to use other names", async () => { + await ruleTester.expect(`model Bar {}`).toBeValid(); + }); +}); +``` diff --git a/packages/website-astro/src/content/docs/latest/extending-typespec/writing-scaffolding-template.md b/packages/website-astro/src/content/docs/latest/extending-typespec/writing-scaffolding-template.md new file mode 100644 index 0000000000..6821258589 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/extending-typespec/writing-scaffolding-template.md @@ -0,0 +1,122 @@ +--- +title: Scaffolding templates +--- + +# Writting a scaffolding template + +typespec provides scaffolding functionality via the `tsp init` command. + +```bash +tsp init +``` + +## Basic + +A scaffolding template is a `json` document that can be hosted locally or online. +The root of the document is a dictionary allowing multiple templates to be hosted at the same location. + +Each template needs at the minimum: + +- key: Key of the template +- title: Human readable name of the template +- description: Extended description of the template. + +Example: + +```json +{ + "templateKey1": { + "title": "Template #1", + "description": "Create a project representing #1" + }, + "templateKey2": { + "title": "Template #2", + "description": "Create a project representing #2" + } +} +``` + +## Adding libraries + +You can add a list of typespec libraries to include. This will automatically add those libraries to the `package.json` and imported in `main.tsp`. + +```json +{ + "rest": { + "title": "Rest API", + "description": "Create a new project representing a REST API", + "libraries": ["@typespec/rest", "@typespec/openapi3"] + } +} +``` + +## Adding new files + +Additional files.typespec or other types) can be generated by the initializer. The template takes a list of the files to copy and interpolate values. +Each file need the following properties: + +- `path`: Absolute or relative path(to the template file) to the file +- `destination`: Relative path of the file relative to the project root. + +```json +{ + "rest": { + "title": "Rest API", + "description": "Create a new project representing a REST API", + "files": [{ "path": "./models.tsp", "destination": "./models.tsp" }] + } +} +``` + +In models.tsp + +```typespec +model {{parameters.ModelName}} { + +} +``` + +### Interpolating values + +The template can interpolate values in the files. The values available are anything available in the template configuration referenced as it is. +Examples: + +- Reference a parameter `{{parameters.ModelName}}` +- Reference a the template title `{{title}}` + +Additionally the following values and functions are available: + +| Name | Description | +| ------------------------------------- | --------------------------------------------------------------- | +| `directory` | Directory full path where the project should be initialized. | +| `folderName` | Folder name where the project should be initialized. | +| `name` | Name of the project. | +| `libraries` | List of libraries to include | +| `templateUri` | Path where this template was loaded from. | +| Functions | | +| `toLowerCase(value: string)` | Convert string to lower case | +| `normalizePackageName(value: string)` | Normalize package name. It replaces `.` with`-` and toLowerCase | + +## Demanding additional input from the user + +When generating files there might be a need for additional inputs to be retrieved from the user. For example the model name. +The template takes in a map of inputs that will get prompted to the user during initialization. + +```json +{ + "rest": { + "title": "Rest API", + "description": "Create a new project representing a REST API", + "inputs": { + "modelName": { + "type": "text", + "description": "Name of the first model" + } + } + } +} +``` + +Types of input supported: + +- `text`: Ask for a raw text value. diff --git a/packages/website-astro/src/content/docs/latest/getting-started/getting-started-http.md b/packages/website-astro/src/content/docs/latest/getting-started/getting-started-http.md new file mode 100644 index 0000000000..49bbd1641e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/getting-started/getting-started-http.md @@ -0,0 +1,259 @@ +--- +title: Getting Started with TypeSpec For Http +--- + +Let's create a REST API definition with TypeSpec. TypeSpec has an official HTTP API "binding" called `@typespec/http`. It's a set of TypeSpec declarations and decorators that describe HTTP APIs and can be used by code generators to generate OpenAPI descriptions, implementation code, and the like. +Built on top of the http library there is the rest library `@typespec/rest` which provide some REST concept like resources. + +TypeSpec also has an official OpenAPI emitter called `@typespec/openapi3` that consumes the HTTP API bindings and emits standard [OpenAPI 3.0](https://spec.openapis.org/oas/v3.0.3) descriptions. This can then be fed in to any OpenAPI code generation pipeline. + +References: + +- [Http library](../standard-library/http/reference) +- [Rest library](../standard-library/rest/reference) +- [OpenAPI 3 emitter](../standard-library/openapi3/reference) + +## Setup + +:::note +Make sure to have installed the [editor extension](../introduction/installation.md#install-the-vs-and-vscode-extensions) to get syntax highlighting and intellisense. +::: + +1. Make a new folder somewhere +2. Run `npx --package=@typespec/compiler tsp init` and select the `Generic Rest API` template +3. Run `npm install` to install dependencies +4. Run `npx tsp compile .` to compile the initial file + You can either run `npx tsp compile . --watch` to automatically compile change on save or keep running the command manually after that. + +Resulting file structure: + +``` +main.tsp +tspconfig.yaml +package.json +node_modules/ +tsp-output/ + @typespec/ + openapi3/ + openapi.yaml +``` + +## Service definition and metadata + +A definition for a service is the namespace that contains all the operations for the service and carries top-level metadata like service name and version. TypeSpec offers the following decorators for providing this metadata, and all are optional. + +- `@service` - Mark a namespace as a service namespace. Takes in the following options: + - `title`: Name of the service + - `version`: Version of the service +- `@server` - (In `TypeSpec.Http`) the host of the service. Can accept parameters. + +Here's an example that uses these to define a Pet Store service: + +```typespec +using TypeSpec.Http; +using TypeSpec.Rest; + +/** + * This is a sample server Petstore server. + */ +@service({ + title: "Pet Store Service", + version: "2021-03-25", +}) +@server("https://example.com", "Single server endpoint") +namespace PetStore; +``` + +The `server` keyword can take a third parameter with parameters as necessary: + +```typespec +@server("https://{region}.foo.com", "Regional endpoint", { + /** Region name */ + region?: string = "westus", +}) +``` + +## Resources & routes + +Resource is a general term for anything that can be identified by a URL and manipulated by HTTP methods. +In TypeSpec, the operations for a resource are typically grouped in a namespace. You declare such a namespace by adding the `@route` decorator to provide the path to that resource: + +```typespec +@route("/pets") +namespace Pets { + +} +``` + +Lets add a pet model in the namespace + +```tsp +model Pet { + @minLength(100) + name: string; + + @minValue(0) + @maxValue(100) + age: int32; + + kind: "dog" | "cat" | "fish"; +} +``` + +To define an operation on this resource, you need to provide the HTTP verb for the route using the `@get`, `@head` `@post`, `@put`, `@patch`, or `@delete` decorators. If an HTTP method decorator is not specified then the default is post if there is a body and get otherwise. Lets add an operation to our `Pets` resource: + +```typespec +@route("/pets") +namespace Pets { + op list(): Pet[]; + + // or you could also use + @get op listPets(): Pet[]; +} +``` + +### Automatic route generation + +Instead of manually specifying routes using the `@route` decorator, you automatically generate routes from operation parameters by applying the `@autoRoute` decorator to an operation or interface containing operations. + +For this to work, an operation's path parameters (those marked with `@path`) must also be marked with +the `@segment` decorator to define the preceding path segment. + +This is especially useful when reusing common parameter sets defined as model types. + +For example: + +```typespec +model CommonParameters { + @path + @segment("tenants") + tenantId: string; + + @path + @segment("users") + userName: string; +} + +model User { + name: string; +} +@error +model Error { + message: string; +} + +@autoRoute +interface UserOperations { + @get + getUser(...CommonParameters): User | Error; + + @put + updateUser(...CommonParameters, user: User): User | Error; +} +``` + +This will result in the following route for both operations + +```text +/tenants/{tenantId}/users/{userName} +``` + +## Path and query parameters + +Model properties and parameters which should be passed as path and query parameters use the `@path` and `@query` decorators respectively. Let's modify our list operation to support pagination, and add a read operation to our Pets resource: + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip?: int32, @query top?: int32): Pet[]; + op read(@path petId: int32): Pet; +} +``` + +Path parameters are appended to the URL unless a substitution with that parameter name exists on the resource path. For example, we might define a sub-resource using the following TypeSpec. Note how the path parameter for our sub-resource's list operation corresponds to the substitution in the URL. + +```typespec +@route("/pets/{petId}/toys") +namespace PetToys { + model Toy { + name: string; + } + op list(@path petId: int32): Toy[]; +} +``` + +## Headers + +Model properties and parameters that should be passed in a header use the `@header` decorator. The decorator takes the header name as a parameter. If a header name is not provided, it is inferred from the property or parameter name. Let's add `etag` support to our pet store's read operation. + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): Pet[]; + op read(@path petId: int32, @header ifMatch?: string): { + @header eTag: string; + @body pet: Pet; + }; + @post + op create(@body pet: Pet): {}; +} +``` + +## Request & response bodies + +Request and response bodies can be declared explicitly using the `@body` decorator. Let's add an endpoint to create a pet. Let's also use this decorator for the responses, although this doesn't change anything about the API. + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): { + @body pets: Pet[]; + }; + op read(@path petId: int32): { + @body pet: Pet; + }; + @post + op create(@body pet: Pet): {}; +} +``` + +Note that in the absence of explicit `@body`: + +1. The set of parameters that are not marked @header, @query, or @path form the request body. +2. The set of properties of the return model that are not marked @header, @query, or @path form the response body. +3. If the return type is not a model, then it defines the response body. + +This is how we were able to return Pet and Pet[] bodies without using @body for list and read. We can actually write +create in the same terse style by spreading the Pet object into the parameter list like this: + +```typespec +@route("/pets") +namespace Pets { + @post + op create(...Pet): {}; +} +``` + +## Status codes + +Use the `@statusCode` decorator on a property to declare a status code for a response. Generally, setting this to just `int32` isn't particularly useful. Instead, use number literal types to create a discriminated union of response types. Let's add status codes to our responses, and add a 404 response to our read endpoint. + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): { + @statusCode statusCode: 200; + @body pets: Pet[]; + }; + op read(@path petId: int32, @header ifMatch?: string): { + @statusCode statusCode: 200; + @header eTag: string; + @body pet: Pet; + } | { + @statusCode statusCode: 404; + }; + op create(@body pet: Pet): { + @statusCode statusCode: 204; + }; +} +``` diff --git a/packages/website-astro/src/content/docs/latest/getting-started/getting-started.md b/packages/website-astro/src/content/docs/latest/getting-started/getting-started.md new file mode 100644 index 0000000000..07c99deaa2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/getting-started/getting-started.md @@ -0,0 +1,8 @@ +--- +id: getting-started +title: Getting Started +--- + +# Getting Started with TypeSpec + +- [Get started with HTTP in TypeSpec](./getting-started-http.md) diff --git a/packages/website-astro/src/content/docs/latest/getting-started/typespec-for-openapi-dev.md b/packages/website-astro/src/content/docs/latest/getting-started/typespec-for-openapi-dev.md new file mode 100644 index 0000000000..29f8e43858 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/getting-started/typespec-for-openapi-dev.md @@ -0,0 +1,834 @@ +--- +title: TypeSpec For OpenAPI Developer +--- + +# TypeSpec for the OpenAPI developer + +This guide is an introduction to TypeSpec using concepts that will be familiar to developers +that either build or use API definitions in OpenAPI v2 or v3. + +In many cases, this will also describe how the typespec-autorest and openapi3 emitters translate +TypeSpec designs into OpenAPI. + +The document is organized around the features of an OpenAPI v2 or v3 definition. +The idea is that if you know how to describe some API feature in OpenAPI, you can just navigate +to the section of this document for that feature. + +## Data Types + +In OpenAPI [v2](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#data-types)/[v3](https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#data-types), data types are specified using the `type` and `format` fields in a schema. + +The TypeSpec equivalent of OpenAPI data types are the TypeSpec primitive types or [built-in models](https://microsoft.github.io/typespec/docs/language-basics/built-in-types). + +### type and format + +The following table shows how common OpenAPI types map to TypeSpec types: + +| OpenAPI `type`/`format` | TypeSpec type | Notes | +| --------------------------------- | ---------------- | ------------------------------------------------------------------------- | +| `type: integer, format: int32` | `int32` | | +| `type: integer, format: int64` | `int64` | | +| `type: number, format: float` | `float32` | | +| `type: number, format: double` | `float64` | | +| `type: string` | `string` | | +| `type: string, format: byte` | `bytes` | for content-type == 'application/json' or 'text/plain' | +| `type: string, format: binary` | `bytes` | for "binary" content types, e.g. 'application/octet-stream', 'image/jpeg' | +| `type: boolean` | `boolean` | | +| `type: string, format: date` | `plainDate` | | +| `type: string, format: date-time` | `utcDateTime` | RFC 3339 date in coordinated universal time (UTC) | +| `type: string, format: date-time` | `offsetDateTime` | RFC 3339 date with offset | +| `type: string, format: password` | `@secret string` | | + +You can also define a property with no type specified using the TypeSpec `unknown` type. + +```typespec + @doc("This property has no `type` defined.") + noType?: unknown; +``` + +OpenAPI allows any string as a format, and there is a [registry of common formats][Format Registry]. +TypeSpec supports some of these directly. + +[Format Registry]: https://spec.openapis.org/registry/format + +| OpenAPI `type`/`format` | TypeSpec type | Notes | +| ------------------------------- | ------------- | ----- | +| `type: number, format: decimal` | `decimal` | | +| `type: integer, format: int8` | `int8` | | +| `type: integer, format: int16` | `int16` | | +| `type: integer, format: uint8` | `uint8` | | +| `type: string, format: uri` | `url` | | + +For formats that are not supported directly, you can use the built-in `@format` decorator to specify +the format explicitly. + +### JSON Schema assertions + +OpenAPI supports a variety of "assertions" that can be used further restrict the values allowed for a data type. +These are actually borrowed into OpenAPI from JSON Schema. + +For `type: integer` and `type: number` data types: + +| OpenAPI/JSON Schema keyword | TypeSpec construct | Notes | +| --------------------------- | ---------------------------- | ----- | +| `minimum: value` | `@minValue(value)` decorator | | +| `maximum: value` | `@maxValue(value)` decorator | | + +For `type: string` data types: + +| OpenAPI/JSON Schema keyword | TypeSpec construct | Notes | +| --------------------------- | ----------------------------- | ----- | +| `minLength: value` | `@minLength(value)` decorator | | +| `maxLength: value` | `@maxLength(value)` decorator | | +| `pattern: regex` | `@pattern(regex)` decorator | | + +For `type: array` data types: + +| OpenAPI/JSON Schema keyword | TypeSpec construct | Notes | +| --------------------------- | ---------------------------- | ----- | +| `minItems: value` | `@minItems(value)` decorator | | +| `maxItems: value` | `@maxItems(value)` decorator | | + +### enum + +There are two ways to define an `enum` data type. One is with the [TypeSpec `enum` statement](https://microsoft.github.io/typespec/docs/language-basics/enums), e.g.: + + + +```typespec +enum Color { + "red", + "blue", + "green", +} +``` + + +Another is to use the union operation to define the enum values inline, e.g.: + +```typespec +size?: "small" | "medium" | "large" | "x-large"; +``` + +### default + +A model property that specifies a default value using "=" will produce a `default` field in the schema for this property. + +```typespec + answer?: int32 = 42; + color?: string = "purple"; +``` + +produces + +```yaml +answer: + type: integer + format: int32 + default: 42 +color: + type: string + default: purple +``` + +## Host / BasePath / Servers + +In OpenAPI v2, the `host` and `basePath` fields at the top-level of the API definition combine to form the base URL for the API. The paths defined in the `paths` object are appended to this base URL to form the absolute URL for an operation. + +In OpenAPI v3, the top-level `servers` field specifies an array of `server` objects [[v3][v3-server]] with a base URL, which may be parameterized, to which the operation path is appended. + +[v3-server]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#server-object + +In TypeSpec, the `host` in OpenAPI v2 or `servers` in OpenAPI v3 can be specified with the `@server` decorator +on the namespace(From `@typespec/http` library). You can use this decorator multiple times to specify multiple servers. + +## Paths Object + +In OpenAPI, the `paths` object [[v2][v2-paths], [v3][v3-paths]] is the top-level structure for defining the operations of the API, organized with the "path" for the operation. + +[v2-paths]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#paths-object +[v3-paths]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#paths-object + +In TypeSpec, you can specify the path for a namespace, interface, or operation using the `@route` decorator. + +When the value of the `@route` decorator contains path parameters, operations within the scope of the decorator +must declare parameters with the same name and type. If an operation declares a path parameter that is not present +in the route, this defines a new path that is the value from the `@route` decorator with the path parameter appended. + +```typespec +@route("/pets") +namespace Pets { + op create(@body pet: Pet): Pet; // uses path "/pets" + op read(@path petId: int32): Pet; // uses path "/pets/{petId}" +} +``` + +When the `@route` decorator is used within a namespace or interface that also has a `@route` decorator, the path is +obtained by concatenating the routes. + +```typespec +@route("/widgets") +namespace Widgets { + // widgets operations + + @route("/{id}/parts") + namespace Parts { + op list(@path id: string): Part[] | Error; // uses path "/widgets/{id}/parts" + } +} +``` + +## Path Item Object + +In OpenAPI, a path item object [[v2][v2-pathitem], [v3][v3-pathitem]] describes the operations available on a single path. A path may have at most one `get`, `put`, `post`, `patch`, `delete`, or `head` operation. + +[v2-pathitem]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#path-item-object +[v3-pathitem]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#path-item-object + +In TypeSpec, operations are defined within a namespace or interface with a syntax similar to typescript functions. +The HTTP method for an operation can be specified explicitly using a decorator: `@get`, `@put`, `@post`, `@patch`, `@delete`, or `@head`. +If an HTTP method decorator is not specified then the default is `post` if there is a body and `get` otherwise. + +```typespec +@tag("Gadgets") +@route("/gadgets") +namespace Gadgets { + op create(@body gadget: Gadget): Gadget | Error; // uses "post" method + op read(@path id: string): Gadget | Error; // uses "get" method +} +``` + +Other path item fields: + +| OpenAPI `pathItem` field | TypeSpec construct | Notes | +| ------------------------ | ------------------ | ------------------------ | +| `summary` | | Not currently supported. | +| `description` | | Not currently supported. | +| `parameters` | | Not currently supported. | + +## Operation Object + +In OpenAPI, an operation object [[v2][v2-operation], [v3][v3-operation]] describes an operation. + +[v2-operation]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#operation-object +[v3-operation]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#operation-object + +The fields in an OpenAPI operation object are specified with the following TypeSpec constructs: + +| OpenAPI `operation` field | TypeSpec construct | Notes | +| ------------------------- | ------------------------------------------ | ---------------------------------------------------- | +| `tags` | `@tag` decorator | | +| `summary` | `@summary` decorator | | +| `description` | `@doc` decorator or doc comment | | +| `externalDocs` | `@externalDocs` decorator | | +| `operationId` | operation name or `@operationId` decorator | | +| `parameters` | `op` parameter list | see [Parameter Object](#parameter-object) | +| `requestBody` | parameter with `@body` decorator | see [Request Body Object](#request-body-object-oas3) | +| `responses` | `op` return type(s) | see [Responses Object](#responses-object) | +| `callbacks` | | Not currently supported. | +| `deprecated` | `@deprecated` decorator | | +| `security` | | Not currently supported. | +| `servers` | | Not currently supported. | + +### Tags + +Tags can be specified using the `@tag` decorator on an operation. +The `@tag` decorator can also be used on a namespace or interface to specify tags for all operations within the namespace or interface. +Tags are additive, so tags specified on an operation are added to the tags specified on the namespace or interface. +The `@tag` decorator can be used multiple times to specify multiple tags on an operation, namespace, or interface. + +### Description + +Use the `@doc` decorator to specify the description for an operation. The value of the `@doc` decorator can be a multi-line string +and can contain markdown formatting. + +```typespec +@doc(""" +Get status info for the service. +The status includes the current version of the service. +The status value may be one of: +- `ok`: the service is operating normally +- `degraded`: the service is operating in a degraded state +- `down`: the service is not operating +""") +@tag("Status") +@route("/status") +@get +op status(): string; +``` + +You can also use a "doc comment" to specify the description for an operation. A doc comment is a comment that begins with `/**`. +Doc comments may be spread across multiple lines and may contain markdown formatting. + +```typespec +/** + * Get health info for the service. + * The health includes the current version of the service. + * The health value may be one of: + * - `ok`: the service is operating normally + * - `degraded`: the service is operating in a degraded state + * - `down`: the service is not operating + */ +@tag("Health") +@route("/health") +@get +op health(): string; +``` + +### operationId + +You can specify the operationId for an operation using the `@operationId` decorator. +When the `@operationId` decorator is not specified, the operationId is generated from the operation name. +For an operation defined in the top-level namespace, the operationId is the just operation name. +If the operation is defined within a inner namespace or interface, then the operationId is +prefixed with the name of the innermost namespace or interface name. + +Note: this approach will generally produce unique operationIds, as required by OpenAPI, +but it is possible to create duplicate operationIds. + +## Parameter Object + +In OpenAPI, a parameter object [[v2][v2-parameter], [v3][v3-parameter]] describes a single operation parameter. + +[v2-parameter]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameter-object +[v3-parameter]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#parameter-object + +The following fields of a parameter object are common to both OpenAPI v2 and v3: + + +| OpenAPI `parameter` field | TypeSpec construct | Notes | +| ------------------------- | -------------------- | ------------------------------------- | +| `name` | parameter name | | +| `in` | decorator | `@query`, `@path`, `@header`, `@body` | +| `description` | `@doc` decorator | | +| `required` | from parameter "optionality" | a "?" following the parameter name indicates it is optional (`required: false`), otherwise it is required (`required: true`) | +| `allowEmptyValue` | | Not currently supported. | + + +### OpenAPI v2 + +The following fields of a parameter object are specific to OpenAPI v2: + +| OpenAPI v2 `parameter` field | TypeSpec construct | Notes | +| ---------------------------- | ------------------------------------------- | ----------------------------- | +| `type` | parameter type | see [Data Types](#data-types) | +| `collectionFormat` | `format` parameter on `@query` or `@header` | | + +#### Collection Formats + +In OpenAPI v2, the `collectionFormat` field of a query or header parameter object specifies how multiple values are delimited. +You can use the `format` field of the `@query` or `@header` decorator to specify the collection format. + +```typespec + @get read( + @path id: string, + @query({format: "csv"}) csv?: string[], // has collectionFormat: "csv" + @query({format: "multi"}) multi?: string[], // has collectionFormat: "multi" + ): Widget | Error; +``` + +### OpenAPI v3 + +The following fields of a parameter object are specific to OpenAPI v3: + +| OpenAPI v3 `parameter` field | TypeSpec construct | Notes | +| ---------------------------- | ------------------------------------------- | ----------------------------------- | +| `style` | `format` parameter on `@query` or `@header` | | +| `explode` | `format` parameter on `@query` or `@header` | | +| `schema` | parameter schema | see [Schema Object](#schema-object) | +| `deprecated` | | Not currently supported. | +| `example` | | Not currently supported. | +| `examples` | | Not currently supported. | +| `content` | | Not currently supported. | + +## Request Body Object (OAS3) + +In OpenAPI v3, the operation request body is defined with a [Request Body object] rather than as a parameter. + +[Request Body object]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#request-body-object + +An OpenAPI v3 Request Body object corresponds to a TypeSpec `op` parameter with the `@body` decorator. + + +| OpenAPI `requestBody` field | TypeSpec construct | Notes | +| --------------------------- | ----------------------- | ------------ | +| `description` | `@doc` decorator | | +| `required` | parameter "optionality" | a "?" following the parameter name indicates it is optional (`required: false`), otherwise it is required (`required: true`) | +| `content` | `@body` parameter type | | + + +The media type of the request body is specified with a `content-type` header. If `content-type` has multiple values +then `content` will have one entry for each value. + +```typespec +@put op uploadImage(@header contentType: "image/png", @body image: bytes): void; +@post op analyze( + @header contentType: "application/octet-stream" | "application/pdf" | "image/jpeg", + @body image: bytes, +): string | Error; +``` + +To get multiple `content` entries with different schemas (say one structured and one binary), +you need to define two separate operations that share the same path and method. +You do with with the `@sharedRoute` decorator. + +```typespec +@route(":process") +namespace Process { + @sharedRoute + @post + op process(...Widget): Widget | Error; + + model CsvBody { + @header contentType: "text/csv"; + @body _: string; + } + @sharedRoute + @post + op process2(...CsvBody): Widget | Error; +} +``` + +## Responses Object + +In OpenAPI, the responses object [[v2][v2-responses], [v3][v3-responses]] specifies the possible responses for an operation. +The responses object maps a HTTP response code to the expected response. + +[v2-responses]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#responses-object +[v3-responses]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#responses-object + +In TypeSpec, operation responses are defined by the return types of the `op`. The status code for a response can be specified as a property in the return type with the `@statusCode` decorator. The value of the property with the `@statusCode` decorator should be an HTTP status code or union of status codes. When the value is a union of status codes, a response is generated for each status code in the union. + +If a return type does not contain a `statusCode`, the default is `200` except for `void` which defaults to `204`. + +To get the `default` response, specify the `@error` decorator on the return type model. + +```typespec +@get op read(@path id: string): Widget; // has "200" response +@delete op delete(@path id: string): void; // has "204" response +// has "200" and "201" response +@put op create(@body widget: Widget): { + @statusCode _: "200" | "201"; + @body body: Widget; +}; +// has "200" and "default" response +@post op update(@body widget: Widget): Widget | Error; +``` + +The TypeSpec.Http package also defines several standard response types. + +| HTTP Status Code | TypeSpec construct | +| ---------------- | ---------------------- | +| `200` | `OkResponse` | +| `201` | `CreatedResponse` | +| `202` | `AcceptedResponse` | +| `204` | `NoContentResponse` | +| `301` | `MovedResponse` | +| `304` | `NotModifiedResponse` | +| `401` | `UnauthorizedResponse` | +| `404` | `NotFoundResponse` | +| `409` | `ConflictResponse` | + +You can intersect these standard response types with your own response types. + +```typespec +// has "200", '409', and "default" responses +@post op update(@body widget: Widget): Widget | (ConflictResponse & Error) | Error; +``` + +### Response Object + +In OpenAPI, a response object [[v2][v2-response], [v3][v3-response]] describes a single response for an operation. +The structure of the response object changed significantly from OpenAPI v2 to OpenAPI v3, but there are many +elements common to both. + +[v2-response]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#response-object +[v3-response]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#response-object + +The fields in an OpenAPI response object are specified with the following TypeSpec constructs: + +| OpenAPI `response` field | TypeSpec construct | Notes | +| ------------------------ | -------------------------------------------------- | -------------------------------------------------- | +| `description` | `@doc` decorator | | +| `headers` | fields in the return type with `@header` decorator | required or optional based on optionality of field | +| `schema` (OAS2) | return type or type of `@body`` property | | +| `content` (OAS3) | return type or type of `@body`` property | | +| `examples` (OAS3) | | Not currently supported. | +| `links` (OAS3) | | Not currently supported. | + +```typespec +@get op read(@path id: string): { + @doc("the widget") + @body + widget: Widget; + + @header xRateLimitRemaining: number; + @header xRateLimitReset: number; +}; +``` + +The media type of the request body is specified with a `content-type` header. If `content-type` has multiple values +then `content` will have one entry for each value. + +To get multiple `content` entries with different schemas, use a union type. + +```typespec +@tag("Response Content") +@route("/response-content") +namespace ResponseContent { + @get op read(@path id: string): Widget | { + @header contentType: "text/html"; + @body _: string; + } | { + @header contentType: "image/jpeg"; + @body _: bytes; + }; +} +``` + +## Schema Object + +OpenAPI schemas are represented in TypeSpec by [models](https://microsoft.github.io/typespec/docs/language-basics/models/). +Models have any number of members and can extend and be composed with other models. + +Models can be defined with the `model` statement and then referenced by name, which generally results in a `$ref` to a schema for the model in the `definitions` or `components.schemas` section of the OpenAPI document. + +TypeSpec supports the ["spread" operator](https://microsoft.github.io/typespec/docs/language-basics/models/#spread) (`...`), which copies the members of the source model into the target model. +But TypeSpec processes all spread transformations before emitters are invoked, so this form of reuse is not represented in the emitted OpenAPI. + +The spread operation is useful if you want one or more properties to be present in several different models but in a standard fashion. For example: + +```typespec +model Legs { + @doc("number of legs") legs: int32; +} + +model Dog { + name: string; + ...Legs; +} + +model Cat { + name: string; + ...Legs; +} + +model Snake { + name: string; + // snakes have no legs +} +``` + +### additionalProperties + +You can generate a schema with `additionalProperties` with the TypeSpec `Record` construct. + +```typespec + bar: Record; +``` + +is produced as + +```yaml +bar: + type: object + additionalProperties: {} +``` + +To get a schema having both `properties` and `additionalProperties`, define a model that extends `Record`. + +```typespec +model Bar extends Record { + bar?: string; +} +``` + +produces + +```yaml +Bar: + type: object + properties: + bar: + type: string + additionalProperties: {} +``` + +To define a schema with `additionalProperties` that has a specific type, use the `Record` construct with a type parameter. + +```typespec + bar: Record; +``` + +results in + +```yaml +bar: + type: object + additionalProperties: + type: string +``` + +### allOf and polymorphism using allOf + +TypeSpec also supports single inheritance of models with the `extends` keyword. This construct can be used to produce an `allOf` with a single element (the parent schema) in OpenAPI. For example: + +```typespec +model Pet { + name: string; +} + +model Cat extends Pet { + meow: int32; +} + +model Dog extends Pet { + bark: string; +} +``` + +TypeSpec does not currently provide a means to produce an `allOf` with more than one element -- these are generally treated as "composition" in code generators and thus better represented in TypeSpec with the spread operator. + +Models with a `@discriminator` decorator can be extended to produce polymorphic schemas in either OpenAPI v2 or v3 using `allOf`. +This schema produced for the base model will be defined with a `discriminator` property and schemas for the child models will `allOf` the base schema and add additional properties. + +For example: + +```typespec +@discriminator("kind") +model Pet { + name: string; + weight?: float32; +} +model Cat extends Pet { + kind: "cat"; + meow?: int32; +} +model Dog extends Pet { + kind: "dog"; + bark?: string; +} +``` + +generates: + +```typespec + Cat: + type: object + properties: + kind: + type: string + enum: + - cat + meow: + type: integer + format: int32 + required: + - kind + allOf: + - $ref: '#/components/schemas/Pet' + Dog: + type: object + properties: + kind: + type: string + enum: + - dog + bark: + type: string + required: + - kind + allOf: + - $ref: '#/components/schemas/Pet' + Pet: + type: object + properties: + kind: + type: string + description: Discriminator property for Pet. + name: + type: string + weight: + type: number + format: float + discriminator: + propertyName: kind + mapping: + cat: '#/components/schemas/Cat' + dog: '#/components/schemas/Dog' + required: + - name +``` + +### Polymorphism using anyOf and oneOf (OAS3) + +Polymorphism can also be represented in OpenAPI v3 with `anyOf` or `oneOf` constructs. +These can be represented in TypeSpec with a union type. + +```typespec +union Pet { + cat: Cat, + dog: Dog, +} + +model Cat { + meow?: int32; +} + +model Dog { + bark?: string; +} +``` + +generates a Pet schema with `anyOf`. + +```yml +Pet: + anyOf: + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Dog" +``` + +The openapi emitter uses `anyOf` by default because the schemas may not be mutually exclusive. +But the `@oneOf` decorator of the OpenAPI library can be used to force the use of `oneOf` instead. + +```typespec +import "@typespec/openapi3"; +using OpenAPI; + +@oneOf +union Pet { + cat: Cat, + dog: Dog, +} +``` + +produces: + +```yml +Pet: + oneOf: + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Dog" +``` + +To make Pet a discriminated union, add the `@discriminator` decorator and add the discriminator property +with a string literal value to each of the child schemas. + +```typespec +@discriminator("kind") +@oneOf +union Pet { + cat: Cat, + dog: Dog, +} +model Cat { + kind: "cat"; + meow?: int32; +} +model Dog { + kind: "dog"; + bark?: string; +} +``` + +results in the following schema for Pet: + +```yml +Pet: + oneOf: + - $ref: "#/components/schemas/Cat" + - $ref: "#/components/schemas/Dog" + discriminator: + propertyName: kind + mapping: + cat: "#/components/schemas/Cat" + dog: "#/components/schemas/Dog" +``` + +## definitions / components + +OpenAPI supports reuse of schemas, parameters, responses, and other elements with the `definitions` (OAS2) or `components` (OAS3) section of an OpenAPI definition. + +Referencing a model by name (not with "spread"), as an `op` parameter or return type or as the type of a property in another model, generally results in a `$ref` to a schema for the model in the `definitions` or `components.schemas` section of the OpenAPI document. + +Reusable parameters can be defined as members of a model and then incorporated into an operation parameter list using the spread operator. For example: + +```typespec +model PetId { + @path petId: int32; +} + +namespace Pets { + op read(...PetId): Pet | Error; +} +``` + +results in a `$ref` to the named parameter `PetId` in either `parameters` or `components.parameters`. + +## Info Object + +In OpenAPI, the `info` object [[v2][v2-info], [v3][v3-info]] contains metadata about the API such as a `title`, `description`, `license`, and `version`. + +[v2-info]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#info-object +[v3-info]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#info-object + +In TypeSpec this information is specified with [decorators on the namespace][typespec-service-metadata]. + +| OpenAPI `info` field | TypeSpec decorator | Notes | +| -------------------- | ---------------------- | --------------------------- | +| `title` | `@service({title: }` | TypeSpec built-in decorator | +| `version` | `@service({version: }` | TypeSpec built-in decorator | +| `description` | `@doc` | TypeSpec built-in decorator | +| `license` | `@info` | | +| `contact` | `@info` | | + +[typespec-service-metadata]: https://microsoft.github.io/typespec/docs/standard-library/http/#service-definition-and-metadata + +```typespec +@doc("The Contoso Widget Service provides access to the Contoso Widget API.") +@service({ + title: "Widget Service", + version: "1.0.0", +}) +@info({ + contact: { + name: "API Support", + email: "contact@contoso.com", + }, + license: { + name: "Apache 2.0", + url: "https://www.apache.org/licenses/LICENSE-2.0.html", + }, +}) +namespace DemoService; +``` + +## Consumes / Produces (OAS2) + +In OpenAPI v2, the top-level `consumes` and `produces` fields specify a list of MIME types an operation can consume / produce +when not overridden by a `consumes` or `produces` on an individual operation. + +The typespec-autorest emitter previously supported `@produces` and `@consumes` decorators on a namespace, but these are deprecated +in favor of explicit `content-type` and `accept` header properties in request and response bodies. + +## securityDefinitions / securitySchemes Object + +Use `@useAuth` decorator from the `@typespec/rest" library + +```typespec +using TypeSpec.Http; +@useAuth(OAuth2Auth<["read", "write"]>) +namespace MyService; +``` + +## Specification Extensions + +You can add arbitrary specification extensions ("x-" properties) to a model or an operation with the `@extension` decorator. +For example: + +```typespec +namespace Pets { + @extension("x-streaming-operation", true) op read(...PetId): Pet | Error; +} +``` diff --git a/packages/website-astro/src/content/docs/latest/introduction/configuration/configuration.md b/packages/website-astro/src/content/docs/latest/introduction/configuration/configuration.md new file mode 100644 index 0000000000..a06e143a6a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/configuration/configuration.md @@ -0,0 +1,440 @@ +--- +title: Configuration +--- + +# Compiler and Libraries configurations + +TypeSpec compiler and libraries can be configured either via a [configuration file](#configuration-file) or [command line flags](#command-line-flags). + +## Configuration file + +TypeSpec configuration can be provided via the `tspconfig.yaml` configuration file. + +### Discovery + +TypeSpec compiler will look for the closest `tspconfig.yaml` file located in the same directory or closest parent directory from the typespec entrypoint. + +For example if running `tsp compile /dev/foo/bar/main.tsp`, the compiler will lookup the file at the folllowing paths(In this order): + +- `/dev/foo/bar/tspconfig.yaml` +- `/dev/foo/tspconfig.yaml` +- `/dev/tspconfig.yaml` +- `/tspconfig.yaml` + +### Schema + +The file is a `yaml` document with the following structure. See the [next section](#typespec-configuration-options) for details on each option. + +```typespec +model TypeSpecProjectSchema { + extends?: string; + parameters?: Record<{default: string}> + "environment-variables"?: Record<{default: string}> + "warn-as-error"?: boolean; + "output-dir"?: boolean; + "trace"?: string | string[]; + imports?: string; + emit?: string[]; + options?: Record; + linter?: LinterConfig; +} + +model LinterConfig { + extends?: RuleRef[]; + enable?: Record; + disable?: Record; +} +``` + +### Extending project files + +There is cases where you might want to build different folders with different options(for example different emitters) but want to share some configuration for both as well. + +For that you can use the `extends` property of the configuration file + +in `/tspconfig.yaml` + +```yaml +options: + emitter1: + some-option: my-name + emitter2: + some-other-option: This is a title +``` + +in `/proj2/tspconfig.yaml`, enable `emitter1` using the options specified in the parent `tspconfig.yaml` + +```yaml +extends: ../tspconfig.yaml +emit: + - emitter1 +``` + +### Variable interpolation + +The typespec project file provide variable interpolation using: + +- built-in variables +- environment variables +- config file parameters +- emitter options can reference each other + +Variable interpolation is done using an variable expression surrounded by `{` and `}`. (`{}`) + +Examples: + +- `{output-dir}/my-path` +- `{env.SHARED_PATH}/my-path` + +### Emitter path config interpolation + +Some config of emitters can be interpolated using a special rule that will collapse a path. + +If a variable is followed by a `/` or `.` and the emitter interpolating the config doesn't provide that variable it will then omit the path segment. + +For example given the following config value: `{service-name}/output.{version}.json` +The following would get produced + +| Service name value | Version value | Result | +| ------------------ | ------------- | ------------------------- | +| `"PetStore"` | `"v1"` | `PetStore/output.v1.json` | +| `"PetStore"` | `undefined` | `PetStore/output.json` | +| `undefined` | `"v1"` | `output.v1.json` | +| `undefined` | `undefined` | `output.json` | + +#### Built-in variables + +| Variable name | Scope | Description | +| -------------- | --------------- | ------------------------------------------------------------------------------------ | +| `cwd` | \* | Points to the current working directory | +| `project-root` | \* | Points to the the tspconfig.yaml file containing folder. | +| `output-dir` | emitter options | Common `output-dir` See [output-dir](#output-dir---configure-the-default-output-dir) | +| `emitter-name` | emitter options | Name of the emitter | + +#### Project parameters + +A typespec project file can specify some parameters that can then be specified via the CLI. + +`{cwd}` and `{project-root}` variables can be used in the default value of those parmeters. + +The parameters can then be referenced by their name in a variable interpolation expression. + +Parameters must have a default value. +**Example:** + +```yaml +parameters: + base-dir: + default: "{cwd}" + +output-dir: {base-dir}/output +``` + +The parameter can then be specified with `--arg` in this format `--arg "="` + +```bash +tsp compile . --arg "base-dir=/path/to/base" +``` + +#### Environment variables + +A typespec project file can define which environment variables it can interpolate. + +`{cwd}` and `{project-root}` variables can be used in the default value of the environment variables. + +The environment variables can then be referenced by their name in a variable interpolation expression with the `env.` prefix. + +Environment variables must have a default value. + +**Example:** + +```yaml +environment-variables: + BASE_DIR: + default: "{cwd}" + +output-dir: {env.BASE_DIR}/output +``` + +#### Emitter options + +Emitter options can reference each other using the other option name as the variable expresion. + +Can only interpolate emitter options from the same emitter. + +```yaml +options: + @typespec/openapi3: + emitter-output-dir: {output-dir}/{emitter-sub-folder} + emitter-sub-folder: bar + +``` + +## TypeSpec Configuration Options + +| Config | Cli | Description | +| --------------- | ------------------------- | -------------------------------------------------------- | +| `output-dir` | `--output-dir` | Default output directory | +| `config` | `--config` | Path to config file or folder to search for config file. | +| `trace` | `--trace` | Specify tracing area to enable | +| `warn-as-error` | `--warn-as-error` | Treat warning as error | +| `imports` | `--import` | Additional imports to include | +| `emit` | `--emit` | Emitter configuration | +| `options` | `--option` or `--options` | Emitter configuration | +| `linter` | | Linter configuration | + +### `output-dir` - Configure the default output dir + +Specify the common output-dir for all emitters. See [this](#output-directory-configuration) to configure per emitter. + +```yaml +output-dir: {cwd}/typespec-build +``` + +Output dir can be provided using the `--output-dir` cli flag + +```bash +tsp compile . --output-dir "./typespec-build" +``` + +Output dir must be an absolute path in the config. Use `{cwd}` or `{project-root}` to explicitly specify what it should be relative to. + +See [output directory configuration for mode details](#output-directory-configuration) + +### `trace` - Configure what to trace + +Configure what area to trace. See [tracing docs](./tracing.md) + +```yaml +# Trace all. +trace: * + +# or specific areas +trace: + - import-resolution + - projection +``` + +Trace can be provided using the `--trace` cli flag + +```bash +tsp compile . --trace import-resolution --trace projection +``` + +### `warn-as-error` - Treat warning as error + +All warnings will be emitted as error. Result in a non zero exit code in case of warning. + +**This is recommended to use in CI to prevent warning from being unadressed.** + +```yaml +warn-as-error: true +``` + +or via the cli + +```bash +tsp compile . --warn-as-error +``` + +### `--ignore-deprecated` + +Suppress all `deprecated` diagnostics that are raised when declarations are marked with the `#deprecated` directive. + +```yaml +tsp compile . --ignore-deprecated +``` + +### `imports` - Configure additional imports + +```yaml +imports: + - sidecar.tsp +``` + +Specify additional typespec files to import + +```bash +tsp compile . --import "sidecar.tsp" +``` + +### `emit` - Specifying which emitters to run + +Specify which emitters to use and their options if applicable. + +The value can be the name of an emitter or a path to the emitter package/entrypoint. + +```yaml +emit: + - emitter1 # Package name + - /path/to/emitter2 # Give a path to an emitter +``` + +or via the cli + +```bash +tsp compile . --emit emitter1 --emit /path/to/emitter2 +``` + +### `options` - Configuring emitters + +Emitters can define a set of options, those can be set as the value of the map. + +```yaml +options: + # Enable and configure emitter1 + emitter1: + option1: "option1-value" + option2: "option1-value" + # Only enable emitter2 + emitter2: true +``` + +Emitters options can also be provided using the `--option` in this format `--option=.=` + +```bash + +tsp compile . --option "emitter1.option1=option1-value" +``` + +Options specified via the CLI take precedence over the ones specified in `tspconfig.yaml`. + +#### Emitters built-in options + +##### `emitter-output-dir` + +Represent the path where the emitter should be outputing the generated files. + +Default: `{output-dir}/{emitter-name}` + +See [output directory configuration for mode details](#output-directory-configuration) + +### `linter` - Configuring linters + +Configure which linter rules should be enabled in this repository. Referencing to a rule or ruleset must be using their id which is in this format `:` + +```yaml +linter: + extends: # Extend `recommended` ruleset from @typespec/best-practices library + - "@typespec/best-practices/recommended" + + enable: # Explicitly enable some rules + "@typespec/best-practices/no-x": true + + disable: # Disable some rules defined in one of the ruleset extended. + "@typespec/best-practices/no-y": "This rule cannot be applied in this project because X" +``` + +## Emitter control cli flags + +### `--no-emit` + +Disable emitting. If emitters are still specified it will still run the emitter but emitters shouldn't be writing anything to disk. + +Can also be used to hide the "There is no emitters warning". + +```yaml +tsp compile . --no-emit +``` + +## Other Command line flags + +### `--config` + +Specify a different config file + +```bash +tsp compile . --config ./tspconfig.alt.yaml +``` + +### `--watch` + +Start the tsp compiler in watch mode: watch for file changes and compile on save. + +```bash +tsp compile . --watch +``` + +:::caution +Known issue: the watch mode does not pickup changes in JS files that are indirectly included(Only imported via another JS file.) +::: + +### `--nostdlib` + +Don't load the TypeSpec standard library. + +```bash +tsp compile . --nostdlib +``` + +### `--version` + +Log the version of the tsp compiler. + +```bash +tsp compile . --version +``` + +### `--pretty` + +**Default: `true`** + +Enable/Disable pretty logging(Colors, diagnostic preview, etc.). + +```bash +tsp compile . --pretty=false +``` + +## Output directory configuration + +Typespec compiler will provide a unique output directory for each emitter that is being run to reduce conflicts. +By default the output-dir of an emitter is set to this value: + +``` +{output-dir}/{emitter-name} +``` + +where + +- `output-dir` is the compiler common `output-dir` that can be configured via `--output-dir` +- `emitter-name` is the name of the emitter package(for example `@typespec/openapi3`) + +Example: +Given the following emitters: `@typespec/openapi3` and `@typespec/jsonschema`, the default output folder structure would be + +``` +{project-root}/tsp-output: + @typespec: + openapi3 + ... openapi3 files ... + jsonschema + ... json schema files ... +``` + +Changing the compiler `output-dir` with `--output-dir` or setting that value in the tspconfig.yaml would result in the following structure + +``` +--output-dir={cwd}/my-custom-output-dir + +{cwd}/my-custom-output-dir: + @typespec: + openapi3 + ... openapi3 files ... + jsonschema + ... json schema files ... + +``` + +Changing a specific emitter output-dir can be done by setting that emitter `emitter-output-dir` option + +``` +--option "@typespec/openapi3.output-dir={projectroot}/openapispec" + +{project-root} + openapispec: + ... openapi3 files ... + tsp-output: + @typespec: + jsonschema + ... json schema files ... +``` diff --git a/packages/website-astro/src/content/docs/latest/introduction/configuration/tracing.md b/packages/website-astro/src/content/docs/latest/introduction/configuration/tracing.md new file mode 100644 index 0000000000..3536f687f7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/configuration/tracing.md @@ -0,0 +1,85 @@ +--- +title: Tracing +--- + +# Tracing + +By default the TypeSpec Compiler will build without any debug information. The standard output will be minimal and limited to any `warning` or `error` diagnostics emitted during compilation. + +Some additional information is however being collected and can be revealed using the `--trace` cli flag. + +```bash +tsp compile . --trace import-resolution +``` + +You can use the `--trace` option multiple times if there is multiple areas that should be logged from. + +```bash +tsp compile . --trace import-resolution --trace projection +``` + +Using `--trace *` will log everything. This might be a bit overwhelming but you can [pick and choose which trace area to include](#trace-selection) + +It can also be provided via the `tspconfig.yaml` file: + +```yaml +trace: * + +trace: + - import-resolution + - projection +``` + +## Trace selection + +The tracing system in the tsp compiler works by having each trace under an area. The area name is a dot `.` separated string of area segments. + +When filtering which area to select you can use this area path to select which area is going to be revealed. +The filter follow the same naming style, except the last segment could be a wildcard `*`. This is however the same result as omitting the last segment all together. In other words, those filter have the exact same behavior: + +- `foo` and `foo.*` +- `one.two` and `one.two.*` + +For example, assuming we'd have those 3 areas + +- `one.two.three` +- `one.foo` +- `bar.info` + +Using: + +- `*` will log everything +- `one` will log everything under `one`(`one.two.three`, `one.foo`) +- `bar` will log everything under `bar`(`bar.info`) +- `one.foo` will log everything under `one.foo`(`one.foo`) +- `other` will log everything under `other` which is nothing here. + +## Compiler Trace Areas + +This is a list of the trace area used in the compiler + +| Area | Description | +| ------------------------------ | -------------------------------------------------------------------- | +| `compiler.options` | Log the resolved compiler options | +| `import-resolution.library` | Information related to the resolution of import libraries | +| `projection.log` | Debug information logged by the `log()` function used in projections | +| `bind.js` | Information when binding JS files | +| `linter.register-library` | Information that a library rules will be loaded | +| `linter.register-library.rule` | Information about a rule that is being registered | +| `linter.extend-rule-set.start` | Information about a ruleset it is about to extend | +| `linter.extend-rule-set.end` | Information about rules enabled after extending a ruleset | +| `linter.lint` | Start the lint process and show information of all the rules enabled | + +## Tracing in TypeSpec library + +TypeSpec libraries can emit their own tracing that can be collected using the same mechanism. It is recommended that a library scope their tracing area under the library name to prevent collision. This can be achieved by calling the `sub(subArea: string)` method on the tracer. + +```ts +const tracer = program.tracer.sub("my-library"); +``` + +the tracer is then available for trace collection + +```ts +tracer.trace("emitting-ts", "Emitting ts interface"); +``` diff --git a/packages/website-astro/src/content/docs/latest/introduction/editor/vs.md b/packages/website-astro/src/content/docs/latest/introduction/editor/vs.md new file mode 100644 index 0000000000..4ef5613854 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/editor/vs.md @@ -0,0 +1,38 @@ +--- +title: TypeSpec Visual Studio Extension +--- + +## Installation + +:::note +Extension is not available yet in the marketplace and must be installed via the command line. +::: + +```bash +tsp vs install +``` + +## Configure + +1. Create a file `.vs/VSWorkspaceSettings.json` at the root of the project. +2. Add configuration as key value pair in this file. Example: + +```json +{ + "typespec.tsp-server.path": "${workspaceFolder}/my-nested-project/node_modules/@typespec/compiler" +} +``` + +TypeSpec wil interpolate a few variables using this pattern `${}`. For example `${workspaceFolder}`. + +Available variables: + +- `workspaceFolder`: Correspond to the root of your Visual Studio workspace. + +## Uninstall + +Uninstalling can be done via the Visual Studio extension manager or via the command line: + +```bash +tsp vs uninstall +``` diff --git a/packages/website-astro/src/content/docs/latest/introduction/editor/vscode.md b/packages/website-astro/src/content/docs/latest/introduction/editor/vscode.md new file mode 100644 index 0000000000..81e5427cfe --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/editor/vscode.md @@ -0,0 +1,46 @@ +--- +title: TypeSpec VSCode extension +--- + +## Installation + +:::note +Extension is not available yet in the marketplace and must be installed via the command line. +::: + +```bash +tsp code install + +# For VSCode insiders +tsp code install --insiders +``` + +## Configure + +TypeSpec wil interpolate a few variables using this pattern `${}`. For example `${workspaceFolder}`. + +Available variables: + +- `workspaceFolder`: Corespond to the root of your Visual Studio workspace. + +### `typespec.tsp-server.path`: Configure the server path + +There are cases where the TypeSpec project is located in a subfolder. In such cases, the TypeSpec extension is not able to find the tsp compiler automatically and needs a little guidance. +This setting provides the ability to configure where the tsp compiler is located. + +```json +{ + "typespec.tsp-server.path": "${workspaceFolder}/my-nested-project/node_modules/@typespec/compiler" +} +``` + +## Uninstall + +Uninstalling can be done via the Visual Studio Code extension manager or via the command line: + +```bash +tsp code uninstall + +# For VSCode insiders +tsp code uninstall --insiders +``` diff --git a/packages/website-astro/src/content/docs/latest/introduction/faq.md b/packages/website-astro/src/content/docs/latest/introduction/faq.md new file mode 100644 index 0000000000..15f3867c50 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/faq.md @@ -0,0 +1,16 @@ +--- +id: faq +title: FAQ +--- + +# Frequently Asked Questions + +## `Cannot find package 'x' imported from 'y'` but not using this package + +This is most likely due to package y having a `peerDependency` on package `x` and package x wasn't installed. +Verify the version of npm you are using. Before version 7 peerDependencies would not get installed automatically and you would have to manually install them. + +### Solutions + +- Update npm `npm install -g npm` +- If you cannot update npm, then adding the dependencies to your project dependency should resolve the issue `npm install x` diff --git a/packages/website-astro/src/content/docs/latest/introduction/formatter.md b/packages/website-astro/src/content/docs/latest/introduction/formatter.md new file mode 100644 index 0000000000..330e791b3e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/formatter.md @@ -0,0 +1,44 @@ +--- +id: formatter +title: Formatter +--- + +# Formatter + +TypeSpec comes with a built-in formatter. The formatter can be used in different ways: + +- [Via the cli](#via-the-cli) +- Via the vscode/vs extension +- As a prettier plugin + +## Via the cli + +Format all typespec files: + +```bash +tsp format **/*.tsp +``` + +Validate that the files are formatted but don't format them. Useful for enforcing in CI. + +```bash +tsp format --check **/*.tsp +``` + +## Via the VSCode or VS extension + +When using the VS Code or Visual Studio extensions, the tsp formatter is automatically available. + +Using the keyboard shortcut for formatting the document (`alt+shift+F` by default) when inside a TypeSpec file will format the document. + +## Via prettier + +Underneath the tsp formatter is a prettier plugin. If you already have a prettier configuration for formatting other languages it can be convenient to just have typespec plug in into this existing pipeline. + +In your prettier config file, add: + +```yaml +plugins: + - "./node_modules/@typespec/prettier-plugin-typespec" +overrides: [{ "files": "*.tsp", "options": { "parser": "typespec" } }] +``` diff --git a/packages/website-astro/src/content/docs/latest/introduction/installation.md b/packages/website-astro/src/content/docs/latest/introduction/installation.md new file mode 100644 index 0000000000..603a93f95a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/installation.md @@ -0,0 +1,61 @@ +--- +id: installation +title: Installation +--- + +# Installation + +## Requirements + +Install [Node.js 16 LTS](https://nodejs.org/en/download/) and ensure you are able to run the `npm` command in a command prompt: + +```bash +npm --version +``` + +It is recommended to have npm 7+. To update npm run `npm install -g npm` + +## Install tsp compiler + +First step is to install the tsp compiler/cli + +```bash +npm install -g @typespec/compiler +``` + +## Install the VS and VSCode extensions + +TypeSpec provides extension for the following editors: + +- [Visual Studio Code](./editor/vscode.md) +- [Visual Studio](./editor/vscode.md) + +## Create first TypeSpec Project + +To get your first TypeSpec project started run in a fresh directory + +```bash +tsp init +``` + +This will prompt you with a few question, pick the `Generic Rest API` template, your project name, and select the `@typespec/openapi3` library. + +Next, you can install the dependencies + +```bash +tsp install +``` + +You should now have a basic TypeSpec project setup with a structure looking like + +```bash +package.json # Package manifest defining your typespec project as a node package. +tspconfig.yaml # TypeSpec project configuration letting you configure emitters, emitter options, compiler options, etc. +main.tsp # TypeSpec entrypoint +``` + +## Compile project + +```bash +tsp compile . +``` diff --git a/packages/website-astro/src/content/docs/latest/introduction/introduction.md b/packages/website-astro/src/content/docs/latest/introduction/introduction.md new file mode 100644 index 0000000000..3ea0903fd4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/introduction.md @@ -0,0 +1,15 @@ +--- +id: introduction +title: Introduction +--- + +# Introduction to TypeSpec + +TypeSpec is a language for describing cloud service APIs and generating other API description languages, client and service code, documentation, and other assets. TypeSpec provides highly extensible core language primitives that can describe API shapes common among REST, GraphQL, gRPC, and other protocols. + +## Try TypeSpec + +You can try TypeSpec on the web without installing anything. + +- [TypeSpec playground](https://cadlplayground.z22.web.core.windows.net) +- [TypeSpec playground for Azure services](https://azure.github.io/typespec-azure/playground) diff --git a/packages/website-astro/src/content/docs/latest/introduction/releases.md b/packages/website-astro/src/content/docs/latest/introduction/releases.md new file mode 100644 index 0000000000..e60842968c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/releases.md @@ -0,0 +1,60 @@ +--- +id: releases +title: Releases +--- + +# Releases + +## Package versioning strategy + +TypeSpec is not stable yet, all packages are released with `0.` major version. Each minor version might have some breaking changes to the typespec language, library API or both. Those are documented [here](../release-notes). + +Every change to the `main` branch is automatically published under the npm `@next` tag. + +## Current packages + +| Name | Changelog | Latest | Next | +| -------------------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| Core functionality | | | | +| [@typespec/compiler][compiler_src] | [Changelog][compiler_chg] | [![](https://img.shields.io/npm/v/@typespec/compiler)](https://www.npmjs.com/package/@typespec/compiler) | ![](https://img.shields.io/npm/v/@typespec/compiler/next) | +| TypeSpec Libraries | | | | +| [@typespec/rest][rest_src] | [Changelog][rest_chg] | [![](https://img.shields.io/npm/v/@typespec/rest)](https://www.npmjs.com/package/@typespec/rest) | ![](https://img.shields.io/npm/v/@typespec/rest/next) | +| [@typespec/openapi][openapi_src] | [Changelog][openapi_chg] | [![](https://img.shields.io/npm/v/@typespec/openapi)](https://www.npmjs.com/package/@typespec/openapi) | ![](https://img.shields.io/npm/v/@typespec/openapi/next) | +| [@typespec/openapi3][openapi3_src] | [Changelog][openapi3_chg] | [![](https://img.shields.io/npm/v/@typespec/openapi3)](https://www.npmjs.com/package/@typespec/openapi3) | ![](https://img.shields.io/npm/v/@typespec/openapi3/next) | +| [@typespec/versioning][versioning_src] | [Changelog][versioning_chg] | [![](https://img.shields.io/npm/v/@typespec/versioning)](https://www.npmjs.com/package/@typespec/versioning) | ![](https://img.shields.io/npm/v/@typespec/versioning/next) | +| TypeSpec Tools | | | | +| [@typespec/prettier-plugin-typespec][prettier_src] | [Changelog][prettier_chg] | [![](https://img.shields.io/npm/v/@typespec/prettier-plugin-typespec)](https://www.npmjs.com/package/@typespec/prettier-plugin-typespec) | ![](https://img.shields.io/npm/v/@typespec/prettier-plugin-typespec/next) | +| [typespec-vs][typespec-vs_src] | [Changelog][typespec-vs_chg] | [![](https://img.shields.io/npm/v/typespec-vs)](https://www.npmjs.com/package/typespec-vs) | ![](https://img.shields.io/npm/v/typespec-vs/next) | +| [typespec-vscode][typespec-vscode_src] | [Changelog][typespec-vscode_chg] | [![](https://img.shields.io/npm/v/typespec-vscode)](https://www.npmjs.com/package/typespec-vscode) | ![](https://img.shields.io/npm/v/typespec-vscode/next) | +| [tmlanguage-generator][tmlanguage_src] | [Changelog][tmlanguage_chg] | [![](https://img.shields.io/npm/v/tmlanguage-generator)](https://www.npmjs.com/package/tmlanguage-generator) | ![](https://img.shields.io/npm/v/tmlanguage-generator/next) | + +[compiler_src]: https://github.com/microsoft/typespec/blob/main/packages/compiler +[compiler_chg]: https://github.com/microsoft/typespec/blob/main/packages/compiler/CHANGELOG.md +[rest_src]: https://github.com/microsoft/typespec/blob/main/packages/rest +[rest_chg]: https://github.com/microsoft/typespec/blob/main/packages/rest/CHANGELOG.md +[openapi_src]: https://github.com/microsoft/typespec/blob/main/packages/openapi +[openapi_chg]: https://github.com/microsoft/typespec/blob/main/packages/openapi/CHANGELOG.md +[openapi3_src]: https://github.com/microsoft/typespec/blob/main/packages/openapi3 +[openapi3_chg]: https://github.com/microsoft/typespec/blob/main/packages/openapi3/CHANGELOG.md +[versioning_src]: https://github.com/microsoft/typespec/blob/main/packages/versioning +[versioning_chg]: https://github.com/microsoft/typespec/blob/main/packages/versioning/CHANGELOG.md +[prettier_src]: https://github.com/microsoft/typespec/blob/main/packages/prettier-plugin-typespec +[prettier_chg]: https://github.com/microsoft/typespec/blob/main/packages/prettier-plugin-typespec/CHANGELOG.md +[typespec-vs_src]: https://github.com/microsoft/typespec/blob/main/packages/typespec-vs +[typespec-vs_chg]: https://github.com/microsoft/typespec/blob/main/packages/typespec-vs/CHANGELOG.md +[typespec-vscode_src]: https://github.com/microsoft/typespec/blob/main/packages/typespec-vscode +[typespec-vscode_chg]: https://github.com/microsoft/typespec/blob/main/packages/typespec-vscode/CHANGELOG.md +[tmlanguage_src]: https://github.com/microsoft/typespec/blob/main/packages/tmlanguage-generator +[tmlanguage_chg]: https://github.com/microsoft/typespec/blob/main/packages/tmlanguage-generator/CHANGELOG.md + +## Release cadence + +We release changes from all packages the first week of every month. + +You can look at the millestones https://github.com/microsoft/typespec/milestones to see upcoming changes. Millestones are named after the target release month (i.e `[2022] October` is the sprint running in september targeting a release in the first week of October.) + +## Breaking changes migration guides + +Release notes describing the breaking changes and how to migrate can be found in this folder: + +[https://github.com/microsoft/typespec/tree/main/docs/release-notes](https://github.com/microsoft/typespec/tree/main/docs/release-notes) diff --git a/packages/website-astro/src/content/docs/latest/introduction/reproducibility.md b/packages/website-astro/src/content/docs/latest/introduction/reproducibility.md new file mode 100644 index 0000000000..c8f9b986b6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/reproducibility.md @@ -0,0 +1,36 @@ +--- +title: Reproducibility +--- + +A key point to service definition is the ability to reliably reproduce the exact same output over time. In cases like: + +1. A dependency or dependency of dependency was updated with an unintended breaking change +2. Changes to a new version of a service shouldn't affect the older versions +3. A change to the TypeSpec spec + +This can be mitigated with a few steps: + +## 1. Defend against dependency changes + +_Note: This section applies if using `tsp install` or `npm install` to install dependencies. However other package managers (`yarn`, `pnpm`, etc.) have their own similar lock mechanisms._ + +When using `tsp install` or `npm install` a `package-lock.json` will be installed. This file SHOULD be committed to source control. It will ensure that later calls to `tsp install` or `npm install` will use the exact versions resolved in the lock files unless the `package.json` was updated or a command like `npm update` was run. + +The command `npm ci` can also be used in the CI to ensure that the `package.json` and `package-lock.json` are in sync. + +## 2. Work with multiple versions of a service + +TypeSpec provides a library `@typespec/versioning` that can be used to describe changes to a service or library over time. Using this will ensure that a service can evolve while keeping track of the changes and allowing emitters to see the service representation at different versions. + +[See versioning docs](../standard-library/versioning/reference/index.md) + +## 3. Change to the TypeSpec spec + +If you don't directly control the spec, you might still want to make sure you remember which exact definition was used. +Using version control and pinning to a specific commit SHA will ensure that the spec will remain exactly as it was. + +## Summary + +1. Use `package-lock.json` +2. Use [versioning library](../standard-library/versioning/reference/index.md) +3. Keep track of commit IDs diff --git a/packages/website-astro/src/content/docs/latest/introduction/style-guide.md b/packages/website-astro/src/content/docs/latest/introduction/style-guide.md new file mode 100644 index 0000000000..3d5a548d95 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/style-guide.md @@ -0,0 +1,221 @@ +--- +title: Style guide +--- + +# TypeSpec Language Style Guide + +This is a guide providing a recommended set of naming convention to use when writing a TypeSpec spec. + +:::info +The guidelines in this article are used in TypeSpec Core libraries. You can use them, or adapt them to your needs. The primary objectives are consistency and readability within your project, team, organization, or company source code. +::: + +## Naming convention + +| Type | Naming | Example | +| ---------------- | -------------------------------------------- | ------------------------------------------------ | +| scalar | camelCase | `scalar uuid extends string;` | +| model | PascalCase | `model Pet {}` | +| model property | camelCase | `model Pet {furColor: string}` | +| enum | PascalCase | `enum Direction {}` | +| enum member | camelCase | `enum Direction {up, down}` | +| namespace | PascalCase | `namespace Org.PetStore` | +| interface | PascalCase | `interface Stores {}` | +| operation | camelCase | `op listPets(): Pet[];` | +| operation params | camelCase | `op getPet(petId: string): Pet;` | +| unions | PascalCase | `union Pet {cat: Cat, dog: Dog}` | +| unions variants | camelCase | `union Pet {cat: Cat, dog: Dog}` | +| alias | camelCase or PascalCase depending on context | `alias myString = string` or `alias MyPet = Pet` | +| decorators | camelCase | `@format`, `@resourceCollection` | +| functions | camelCase | `addedAfter` | +| file name | kebab-case | `my-lib.tsp` | + +## Layout convention + +TypeSpec has a built-in formatter. See [formatter section](./formatter.md) for more information on how to use it. + +- Use 2 space indenting + + +```typespec +// bad +model Pet { + name: string; +} + +// good +model Pet { + name: string; +} +``` + +- Place a space before an opening curly brace + + +```typespec +// bad +model Pet{ + name: string; +} + +// good +model Pet { + name: string; +} +``` + +- Block opening curly brace `{` should be on the same line + + +```typespec +// bad +model Pet +{ + name: string; +} + +// good +model Pet { + name: string; +} +``` + +- Add a newline after blocks + + +```typespec +// bad +model Pet { + name: string; +} +model Cat extends Pet {} + +// good +model Pet { + name: string; +} + +model Cat extends Pet {} +``` + +- Place no space between an operation/decorator/function name and the parameter list + + +```typespec +// bad +op list (filter: string): Pet[]; + +// bad +@doc ("This is a pet") + +// good +op list(filter: string): Pet[]; + +// good +@doc("This is a pet") +``` + +- Do not add spaces inside parentheses + + +```typespec +// bad +op list( filter: string ): Pet[]; + +// good +op list(filter: string): Pet[]; + +``` + +- Add spaces inside curly braces. + + +```typespec +// bad +alias foo = {type: "cat"}; + +// good +alias foo = { type: "cat" }; +``` + +- Do not add space inside square brackets + + +```typespec +// bad +alias foo = [ 1, 2, 3 ]; + +// good +alias foo = [1, 2, 3]; +``` + +- Start all comments with a space + + +```typespec +//bad + +// good +``` + +- Avoid trailing spaces at the end of lines. + +### Model layout + +- Properties should hug each other unless it has decorators or comments + + +```tsp +// bad +model Foo { + one: string; + + two: string; + + three: string; +} + +// good +model Foo { + one: string; + two: string; + three: string; +} +``` + +- Wrap properties in new lines if it has leading comments or decorators + + +```tsp +// bad +model Foo { + one: string; + @doc("Foo") + two: string; + // line comment + three: string; + /** + * Block comment + */ + four: string; + five: string; +} + +// good +model Foo { + one: string; + + @doc("Foo") + two: string; + + // line comment + three: string; + + /** + * Block comment + */ + four: string; + + five: string; +} +``` diff --git a/packages/website-astro/src/content/docs/latest/introduction/usage.md b/packages/website-astro/src/content/docs/latest/introduction/usage.md new file mode 100644 index 0000000000..8d53564225 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/introduction/usage.md @@ -0,0 +1,31 @@ +--- +id: usage +title: Usage +--- + +# Usage + +See full usage documentation by typing `tsp --help`: + +```bash +>tsp --help +TypeSpec compiler v0.36.1 + +tsp + +Commands: + tsp compile Compile TypeSpec source. + tsp code Manage VS Code Extension. + tsp vs Manage Visual Studio Extension. + tsp format Format given list of TypeSpec files. + tsp init [templatesUrl] Create a new TypeSpec project. + tsp install Install typespec dependencies + tsp info Show information about current TypeSpec compiler. + +Options: + --help Show help [boolean] + --debug Output debug log messages. [boolean] [default: false] + --pretty Enable color and formatting in TypeSpec's output to make compiler error + s easier to read. [boolean] [default: true] + --version Show version number [boolean] +``` diff --git a/packages/website-astro/src/content/docs/latest/language-basics/alias.md b/packages/website-astro/src/content/docs/latest/language-basics/alias.md new file mode 100644 index 0000000000..42bac207dc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/alias.md @@ -0,0 +1,16 @@ +--- +id: aliases +title: Aliases +--- + +# Alias + +Aliases can be defined for types. This can be helpful 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`](./models.md) to provide an alternate name for a model. + +Alias can be defined using the `alias` keyword + +```typespec +alias Options = "one" | "two"; +``` diff --git a/packages/website-astro/src/content/docs/latest/language-basics/built-in-types.md b/packages/website-astro/src/content/docs/latest/language-basics/built-in-types.md new file mode 100644 index 0000000000..a3d9e1d713 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/built-in-types.md @@ -0,0 +1,63 @@ +--- +id: built-in-types +title: Built-in types +--- + +# Built-in Types + +TypeSpec Standard Library provide some built-in types that can be used to build more complex types. + +Built in types are related to each other according to the rules described in [type relations](../language-basics/type-relations.md). + +## Numeric types + +| Type | Range | Description | +| ------------ | ------------------------------------------------------------------------------------------------------------ | ----------------------------------------- | +| `numeric` | | Parent type for all numeric types | +| `integer` | | A whole-number | +| `float` | | A binary number | +| `int64` | `-9,223,372,036,854,775,808` to `9,223,372,036,854,775,807` | A 64-bit integer | +| `int32` | `-2,147,483,648` to `2,147,483,647` | A 32-bit integer | +| `int16` | `-32,768` to `32,767` | A 16-bit integer | +| `int8` | `-128` to `127` | A 8-bit integer | +| `safeint` | −9007199254740991 (−(253 − 1)) to 9007199254740991 (253 − 1) | An integer that can be serialized to JSON | +| `uint64` | `0` to `18,446,744,073,709,551,615` | Unsigned 64-bit integer | +| `uint32` | `0` to `4,294,967,295` | Unsigned 32-bit integer | +| `uint16` | `0` to `65,535` | Unsigned 16-bit integer | +| `uint8` | `0` to `255 ` | Unsigned 8-bit integer | +| `float32` | ±1.5 x 1045 to ±3.4 x 1038 | A 32 bit floating point number | +| `float64` | ±5.0 × 10−324 to ±1.7 × 10308 | A 64 bit floating point number | +| `decimal` | | A decimal number | +| `decimal128` | 34 decimal digits with an exponent range from `-6143` to `6144` | A 128 bit decimal number | + +## Date and time types + +| Type | Description | +| ---------------- | ----------------------------------------------------------------------------------- | +| `plainDate` | A date on a calendar without a time zone, e.g. "April 10th" | +| `plainTime` | A time on a clock without a time zone, e.g. "3:00 am" | +| `utcDateTime` | A date and time in coordinated universal time (UTC), e.g. "1985-04-12T23:20:50.52Z" | +| `offsetDateTime` | A date and time in a particular time zone, e.g. "April 10th at 3:00am in PST" | +| `duration` | A duration/time period. e.g 5s, 10h | + +## Other core types + +| Type | Description | +| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `bytes` | A sequence of bytes | +| `string` | A sequence of textual characters | +| `boolean` | Boolean with `true` and `false` values | +| `null` | Null value | +| `Array` | Array model type, equivalent to `T[]` | +| `Record` | Model with string keys where all the values have type `T` (similar to `Map` in TypeScript or `Dictionary` in .Net) | +| `unknown` | A top type in TypeSpec that all types can be assigned to. Values that can have any type should be assigned this value (similar to `any` in JavaScript) | +| `void` | A function/operation return type indicating the function/operation doesn't return a value. | +| `never` | The never type indicates the values that will never occur. | + +## String types + +Built-in types that are known string formats + +| Type | Description | +| ----- | ------------ | +| `url` | A url String | diff --git a/packages/website-astro/src/content/docs/latest/language-basics/decorators.md b/packages/website-astro/src/content/docs/latest/language-basics/decorators.md new file mode 100644 index 0000000000..929cbe5dc8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/decorators.md @@ -0,0 +1,64 @@ +--- +id: decorators +title: Decorators +--- + +# Decorators + +Decorators enable a developer to attach metadata to types in a TypeSpec program. They can also be used to calculate types based on their inputs. Decorators are the backbone of TypeSpec's extensibility and give it the flexibility to describe many different kinds of APIs and associated metadata like documentation, constraints, samples, and the like. + +Many TypeSpec constructs can be decorated, including [namespaces](./namespaces.md), [operations](./operations.md) and their parameters, and [models](./models.md) and their members. + +Decorators are defined using JavaScript functions that are exported from a standard ECMAScript module. When you import a JavaScript file, TypeSpec will look for any exported functions prefixed with `$`, and make them available as decorators inside the TypeSpec syntax. When a decorated declaration is evaluated by TypeSpec, it will invoke the decorator function, passing along a reference to the current compilation, an object representing the type it is attached to, and any arguments the user provided to the decorator. + +## Using decorators + +Decorators are referenced using the `@` prefix and must be specified before the entity they are decorating. Arguments can be provided by using parentheses in a manner similar to many programming languages, e.g. `@myDec1, "hi", { a: string })`. + +The following shows an example of declaring and then using a decorator: + +```typespec +@tag("Sample") +model Dog { + @validate(false) + name: string; +} +``` + +The parentheses can be omitted when no arguments are provided. + +```typespec +@mark +model Dog {} +``` + +## Augment decorators + +Decorators can also be used from a different location by referring to the type being decorated. For this you can declare an augment decorator using the `@@` prefix. The first argument of an augment decorator is the type reference that should be decorated. As the augment decorator is a statement, it must end with a semicolon (`;`). + +```typespec +model Dog {} + +@@tag(Dog, "Sample"); +``` + +Which is equivalent to + +```typespec +@tag("Sample") +model Dog {} +``` + +Example: Decorate a model property + +```typespec +model Dog { + name: string; +} + +@@readOnly(Dog.name); +``` + +## Writing decorator + +[See creating decorator documentation](../extending-typespec/create-decorators.md) diff --git a/packages/website-astro/src/content/docs/latest/language-basics/documentation.md b/packages/website-astro/src/content/docs/latest/language-basics/documentation.md new file mode 100644 index 0000000000..d8ce3e7806 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/documentation.md @@ -0,0 +1,74 @@ +--- +id: documentation +title: Documentation +--- + +# Documentation + +Documentation is crucial to any API. TypeSpec provides a number of ways to document your API using TSDoc doc comments and decorators. + +# Documenting APIs + +## `@doc` Decorator + +The `@doc` decorator can be used to attach documentation to most TypeSpec declarations. It most-commonly accepts a string argument that will be used as the documentation for the declaration. + +```typespec +@doc("This is a sample model") +model Dog { + @doc("This is a sample property") + name: string; +} +``` + +The `@doc` decorator can also accept a source object which can be used, for example, to provide templated documentation for a generic type. + +```typespec +@doc("Templated {name}", T) +model Template { +} + +// doc will read "Templated A" +model A is Template +``` + +## TSDoc Doc Comments + +TSDoc doc comments are a standard way to document TypeScript code. They are supported by many IDEs and can be used to generate external documentation using tools like [TypeDoc](https://typedoc.org/). + +You can annotate objects in your TypeSpec spec with TSDoc doc comments. These comments will be considered the same as if they were attached using the `@doc` decorator and can be used to generate external documentation. + +```typespec +/** + * Get a widget. + * @param widgetId The ID of the widget to retrieve. + * / +op @get create(@path widgetId: string): Widget | Error; +``` + +This is functionally equivalent to: + +```typespec +@doc("Get a widget.") +op @get create( + @doc("The ID of the widget to retrieve.") + @path + widgetId: string): Widget | Error; +``` + +The benefit to using TSDoc doc comment syntax is that it keeps all of the documentation for a declaration in one place, making it easier to read and maintain. Additionally, it allows the generation of documentation using tools like TypeDoc without having to write a custom emitter to examine the `@doc` metadata. + +# Comments + +TypeSpec supports both single-line and multi-line comments. Single-line comments start with `//` and continue until the end of the line. Multi-line comments start with `/*` and continue until the closing `*/` is encountered. + +```typespec +// This is a single-line comment +model Dog { + /* This is a multi-line comment + that spans multiple lines */ + name: string; +} +``` + +Comments are ignored by the compiler and are not included in the generated output. They are intended to be used to document your spec internally and are not suitable for generating external documentation. diff --git a/packages/website-astro/src/content/docs/latest/language-basics/enums.md b/packages/website-astro/src/content/docs/latest/language-basics/enums.md new file mode 100644 index 0000000000..2d5251ed74 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/enums.md @@ -0,0 +1,81 @@ +--- +id: enums +title: Enums +--- + +# Enums + +Enums allow a developer to define a set of named constants. Using enums can make it easier to document intent, or create a set of distinct cases. Enums can either be numeric or string-based. For other types, look into [union](./unions.md) + +## Basics + +Enums are declared using the `enum` keyword. +The enums members are comma `,` separated and can be typespec `identifier`s or `string literal`s. + +```typespec +enum Direction { + North, + East, + South, + West, +} +``` + +In this case, we haven't specified how the constants will be represented. Different scenarios might handle the enums differently. + +## Values + +Enums members can have a custom value that can be assigned using the `:` operator. + +```typespec +enum Direction { + North: "north", + East: "east", + South: "south", + West: "west", +} +``` + +Values can also be integers. + +```typespec +enum Foo { + One: 1, + Ten: 10, + Hundred: 100, + Thousand: 1000, +} +``` + +or float + +```typespec +enum Hour { + Zero: 0, + Quarter: 0.25, + Half: 0.5, + ThreeQuarter: 0.75, +} +``` + +## Composing enums + +Enums can be reused using the spread `...` pattern. All the members of the source enums will be copied in the target enum but it doesn't create any reference between the source and target enums. + +```typespec +enum DirectionExt { + ...Direction, + `North East`, + `North West`, + `South East`, + `South West`, +} +``` + +## Referencing enum members + +Enum members can be referenced using the `.` operator for identifiers. + +```typespec +alias North = Direction.North; +``` diff --git a/packages/website-astro/src/content/docs/latest/language-basics/imports.md b/packages/website-astro/src/content/docs/latest/language-basics/imports.md new file mode 100644 index 0000000000..2118916736 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/imports.md @@ -0,0 +1,51 @@ +--- +id: imports +title: Imports +--- + +# Import + +Imports add files or libraries to your TypeSpec program. When you compile a TypeSpec file, you provide a path to your root TypeSpec file, by convention called "main.tsp". From there, any files you import are added to your program. If you import a directory, TypeSpec will look for a `main.tsp` file inside that directory. + +The path you import must either begin with `"./"` or `"../"` or otherwise be an absolute path. The path must either refer to a directory, or else have an extension of either ".tsp" or ".js". The following demonstrates how to use imports to assemble a TypeSpec program from multiple files: + +## Import TypeSpec file + +```typespec +import "./models/foo.tsp"; +``` + +## Import Js file + +```typespec +import "./decorators.js"; +``` + +## Import a library + +The import value can be name one of the package dependencies. In that case typespec will lookup for the `package.json` file and check the `tspMain` entry (or default to `main` if absent) to decide what is the library entrypoint to load. + +```typespec +import "@typespec/rest"; +``` + +```json +// ./node_modules/@typespec/rest/package.json +{ + "tspMain": "./lib/main.tsp" +} +``` + +which result in `./node_modules/@typespec/rest/lib/main.tsp` to be imported + +## Import a directory + +If the import value is a directory it will lookup if that directory is a node package and follow the npm package [lookup logic](#import-a-library) or if the directory contains a `main.tsp`. + +```typespec +import "./models"; // same as `import "./models/main.tsp"; +``` + +```typespec +import "./path/to/local/module"; // Assuming this path is a typespec package, it will load it using the tspMain file. +``` diff --git a/packages/website-astro/src/content/docs/latest/language-basics/interfaces.md b/packages/website-astro/src/content/docs/latest/language-basics/interfaces.md new file mode 100644 index 0000000000..ab22cb7a56 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/interfaces.md @@ -0,0 +1,102 @@ +--- +id: interfaces +title: Interfaces +--- + +# Interfaces + +Interfaces can be used to group and reuse [operations](./operations.md). + +Interfaces are declared using the `interface` keyword. + +```typespec +interface SampleInterface { + foo(): int32; + bar(): string; +} +``` + +## Composing interfaces + +The keyword `extends` can be used to compose operations from other interfaces into a new interface. + +Given the following interfaces + +```typespec +interface A { + a(): string; +} + +interface B { + b(): string; +} +``` + +a new interface `C` can be created including all operations from `A` and `B` + +```typespec +interface C extends A, B { + c(): string; +} +``` + +which is equivalent to + +```typespec +interface C { + a(): string; + b(): string; + c(): string; +} +``` + +## Interface template + +Interfaces can be templated, [see templates](./templates.md) for details on templates. + +```typespec +interface ReadWrite { + read(): T; + write(t: T): void; +} +``` + +## Interface operation templates + +Operations defined inside of an interface can also be templated. ([see templates](./templates.md) for details on templates.) + +```typespec +interface ReadWrite { + read(): T; + write(t: T): R; +} + +alias MyReadWrite = ReadWrite; + +op myWrite is MyReadWrite.write; +``` + +:::caution +Any uninstantiated, templated operation defined in an interface will be excluded from the list of service operations. + +This also applies when using `extends` on an interface that contains templated operations with unfilled template arguments. + +```typespec +interface ReadWrite { + read(): T; + write(t: T): R; +} + +interface MyReadWrite extends ReadWrite {} // Here the `read()` operation is fully instantiated and will be included in a service definition. `write()` however isn't. +``` + +When working with building block interface like this use alias to create your interface building block instead of `interface extends`. This way the instantiated interface and its member will not be resolved in the service definition. + +```typespec +alias MyReadWrite = ReadWrite; + +op myRead is MyReadWrite.read; +op myWrite is MyReadWrite.write; +``` + +::: diff --git a/packages/website-astro/src/content/docs/latest/language-basics/intersections.md b/packages/website-astro/src/content/docs/latest/language-basics/intersections.md new file mode 100644 index 0000000000..15e9fe8ff2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/intersections.md @@ -0,0 +1,21 @@ +--- +id: intersections +title: Intersections +--- + +# Intersections + +Intersections describe a type that must include all the intersection's constituents. Declare an intersection with the `&` operator. + +```typespec +alias Dog = Animal & Pet; +``` + +An intersection is equivalent to [spreading](./models.md#spread) both types. + +```typespec +alias Dog = { + ...Animal; + ...Pet; +}; +``` diff --git a/packages/website-astro/src/content/docs/latest/language-basics/models.md b/packages/website-astro/src/content/docs/latest/language-basics/models.md new file mode 100644 index 0000000000..3b78fd581d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/models.md @@ -0,0 +1,183 @@ +--- +id: models +title: Models +--- + +# Models + +TypeSpec models are used to describe data shapes or schemas. + +## Model kinds + +Models can be used to represent 2 types: + +- [Record](#record) +- [Array](#array) + +### Record + +Record models are structure with named fields called properties. + +- name can be an `identifier` or `string literal`. +- type can be any type reference +- properties are ordered. See [ordering of properties](#ordering-of-properties) + +```typespec +model Dog { + name: string; + age: number; +} +``` + +#### Optional properties + +Properties can be marked as optional using the `?` punctuation. + +```typespec +model Dog { + address?: string; +} +``` + +#### Default values + +[Optional properties](#optional-properties) can be provided with a default value using `=` operator. + +```typespec +model Dog { + address?: string = "wild"; +} +``` + +#### Ordering of properties + +Properties are ordered in the order that they appear in source. Properties obtained via `model is` appear before properties defined in the model body. Properties obtained via `...` are inserted where the spread appears in source. + +Example: + +```tsp +model Pet { + name: string; + age: int32; +} + +model HasHome { + address: string; +} + +model Cat is Pet { + meow: boolean; + ...HasHome; + furColor: string; +} + +// Resulting property order for cat: +// name, age, meow, address, furColor +``` + +### Special property types + +#### `never` + +A model property can be declared as having the type never. This can be interpreted as the model not having that property. + +This can be useful in a model template to omit a property. + +```typespec +model Address { + state: TState; + city: string; + street: string; +} + +model UKAddress is Address; +``` + +:::note +It is up to the emitter to remove `never` properties. The TypeSpec compiler will not automatically omit them. +::: + +### Array + +Array are models created using the `[]` syntax which is just a syntactic sugar for using the `Array` 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. + +```typespec +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. + +```typespec +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](./decorators.md) as well. One common use case is to give a better name to a [template](#Templates) instantiation: + +```typespec +@decorator +model Thing { + property: T; +} + +model StringThing is Thing; + +// StringThing declaration is equivalent to the following declaration: +@decorator +model StringThing { + property: string; +} +``` + +## Model templates + +[See templates](./templates.md) for details on templates + +```typespec +model Page { + size: number; + item: T[]; +} + +model DogPage { + ...Page; +} +``` + +## Meta type references + +Some model property meta types can be referenced using `::` + +| Name | Example | Description | +| ---- | ---------------- | ---------------------------------------- | +| type | `Pet.name::type` | Reference the type of the model property | diff --git a/packages/website-astro/src/content/docs/latest/language-basics/namespaces.md b/packages/website-astro/src/content/docs/latest/language-basics/namespaces.md new file mode 100644 index 0000000000..18f24aba48 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/namespaces.md @@ -0,0 +1,98 @@ +--- +id: namespaces +title: Namespaces +--- + +# Namespaces + +Namespaces let you group related types together into namespaces. This helps organize your types, making them easier to find and prevents name conflicts. Namespaces are merged across files, so you can reference any type anywhere in your TypeSpec program via its namespace. + +## Basics + +Create a namespace with the `namespace` keyword. + +```typespec +namespace SampleNamespace { + model SampleModel {} +} +``` + +_The name of a namespace must be a valid TypeSpec identifier._ + +The `SampleNamespace` can then be used from other places: + +```typespec +model Foo { + sample: SampleNamespace.SampleModel; +} +``` + +## Nested namespace + +Namespaces can contain sub namespaces providing additional granularity + +```typespec +namespace Foo { + namespace Bar { + namespace Baz { + model SampleModel {} + } + } +} +``` + +or this can be simplified using `.` notation + +```typespec +namespace Foo.Bar.Baz { + model SampleModel {} +} +``` + +The sub-namespace can then be used from other places using the fully qualified name. + +```typespec +model A { + sample: Foo.Bar.Baz.SampleModel; +} +``` + +## File namespace + +A namespace for all declarations contained in a file can be provided at the top (After the `import` statements) using a blockless namespace statement + +```typespec +namespace SampleNamespace; + +model SampleModel {} +``` + +A file can only have a single blockless namespace. + +## Using a namespace + +The content of a namespace can be exposed to the current scope using the `using` keyword. + +```typespec +using SampleNamespace; + +model Foo { + sample: SampleModel; +} +``` + +The bindings introduced by a `using` statement are local to the namespace they are declared in. They do not become part of the namespace themselves. + +```typespec +namespace One { + model A {} +} + +namespace Two { + using One; + alias B = A; // ok +} + +alias C = One.A; // not ok +alias C = Two.B; // ok +``` diff --git a/packages/website-astro/src/content/docs/latest/language-basics/operations.md b/packages/website-astro/src/content/docs/latest/language-basics/operations.md new file mode 100644 index 0000000000..96161f10e5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/operations.md @@ -0,0 +1,83 @@ +--- +id: operations +title: Operations +--- + +# Operations + +Operations describe service endpoints and consist of an operation name, parameters, and return type. + +Operations are declared using the `op` keyword: + +```typespec +op ping(): void; +``` + +## Parameters + +The operation's parameters describe a model, so anything you can do in a model you can do in a parameter list as well, including using the spread operator: + +```typespec +op feedDog(...CommonParams, name: string): void; +``` + +## Return type + +Often an endpoint returns one of any number of models. For example, there might be a return type for when an item is found, and a return type for when an item isn't found. Unions are used to describe this pattern: + +```typespec +model DogNotFound { + error: "Not Found"; +} + +op getDog(name: string): Dog | DogNotFound; +``` + +## Reuse operations + +Operation signatures can be reused using the `is` keyword. Given an operation + +```typespec +op Delete(id: string): void; +``` + +its signature can be reused like this: + +```typespec +op deletePet is Delete; +``` + +This means that `deletePet` will have the same parameters, return type and decorators as the `Delete` operation. + +This pattern is most commonly used in combination with [operation templates](#operations-templates) + +## Operations templates + +[See templates](./templates.md) for details on templates. + +```typespec +op ReadResource(id: string): T; +``` + +The operation template can then be referenced via `is`: + +```typespec +op readPet is ReadResource; +``` + +## Referencing model properties + +Model properties can be referenced using the `.` operator for identifiers. + +```tsp +alias PetName = Pet.name; +``` + +## Meta type references + +Some operation meta types can be referenced using `::` + +| Name | Example | Description | +| ---------- | --------------------- | ----------------------------------------- | +| parameters | `readPet::parameters` | Reference the parameters model expression | +| returnType | `readPet::returnType` | Reference the operation return type | diff --git a/packages/website-astro/src/content/docs/latest/language-basics/overview.md b/packages/website-astro/src/content/docs/latest/language-basics/overview.md new file mode 100644 index 0000000000..9d615fa0e2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/overview.md @@ -0,0 +1,159 @@ +--- +id: overview +title: Overview +--- + +# Language Overview + +This is an overview of the language concept in TypeSpec. It doesn't go in detail but can be used as a cheat sheet. + +## Declarations + +- Declaration names must be unique across types within the same scope. For example this is not allowed + + ```typespec + model Dog {} + namespace Dog {} + ``` + +## Imports + +_Details: [Imports](./imports.md)_ + +| Feature | Example | +| -------------------- | ------------------------- | +| Import typespec file | `import "./models.tsp"` | +| Import JS file | `import "./models.js"` | +| Import Library | `import "@typespec/rest"` | + +## Namespaces + +_Details: [Namespaces](./namespaces.md)_ + +| Feature | Example | +| ----------------- | ---------------------------- | +| Declare namespace | `namespace PetStore {}` | +| File namespace | `namespace PetStore;` | +| Nested namespace | `namespace PetStore.Models;` | +| Using namespace | `using PetStore.Models;` | + +## Decorators + +_Details: [Decorators](./decorators.md)_ + +| Feature | Example | +| ---------------------------- | ----------------------------------------------------------------------------------- | +| Use decorator | `@mark` | +| Use decorator with arguments | `@tag("abc")` | +| Declare a decorator in JS | `export function $tag(context: DecoratorContext, target: Type, name: string) {...}` | +| Save state in decorator | `context.program.stateMap(key).set(target, )` | +| Augment decorator | `@@tag(MyType, "abc");` | + +## Scalars + +_Details: [Scalars](./models.md)_ + +| Feature | Example | +| ------------------ | ------------------------------------------- | +| Scalar declaration | `scalar ternary` | +| Extend scalar | `scalar Password extends string` | +| Template scalar | `@doc(T) scalar Password` | + +## Models + +_Details: [Models](./models.md)_ + +| Feature | Example | +| ------------------------------ | ------------------------------------- | +| Model declaration | `model Pet {}` | +| Model inheritance | `model Dog extends Pet {}` | +| scalar is | `model uuid extends string;` | +| Model spread | `model Dog {...Animal}` | +| Property | `model Dog { name: string }` | +| Optional property | `model Dog { owner?: string }` | +| Optional property with default | `model Dog { name?: string = "Rex" }` | +| Model template | `model Pet { t: T }` | + +## Operations + +_Details: [Operations](./operations.md)_ + +| Feature | Example | +| ----------------------------- | ------------------------------------------------ | +| Operation declaration | `op ping(): void` | +| Operation with parameters | `op upload(filename: string, data: bytes): void` | +| Operation with return type | `op health(): HealthStatus` | +| Operation with multiple types | `op health(): HealthStatus \| ErrorResponse` | +| Operation template | `op getter(id: string): T` | +| Operation is | `op getPet is getter;` | + +## Interfaces + +_Details: [Interfaces](./interfaces.md)_ + +| Feature | Example | +| --------------------- | -------------------------------------- | +| Interface declaration | `interface PetStore { list(): Pet[] }` | +| Interface composition | `interface PetStore extends Store { }` | +| Interface template | `interface Restful { list(): T[] }` | + +## Templates + +_Details: [Templates](./templates.md)_ + +| Feature | Example | +| --------------------------------- | --------------------------------------------------- | +| Simple template | `model Response {value: T}` | +| Template with multiple parameters | `model Response {key: K, value: T}` | +| Template default | `model Response {value: T}` | +| Template constraints | `model Response {value: T}` | +| Template constraints and defaults | `model Response {value: T}` | + +## Enums + +_Details: [Enums](./enums.md)_ + +| Feature | Example | +| ------------------ | ---------------------------------------------- | +| Enum declaration | `enum Direction {Up, Down}` | +| Enum string values | `enum Direction {Up: "up", Down: "down"}` | +| Enum int values | `enum Size {Small: 1000, Large: 2000}` | +| Enum float values | `enum Part {Quarter: 0.25, Half: 0.5}` | +| Enum composing | `enum Direction2D {...Direction, Left, Right}` | + +## Unions + +_Details: [Unions](./unions.md)_ + +| Feature | Example | +| ----------------------- | -------------------------------- | +| Union declaration | `"cat" \| "dog"` | +| Named union declaration | `union Pet {cat: Cat, dog: Dog}` | + +## Intersections + +_Details: [Intersections](./intersections.md)_ + +| Feature | Example | +| ------------------------ | -------------- | +| Intersection declaration | `Pet & Animal` | + +## Type literals + +_Details: [Type literals](./type-literals.md)_ + +| Feature | Example | +| ----------------- | -------------------------------------------------------- | +| String | `"Hello world!"` | +| Multi line String | `"""\nHello world!\n"""` (\n) represent actual new lines | +| Int | `10` | +| Float | `10.0` | +| Boolean | `false` | + +## Aliases + +_Details: [Aliases](./alias.md)_ + +| Feature | Example | +| ----------------- | --------------------------------- | +| Alias declaration | `alias Options = "one" \| "two";` | diff --git a/packages/website-astro/src/content/docs/latest/language-basics/scalars.md b/packages/website-astro/src/content/docs/latest/language-basics/scalars.md new file mode 100644 index 0000000000..bbf99d5b18 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/scalars.md @@ -0,0 +1,30 @@ +--- +title: Scalars +--- + +# Scalars + +These are types without any fields(For example `string`, `int32`, `boolean`, etc.) + +Scalar can be declared using the `scalar` keyword + +```typespec +scalar ternary; +``` + +## Extend another scalar + +Scalar can be extended using the `extends` keyword. + +```typespec +scalar Password extends string; +``` + +## Template scalar + +Scalar support template parameters. Note: the only use for those template are decorators. + +```typespec +@doc(T) +scalar Unreal; +``` diff --git a/packages/website-astro/src/content/docs/latest/language-basics/templates.md b/packages/website-astro/src/content/docs/latest/language-basics/templates.md new file mode 100644 index 0000000000..32dc5022d7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/templates.md @@ -0,0 +1,68 @@ +--- +id: templates +title: Templates +--- + +# Templates + +It is often useful to let the users of a model fill in certain details. Templates enable this pattern. Similar to generics found in other languages, model templates declare template parameters that users provide when referencing the type. + +Templates can be used on: + +- [alias](./alias.md) +- [models](./models.md) +- [operations](./operations.md) +- [interfaces](./interfaces.md) + +```typespec +model Page { + size: number; + item: T[]; +} + +model DogPage { + ...Page; +} +``` + +## Default values + +A template parameter can be given a default value with `= `. + +```typespec +model Page { + size: number; + item: T[]; +} +``` + +## Parameter constraints + +Template parameter can provide a constraint using the `extends` keyword. See [type relations](./type-relations.md) documentation for details on how validation works. + +```typespec +alias Foo = T; +``` + +now instantiating Foo with the wrong type will result in an error + +```typespec +alias Bar = Foo<123>; + ^ Type '123' is not assignable to type 'TypeSpec.string' +``` + +Template constraints can be a model expression + +```typespec +// Expect T to be a model with property name: string +alias Foo = T; +``` + +Template parameter default also need to respect the constraint + +```typespec +alias Foo = T +// Invalid +alias Bar = T + ^ Type '123' is not assignable to type 'TypeSpec.string' +``` diff --git a/packages/website-astro/src/content/docs/latest/language-basics/type-literals.md b/packages/website-astro/src/content/docs/latest/language-basics/type-literals.md new file mode 100644 index 0000000000..cf6ee9af22 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/type-literals.md @@ -0,0 +1,81 @@ +--- +id: type-literals +title: Type literals +--- + +# Type literals + +API authors often need to describe API shapes in terms of specific literal values. For example, this operation returns this specific integer status code, or this model member can be one of a few specific string values. It is also often useful to pass specific literal values to decorators. TypeSpec supports string, number, and boolean literal values to support these cases. + +## String literals + +String literals can be represented using double quotes `"` + +```typespec +alias Str = "Hello World!"; +``` + +## Multi line string literals + +A multi string literal is represented using a set of 3 double quotes `"""`. + +```typespec +alias Str = """ +This is a multi line string + - opt 1 + - opt 2 +"""; +``` + +- Opening `"""` must be followed by a new line. +- Closing `"""` must be preceded by a new line. + +### Multi line string indentation trimming + +Multi lines automatically remove leading whitespaces of each line aligned with the closing `"""`. This is particularly useful to keep multi line string indented with the code and not have to worry about unwanted indentation. + +All those options will produce the exact same string value `"one\ntwo"` + +```typespec +model MultiLineContainer { + prop1: """ +one +two +""") + + // Lines are indented at the same level as closing """" + prop2: """ + one + two + """ + + prop3: """ + one + two + """ + + // lines are less indented as the closing """" + prop4: """ + one + two + """ +} +``` + +## Numeric literal + +Numeric literals can be declared by using the raw number + +```typespec +alias Kilo = 1000; +alias PI = 3.14; +``` + +## Boolean literal + +Boolean literals can be declare by using `true` or `false` keywords + +```typespec +alias InTypeSpec = true; +alias Cheater = false; +``` diff --git a/packages/website-astro/src/content/docs/latest/language-basics/type-relations.md b/packages/website-astro/src/content/docs/latest/language-basics/type-relations.md new file mode 100644 index 0000000000..f4e6119dcc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/type-relations.md @@ -0,0 +1,145 @@ +--- +id: type-relations +title: Type relations +--- + +# Types Relations + +## Type hierarchy + +```mermaid +graph RL + record["Record"] --> unknown + customModel["Custom model with properties"] --> record["Record"] + array["Array"] --> unknown + tuple["Tuple"] --> array + numeric --> unknown + subgraph numerics[For numeric types, a narrower type can be assigned to a wider one] + integer --> numeric + int8 --> integer + int16 --> integer + int32 --> integer + safeint --> integer + int64 --> integer + uint8 --> integer + uint16 --> integer + uint32 --> integer + uint64 --> integer + float --> numeric + float32 --> float + float64 --> float + decimal --> numeric + decimal128 --> decimal + end + string --> unknown + boolean --> unknown + null --> unknown + bytes --> unknown + plainDate --> unknown + plainTime --> unknown + zoneDateTime --> unknown + duration --> unknown +``` + +## Model with properties + +When checking if type `S` can be assigned to type `T`, if `T` is a model with properties, it will look for all those properties to be present inside of `S` and their type be assignable to the type of the property is T. + +For example + +```typespec +model T { + foo: string; + bar: int32; +} + +// Valid + +model S { // When properties types are the exact same + foo: string; + bar: int32; +} +model S { // When the properties types are literal assignable to the target type + foo: "abc"; + bar: 123; +} +model S { + foo: string; + bar: int8; // int8 is assignable to int16 +} +model S { + foo: string; + bar: int32; + otherProp: boolean; // Additional properties are valid. +} + +// Invalid +model S { // Missing property bar + foo: string; +} +model S { + foo: string; + bar: int64; // int64 is NOT assignable to int32 +} +``` + +## `Record` + +A record is a model indexed with a string with value of T. This means that it represents a model where all properties(string key) are assignable to the type T. You can assign a model expression where all the properties are of type T or another model that `is` also a `Record` + +```typespec +// Represent an object where all the values are int32. +alias T = Record; + +// Valid +alias S = { + foo: 123; + bar: 345; +}; +alias S = { + foo: int8; + bar: int32; +}; +model S is Record; +model S is Record { + foo: 123; +} + +// Invalid +alias S = { + foo: "abc"; + bar: 456; +}; +alias S = { + foo: int64; + bar: int32; +}; +model S { + foo: 123; + bar: 456; +} +``` + +#### Why is the last case not assignable to `Record`? + +In this scenario + +```typespec +alias T = Record; +model S { + foo: 123; + bar: 456; +} +``` + +The reason is `model S` here is not assignable but the model expression `{ foo: 123; bar: 456; }` is, is that model S could be extended with additional properties that could then not be compatible. + +If you for example now add a new model + +```typespec +model Foo is S { + otherProp: string; +} +``` + +Now here `Foo` is assignable to `S` following the [model with property logic](#model-with-properties) and if `S` was assignable to `Record`, `Foo` would be able to be passed through as well but this is now invalid as `otherProp` is not an `int32` property. diff --git a/packages/website-astro/src/content/docs/latest/language-basics/unions.md b/packages/website-astro/src/content/docs/latest/language-basics/unions.md new file mode 100644 index 0000000000..431d23bc29 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/language-basics/unions.md @@ -0,0 +1,35 @@ +--- +id: unions +title: Unions +--- + +# Unions + +Unions describe a type that must be exactly one of the union's constituents. There is 2 types of unions: + +- union expressions +- named unions + +## Union expressions + +Unnamed unions can be declared by joining the variants using the `|` operator + +```typespec +alias Breed = Beagle | GermanShepherd | GoldenRetriever; +``` + +Here it says that `Breed` can accept either a `Beagle`, a `GermanShepherd` or a `GoldenRetriever`. + +## Named unions + +Named unions provide a way to specify a name for the union as well as explicit variant reference. Named unions are in a way similar to [enums](./enums.md) but instead of having `string` or `numeric` values it is a [record models](./models.md) + +```typespec +union Breed { + beagle: Beagle, + shepherd: GermanShepherd, + retriever: GoldenRetriever, +} +``` + +The above example is equivalent to the `Breed` alias above, except that emitters can actually see `Breed` as a named entity and also see the `beagle`, `shepherd`, and `retriever` names for the options. It also becomes possible to apply [decorators](./decorators.md) to each of the options when using this form. diff --git a/packages/website-astro/src/content/docs/latest/release-notes/cadl-typespec-migration.md b/packages/website-astro/src/content/docs/latest/release-notes/cadl-typespec-migration.md new file mode 100644 index 0000000000..45faa66f29 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/cadl-typespec-migration.md @@ -0,0 +1,71 @@ +--- +title: Cadl to TypeSpec rename completed in March 2023 release +--- + +As you may recall from our previous email to partners, we are renaming the product as it becomes more mature, stable and one step closer to release. + +With the 2023-03-13 release, We are pleased to announce that we have completed the process of changing the name of our product from **Cadl** to **TypeSpec**. This marks another important milestone. The new name better aligns with the functionality and benefits of the product, and we believe it will make it easier for our customers to understand and remember. + +We understand that change can be challenging, and we appreciate your patience and support during this process. + +## Name Changes + +- Packages: + + - NPM package scope: + + - @cadl-lang/[xx] -> @typespec/[xx] + + - Package names + +| Old Package Name | Old Namespace | New Package Name | New Namespace | +| ------------------- | -------------------- | ------------------ | ------------------------ | +| @cadl-lang/compiler | using Cadl; | @typespec/compiler | using TypeSpec; | +| @cadl-lang/rest | using Cadl.Http; | @typespec/http; | using TypeSpec.Http; | +| @cadl-lang/rest | using Cadl.Rest; | @typespec/rest | using TypeSpec.Rest; | +| @cadl-lang/openapi | using Cadl.OpenApi; | @typespec/openapi | using TypeSpec.OpenApi; | +| @cadl-lang/openapi3 | using Cadl.OpenApi3; | @typespec/openapi3 | using TypeSpec.OpenApi3; | + +- File extension: + + - `.cadl` -> `.tsp` + +- Configuration file: + + - `cadl-project.yaml` -> `tspconfig.yaml` + +- CLI + + - `npx cadl compile .` -> `npx tsp compile .` + +- Compiler JS APIs + - All artifacts with `*Cadl*` in the name have been updated to `*TypeSpec*`. However, aliases have been created with older `*Cadl*` name with `@deprecated` flag. +- Noteable changes: + + - @cadl-lang/rest was split into two packages, @typespec/rest and @typespec/http + +- Back-compatibility + - `.cadl` files are continue be recognized by compiler. + - `cadl-project.yaml` is still supported if `tspconfig.yaml` not found + +## Migration tool + +An experimental migration tool has been introduced to take care of many of the manual migration steps. Just execute following command in your TypeSpec folder. + +```bash + npx @typespec/migrate +``` + +If you would like execute from a different folder or don't have a `package.json` that indicates compiler package versions, please see command line options: + +```bash + npx @typespec/migrate --help +``` + +The migration tool will perform following steps: + +- Rename `cadl-project.yaml` to `tspconfig.yaml`. +- Update `tspconfig.yaml` format to new `emit` schema if necessary. +- Rename `.cadl` files to `.tsp`. +- Update `import` and `using` statements in any `.tsp` files +- Update `package.json` with new package name and versions. diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2022-07-08.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2022-07-08.md new file mode 100644 index 0000000000..fb2308d64f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2022-07-08.md @@ -0,0 +1,98 @@ +--- +title: July 2022 +--- + +# Release Notes July 2022 (2022-07-08) + +This release contains **breaking changes** + +- Emitter options normalized to use kebab-case instead of camelCase. +- `@serviceHost` decorator replaced by `@server` decorator +- Versioning decorators now use enumerated values instead of strings + +## Emitter options + +This release brings a stricter option definition for emitters and requires usage of those options to be specified with the fully qualified name to prevent conflicts. +All options have also been renamed to match `kebab-case` naming. +The options can also be specified via the `tspconfig.yaml` file. + +### Migrating Command Line Scripts + +If you had for example `--option operationPollingLocation=tenant` + +1. Use `tspconfig.yaml` project file **Recommended** + + If you don't have that file yet, create it next to `package.json`, this file can be used to configure the emitters. + + ```yaml + emitters: + : + : + + # For example + emitters: + @typespec/openapi3: + output-file: ./openapi.json + ``` + +2. Via the `--option` flag + + You can still use the `--option` flag but you'll need to specify the fully qualified name of the option. + + ```bash + --option @.= + + # For example + --option @typespec/openapi3.output-file=openapi.json + ``` + +#### Renamed Emitter Options + +| Before | Now | +| ---------------------- | ------------- | +| **@typespec/openapi3** | +| `outputFile` | `output-file` | + +## `@serviceHost` decorator replaced with `@server` decorator + +The `@serviceHost` decorator that decorated the root namespace was used to specify the domain name of the base service endpoint. This functionality has been replaced by the `@server` decorator, which allows specifying full and parametrized Uris for the service endpoint, as described [here](https://microsoft.github.io/typespec/docs/standard-library/http/#service-definition-and-metadata) + +### Before + +```typespec +@serviceHost("example.com") +namespace MyService; +``` + +### After + +```typespec +@server("https://example.com") +namespace MyService; +``` + +## Versioning uses enums instead of strings + +Versions must now be specified using string-valued enumerations, and each of the versioning decorators must reference an enum value rather than using the version string directly. + +```typespec +// Before +@versioned("2021-01-12" | "2022-01-15-preview") +namespace Api; + +// After +@versioned(Versions) +namespace Api; + +enum Versions { v2021_01_12: "2021-01-12", v2022_01_15_preview: "2022-01-15-preview" } +``` + +```typespec +// Before +@added("2022-01-15-preview") +model Foo {} + +// After +@added(Versions.v2022_01_15_preview) +model Foo {} +``` diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2022-08-10.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2022-08-10.md new file mode 100644 index 0000000000..0436e06207 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2022-08-10.md @@ -0,0 +1,285 @@ +--- +title: August 2022 +--- + +# Release Notes August 2022 (2022-08-10) + +This release contains **breaking changes** + +- Operation parameters without decorators +- OkResponse is no longer a template +- Route resolution changes +- Remove `Map` type +- `@path` may not decorate optional properties or parameters without a default value + +## Operation parameters without decorators + +A single undecorated (not marked `@query`, `@header`, `@body` or `@path`) operation parameter will now become a property of the request body rather than have its type define the request body. This allows defining the body with multiple unannotated parameters, which can include unannotated properties that are spread into parameters. (Previously, more than one unannotated parameter was an error.) + +For example, the following used to define a request body of type `string`, but now defines a request body that is an object with a property named `body` of type string. + +```typespec +op create(body: string): void; +``` + +To get the previous behavior, the parameter now needs to be explicitly marked with `@body`: + +```typespec +op create(@body body: string): void; +``` + +## OkResponse is no longer a template + +Previously, OkResponse took an argument for the body type. Now it is a simple model like the other XxxResponse types. Alone, it implies a status code of 200 with no body. + +Since 200 is the default status code for non-empty bodies, you can usually replace `OkResponse` with simply `T`. + +```typespec +op get(id: string): OkResponse; +``` + +Can be: + +```typespec +op get(id: string): Pet; +``` + +In certain situations where the body type is not (necessarily) a model, you will need to use the new `Body` type. For example. + +```typespec +op list(): OkResponse; +``` + +Can become: + +```typespec +op list(): OkResponse & Body; +``` + +Since 200 status code is used by default, this could also be: + +```typespec +op list(): Pet[]; +``` + +Generic models based on `OkResponse` may also require `Body`. For example: + +```typespec +model MyResponse { + ...OkResponse; + @header example: string; +} +``` + +Since T is not constrainted to be a model, it might be an intrinsic type, an array, or the like, the template should be changed to use `Body`: + +```typespec +model MyResponse { + ...OkResponse; + ...Body; + @header example: string; +} +``` + +In general, the prior `OkResponse` is equivalent to `OkResponse & Body` now or, equivalently, `{ ...OkResponse, ...Body }`. In practice there are many situations where you can leave out OkResponse altogether and use plain `T` rather than `Body`. + +See also https://microsoft.github.io/typespec/docs/standard-library/http/#request--response-bodies + +## Route resolution changes + +Resolving operation routes now follows the following logic: + +- if there is a service namespace specified + - only emit the operations and interfaces under that namespace(recursively) +- if not: + - only emit the operations and interfaces defined at the root (DO NOT look into namespaces) + +### Action if applicable + +- If a typespec spec used a service namespace without `@serviceTitle` add the `@serviceTitle` decorator to the service namespace, otherwise no routes will be emitted. +- If a typespec spec contains service namespaces that are not child namespaces of the service namespace, move these namespaces under the service namespace. + +### Cases + +#### Operation at the root + +```typespec +op test(): void; +``` + +✅ Stay the same + +| Before | After | +| ------- | ------- | +| `["/"]` | `["/"]` | + +#### Operation in namespace (not service namespace) + +```typespec +namespace DemoService; + +op test(): void; +``` + +⚠️ Output stays the same but add warning that no routes are emitted + +| Before | After | +| ------ | ----- | +| `[]` | `[]` | + +#### Operation in namespace (not service namespace) with @route + +```typespec +namespace DemoService; + +@route("/") +op test(): void; +``` + +⚠️ Now the same as previous case, no routes emitted and emit warning + +| Before | After | +| ------- | ----- | +| `["/"]` | `[]` | + +##### Resolve by adding the `@serviceTitle` decorator + +Add `@serviceTitle` to the namespace + +```typespec +@serviceTitle("DemoService") +namespace DemoService; + +@route("/") +op test(): void; +``` + +#### Operation in service namespace + +```typespec +@serviceTitle("My Service") +namespace Foo; + +op test(): void; +``` + +✅ Stay the same + +| Before | After | +| ------- | ------- | +| `["/"]` | `["/"]` | + +#### Operation in namespaces other than the service namespace + +```typespec +import "@typespec/rest"; + +using TypeSpec.Http; + +@serviceTitle("My Service") +namespace Foo { + @route("in-service") + op test(): void; +} + +namespace MyLib { + @route("my-lib") + op test(): void; +} +``` + +⚠️ Other namespace routes are not included anymore + +| Before | After | +| --------------------------- | ----------------- | +| `["/in-service", "my-lib"]` | `["/in-service"]` | + +##### Resolve by making additional namespaces children of the service namespace + +Make any added namespaces children of the service namespace + +```typespec +import "@typespec/rest"; + +using TypeSpec.Http; + +@serviceTitle("My Service") +namespace Foo { + @route("in-service") + op test(): void; +} + +namespace Foo.MyLib { + @route("my-lib") + op test(): void; +} +``` + +## Remove Map type + +`Map` type was removed. Usages of `Map` can be replaced with new type `Record`. Other usages of `Map` may be replaced with `object`. + +### Map using string key type + +```typespec +model Foo { + options: Map; +} +``` + +#### Replace with `Record` + +```typespec +model Foo { + options: Record; +} +``` + +### Map using non-string key type + +```typespec +model Foo { + options: Map; +} +``` + +#### Replace with `object` + +```typespec +model Foo { + options: object; +} +``` + +## `@path` may not decorate optional properties or parameters without a default + +Properties and parameters marked with the `@path` decorator should be required, but may be optional if they have a default value + +### optional path parameters + +```typespec +model Foo { + @path + name?: string; +} +``` + +Was a bad practice, but was allowed in previous versions. This will now throw an error diagnostic. + +### Resolve by making the property required + +```typespec +model Foo { + @path + name: string; +} +``` + +### Resolve by adding a default value + +```typespec +model Foo { + @path + name?: string = "singleton"; +} +``` diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2022-09-07.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2022-09-07.md new file mode 100644 index 0000000000..2d65e49e47 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2022-09-07.md @@ -0,0 +1,73 @@ +--- +title: September 2022 +--- + +# Release Notes September 2022 (2022-09-07) + +This release contains **breaking changes**: + +- **`Api`**: Remove `Type` suffix +- **`TypeSpec`**: Rename `Page` to `CollectionWithNextLink` +- **`Api`**: `Enum.members` change typed from `EnumMember[]` to `Map` +- **`TypeSpec`** **`Api`**: **Deprecation** of `@consumes` `@produces` decorators + +## **[API]** `Type` suffix removed from most `Type`s + +The following types have been renamed in the compiler API: + +- `ModelType` -> `Model` +- `ModelTypeProperty` -> `ModelProperty` +- `InterfaceType` -> `Interface` +- `EnumType` -> `Enum` +- `EnumMemberType` -> `EnumMember` +- `TemplateParameterType` -> `TemplateParameter` +- `NamespaceType` -> `Namespace` +- `OperationType` -> `Operation` +- `StringLiteralType` -> `StringLiteral` +- `NumericLiteralType` -> `NumericLiteral` +- `BooleanLiteralType` -> `BooleanLiteral` +- `TupleType` -> `Tuple` +- `UnionType` -> `Union` +- `UnionTypeVariant` -> `UnionVariant` +- `ProjectionType` -> `Projection` + +Update uses of the type names on the left with the type names on the right. The old names can still be used but they are deprecated and may be removed from a future release. + +## [TYPESPEC] Rename `Page` to `CollectionWithNextLink` + +In library `@typespec/rest` in `TypeSpec.Rest.Resources` namespace the `Page` model was renamed to `CollectionWithNextLink`. +This resolve an issue with `Page` being to generic of a name for this very opinionated model. + +Before + +```typespec +op test(): Page; +``` + +Rename to + +```typespec +op test(): CollectionWithNextLink; +``` + +## **[Api]** `Enum.members` change to `Map` [#953](https://github.com/microsoft/typespec/pull/953) + +Changed the type of the `members` property of `Enum` from `EnumMember[]` => `Map` + +```diff +-members: EnumMember[]; ++members: Map +``` + +## [TypeSpec] [Api] **Deprecation**: `@consumes` `@produces` + +Consumption of the data set by decorators was already removed in a previous release. Using them was a no-op. + +The following are deprecated and will be removed in next release. + +- `@consumes` +- `@produces` +- `getConsumes` +- `getProduces` + +Alternative is to use a `@header contentType: ` property on the operation parameters or return type diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2022-10-12.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2022-10-12.md new file mode 100644 index 0000000000..113c120759 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2022-10-12.md @@ -0,0 +1,125 @@ +--- +title: October 2022 +--- + +# Release Notes October 2022 (2022-10-12) + +This release contains **breaking changes**: + +- **`TypeSpec`**: Cannot `extends` or `is` a model expression via alias +- **`Api`**: Removed `createProgram` and changed `compile` parameter order +- **`TypeSpec`** **Deprecation** `@service` decorator replacing `@serviceTitle` and `@serviceVersion` +- **`TypeSpec`** **`Api`**: Move `@discriminator` to compiler + +## [TypeSpec] Cannot `extends` or `is` a model expression via alias [PR 1004](https://github.com/microsoft/typespec/pull/1004) + +Using model expression for `is` or `extends` directly was already forbidden. + + +```typespec +model IsModelExpr is {bar: string} {} + +model ExtendsModelExpr extends {bar: string} {} +``` + +The following workaround was however tolerated. This PR remove this functionality. + + +```typespec +alias ModExpr = {bar: string}; +model IsModelExprWAlias is ModExpr {} + +model ExtendsModelExprWAlias extends ModExpr {} +``` + +Use a named model instead of an alias. + +## [API] Removed `createProgram` and changed `compile` parameter order + +`createProgram` has been removed in favor of `compile`. The new compile has the same parameter as `createProgram` + +```ts +// Before +createProgram(host, "main.tsp); + +// After +compile(host, "main.tsp"); +``` + +`compile` api was changed to match the same order as old `createProggram` + +```ts +// Before +compile("main.tsp", host); + +// After +compile(host, "main.tsp"); +``` + +## [TypeSpec] Deprecation: @service decorator replacing `@serviceTitle` and `@serviceVersion` + +- `@serviceTitle` has been deprecated +- `@serviceVersion` has been deprecated + +```typespec +// Before +@serviceTitle("Pet Store") +@serviceVersion("v1") +namespace PetStore; + +// After +@service({"Pet Store", version: "v1"}) +namespace PetStore; +``` + +This allows to specify the service namespace without any title or version + +```typespec +@service +namespace PetStore; +``` + +## [TypeSpec] [Api] Move `@discriminator` to compiler + +The `@discriminator` has been moved to the compiler. This means that if you were using the fully qualified name to reference the decorator `@TypeSpec.Rest.disriminator` it should be changed to `@discriminator` + +**No changes** + +```typespec +using TypeSpec.Rest; + +@disriminator("kind") +model Pet {} +``` + +**Before** + +```typespec +@TypeSpec.Rest.disriminator("kind") +model Pet {} +``` + +**After** + +```typespec +@disriminator("kind") +model Pet {} +``` + +### Change to api + +the `getDiscriminator` accessor has also been removed into the compiler. + +Before + + +```ts +import { getDiscriminator } from "@typespec/rest"; +``` + +After + + +```ts +import { getDiscriminator } from "@typespec/compiler"; +``` diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2022-12-07.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2022-12-07.md new file mode 100644 index 0000000000..5a35a3cc82 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2022-12-07.md @@ -0,0 +1,293 @@ +--- +title: December 2022 +--- + +# Release Notes December 2022 (2022-12-07) + +:::danger +This release contains **breaking changes** +::: + +## New features + +### Decorator signature help + +With the decorator signature `extern dec` added in previous release and the doc comment support added in this version the IDE is able to provide a signature help for decorators + +![](./signature-help.png) + +## New `scalar` type + +:::danger +This is a breaking change [see details here](#change-to-typespec-intrinsic-models) +::: + +This release introduce a new [scalar](../language-basics/scalars.md) type meant to represent what were previously models with no properties actually representing an scalar value. + +```typespec +scalar uuid extends string; +``` + +## Emitter options interpolation and standardization + +Emitter options are not able to interpolate other values. See [details](../introduction/configuration/configuration.md#variable-interpolation) + +```yaml +output-dir: {cwd}/generated +options: + @typespec/openapi3: + emitter-output-dir: {output-dir}/openapi3 +``` + +## Breaking changes + +### `TypeSpec` `Api` `Compiler` Moved typespec intrinsic types to a new Type `scalar` + +A new type has been introduced to typespec in order to differentiate scalar from structured models types. Those new types can be declared using `scalar` and can extend another scalar using `extends`. + +#### Change to typespec intrinsic models + +All of TypeSpec intrinsic models have been updated to be `scalar` types instead of `model`. In most cases this shouldn't affect a spec but if you are defining a custom model that `is` one of the intrinsic types you'll have to update it + +Before + +``` +model MyStr is string; +``` + +After + +``` +scalar MyStr extends string; +``` + +##### Migration script + +The following script can be used to automatically migrate previous usages. + +```typespec +npx @typespec/migrate +``` + +#### Change to Compiler API + +Removed: + +- `getIntrinsicModelName`: Check it is a std type with `program.checker.isStdType(type)` and then use the `type.name` otherwise look for `type.baseScalar` +- `isIntrinsic`: Check it is a std type with `program.checker.isStdType(type)` or just remove the check if goal was to omit intrinsic types from models. + +Migration: + +1. Add a new switch to handle the new `scalar` type +2. To resolve a scalar type, check if its a std type using `program.checker.isStdType(type)` +3. If yes, do the same behavior has before with `getIntrinsicModelName` +4. If not, call `scalar.baseScalar` and repeat step 2. + +### `API` - Change to `onEmit` signature + +The signature of `onEmit` has been updated to accommodate for changes to the emitter options + +**Before** + +```ts +export function $onEmit(program: Program, options: MyEmitterOptions); +``` + +**Now** + +```ts +export function $onEmit(context: EmitContext); +``` + +Access properties + +| Before | Now | +| ----------------------- | --------------------------------------------------------------------------------------------------------------- | +| `program` | `context.program` | +| `options` | `context.options` | +| `options["output-dir"]` | `context.emitterOutputDir` [See details](#typespec-api-emitter-option-output-dir-renamed-to-emitter-output-dir) | + +### [TypeSpec] [Api] Emitter option `output-dir` renamed to `emitter-output-dir` + +The option has been renamed for all emitters as `emitter-output-dir` is now managed in the compiler +Before + +```yaml +emitters: + my-emitter: + output-dir: /path/to-output-dir +``` + +Now + +```yaml +emitters: + my-emitter: + emitter-output-dir: {output-dir}/for-this-emitter +# ^ can now reference the common output-dir +``` + +### Change to api + +**Before** + +```ts +export function $onEmit(program: Program, options: MyEmitterOptions) { + const outputDir = options["output-dir"]; +} +``` + +**Now** + +```ts +export function $onEmit(context: EmitContext) { + const outputDir = context.emitterOutputDir; +} +``` + +### `API > @typespec/compiler` Multiple services per typespec specs are now allowed making a service accessor obsolete. + +The following functions have been deprecated + +```ts +export function getServiceTitle(program: Program): string; +export function getServiceVersion(program: Program): string; +export function getServiceNamespace(program: Program): Namespace; +export function getServiceNamespaceString(program: Program): string | undefined; +export function setServiceNamespace(program: Program, namespace: Namespace); +``` + +and replaced with + +```ts +export interface ServiceDetails { + title?: string; + version?: string; +} +export interface Service extends ServiceDetails { + type: Namespace; +} + +export function listServices(program: Program): Service[]; +export function getService(program: Program, namespace: Namespace): Service | undefined; +export function isService(program: Program, namespace: Namespace): boolean; + +export function addService(program: Program, type: Namespace, details?: ServiceDetails); +``` + +Other changes to the service resolution: + +- Title won't be defaulted to `(title)` +- Version won't be defaulted to `0000-00-00` +- Service namespace won't be defaulted to global namespace + +| Before | To add support for multi serviceF | +| ------------------------------------ | -------------------------------------------------------------------------------------------- | +| `getServiceNamespace(program)` | `listServices(program)` to get all services | +| `getServiceNamespaceString(program)` | `getNamespaceName(service.type)` is where service is `getService(program, serviceNamespace)` | +| `getServiceTitle(program)` | `service.title` where service is `getService(program, serviceNamespace)` | +| `getServiceVersion(program)` | `service.version` where service is `getService(program, serviceNamespace)` | + +### `TypeSpec` Directives can no longer be placed in certain contexts. + +For example, this is no longer valid: + +```typespec +model M< +#suppress example +T +> {} +``` + +And will now result in an error "Cannot place directive on template parameter". + +Move such directives up to the nearest statement, interface operation, model property, operation parameter, union variant, or enum member. + +For the above example, that would be: + +``` +#suppress example +model M {} +``` + +## Deprecations + +:::caution +Deprecated items will be removed in 2 release cycle. +::: + +### `TypeSpec > @typespec/rest` - `@segmentSeparator` is deprecated. The `@actionSeparator` decorator should be used instead. + +Before + +```typespec +@autoRoute +namespace Things { + @action + @segmentSeparator(":") + @put + op customAction1( + @segment("things") + @path + thingId: string, + ): string; +} +``` + +After: + +```typespec +@autoRoute +namespace Things { + @action + @actionSeparator(":") + @put + op customAction1( + @segment("things") + @path + thingId: string, + ): string; +} +``` + +### `TypeSpec` Deprecated `uri` being replaced by `url` + +Before: + +```typespec +model Server { + endpoint: uri; +} +``` + +Now: + +```typespec +model Server { + endpoint: url; +} +``` + +### `Config` - Deprecated `emitters` property in the `tspconfig.yaml` + +The `emitters` property of the configuration file has been deprecated and replaced by 2 new properties making it consistent with the CLI + +Before: + +```yaml +emitters: + "@typespec/openapi3": + output-file: openapi3.json + other-emitter: true +``` + +After: + +```yaml +emit: + - "@typespec/openapi3" + - "other-emitter" +options: + @typespec/openapi3: + output-file: openapi3.json +``` diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2023-01-12.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-01-12.md new file mode 100644 index 0000000000..534e6c1c7b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-01-12.md @@ -0,0 +1,62 @@ +--- +title: January 2023 +--- + +# Release Notes January 2023 (2023-01-12) + +:::danger +This release contains **breaking changes** +::: + +## Breaking Changes + +### `@typespec/openapi3` Default output-file is `openapi.yaml` + +As the openapi3 emitter added support for serializing the openapi document to yaml it changed the default to emit yaml to `openapi.yaml`. + +```yaml +options: + @typespec/openapi3: + file-type: json +``` + +or alternatively specify the name of the file you'd want + +```yaml +options: + @typespec/openapi3: + output-file: custom.json +``` + +### [API] Templated operation inside interface + +This breaking change affects libraries and emitters + +- `templateArguments` property on templated type is deprecated and has been replaced with more detailed `templateMapper` + + If you where you using the `templateArgument` to find out if something was a template instance change + + ```ts + type.templateArguments.length > 0; + ``` + + to + + ```ts + isTemplateInstance(type); + ``` + +- Interfaces might have some templated operations + + If blindly including all operations in an interface you might need to make sure the operation is not a template declaration first. + + For example with the following tsp code: + + ```typespec + interface Factory { + read(): T; + ping(): void; + } + ``` + +The emitter probably only wants to include the `ping()` operation but ignore read(). The `isTemplateDeclaration` helper can be used to filter out the template operations. diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2023-02-07.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-02-07.md new file mode 100644 index 0000000000..b093ca047a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-02-07.md @@ -0,0 +1,151 @@ +--- +title: February 2023 +--- + +# Release Notes February 2023 (2023-02-07) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### Emitter Framework + +The new emitter framework makes it simpler to build emitters from TypeSpec to other assets. It provides an easy way to handle TypeSpec types and provides a template for asset emitters to spell out the emitter tasks. It provides helpers to solve many difficult problems, including: + +- Constructing references between types +- Handling circular references +- Propagating type context based on containers or references +- Class-based inheritance to encourage reuse and specialization of existing emitters + +Details are available on the documentation website or in the [repository documentation] (https://github.com/microsoft/typespec/blob/main/docs/extending-typespec/emitter-framework.md). + +### Cli support for emitters in development + +Use the path to the emitter to specify emitter options, rather than the emitter name. + +### Allow `@autoroute` and `@route` to be used together + +Provide standard rules for combining `@route` and `@autoroute` decorators + +- Allow `@route` applied to an operation to override route settings from the interface +- Allow `@route` on an operation to prepend the paths provided by `@autoroute` + +### Simplified versioning dependencies + +Introduced the `@useDependency` decorator to replace `@versionedDependency` decorator. Simplify dependencies between versioned namespaces, by allowing each version to be decorated with the appropriate versioned dependency, rather than requiring the user to construct a dependency map. + +## Breaking Changes + +Breaking changes in this release resulted from removal of previously decorated types and functions, including: + +- `uri` scalar removed. Use the `url` scalar instead. +- Removed deprecated metadata types with the 'type' suffix. + - Use `Enum` instead of `EnumType` + - Use `EnumMember` instead of `EnumMemberType` + - Use `Interface` instead of `InterfaceType` + - Use `Model` instead of `ModelType` + - Use `ModelProperty` instead of `ModelTypeProperty` + - Use `Namespace` instead of `NamespaceType` + - Use `Operation` instead of `OperationType` + - Use `Tuple` instead of `TupleType` + - Use `Union` instead of `UnionType` +- Removed `Map` type, use `Record` instead +- Removed `@serviceTitle` and `@serviceVersion` decorators. Use the `@service` decorator instead. +- Removed helper and accessor functions associated with `@serviceTitle` and `@serviceVersion` decorators + - Replace `getServiceNamespace`, `getServiceTitle`, `getServiceVersion`, and `getServiceNamespaceString` with `getService` or `listServices` + - Replace `setServiceNamespace` with `addService` +- Removed `@segmentSeparator`, use `@actionSeparator` instead +- Removed `@produces` and `@consumes` decorators. Use `@header contentType: ` instead in the operation return type +- Removed `getSegmentSeparator` function. Use `getActionSeparator` instead +- Removed `getProduces` and `getConsumes` functions. Use `getContentTypes` instead + +## Deprecations + +### Deprecates the `@versionedDependency` decorator in favor of the `@useDependency` decorator + +For versioned libraries, `@useDependency` is applied to the version enum members + +#### Before (versioned namespace) + +```typespec +@armProviderNamespace +@service({ + title: "Microsoft.Observability", +}) +@versionedDependency( + [ + [Microsoft.Observability.Versions.v2021_06_13_preview, Azure.Core.Versions.v1_0_Preview_2], + [Microsoft.Observability.Versions.v2022_04_30_preview, Azure.Core.Versions.v1_0_Preview_2] + ] +) +@versionedDependency( + [ + [ + Microsoft.Observability.Versions.v2021_06_13_preview, + Azure.ResourceManager.Versions.v1_0_Preview_1 + ], + [ + Microsoft.Observability.Versions.v2022_04_30_preview, + Azure.ResourceManager.Versions.v1_0_Preview_1 + ] + ] +) +@versioned(Versions) +namespace Microsoft.Observability; + +interface Operations extends Azure.ResourceManager.Operations {} + +enum Versions { + v2021_06_13_preview: "2021-06-13-preview", + v2022_04_30_preview: "2022-04-30-preview", +} +``` + +#### After (Versioned namespace) + +```typespec +@armProviderNamespace +@service({ + title: "Microsoft.Observability", +}) +@versioned(Versions) +namespace Microsoft.Observability; + +interface Operations extends Azure.ResourceManager.Operations {} + +enum Versions { + @useDependency(Azure.Core.Versions.v1_0_Preview_2, Azure.ResourceManager.Versions.v1_0_Preview_1) + v2021_06_13_preview: "2021-06-13-preview", + + @useDependency(Azure.Core.Versions.v1_0_Preview_2, Azure.ResourceManager.Versions.v1_0_Preview_1) + v2022_04_30_preview: "2022-04-30-preview", +} +``` + +For unversioned libraries that reference versioned libraries, simply replace `@versionedDependency` with `@useDependency` + +#### Before (unversioned namespace using versioned library) + +```typespec +@service({ + title: "Microsoft.EnvelopeTest", + version: "2021-09-21-preview", +}) +@versionedDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@armProviderNamespace +namespace Microsoft.EnvelopeTest; +``` + +#### After (unversioned namespace using versioned library) + +```typespec +@service({ + title: "Microsoft.EnvelopeTest", + version: "2021-09-21-preview", +}) +@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) +@armProviderNamespace +namespace Microsoft.EnvelopeTest; +``` diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2023-03-13.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-03-13.md new file mode 100644 index 0000000000..843e0c58f9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-03-13.md @@ -0,0 +1,69 @@ +--- +title: March 2023 +--- + +# Release Notes March 2023 (2023-03-13) + +:::danger +This release contains **breaking changes** + +Please see [Cadl to TypeSpec rename and migration FAQ](./cadl-typespec-migration.md) +::: + +## New Features + +### Add--config option + +Enable specifying path to configuration file + +### Allow escaping identifiers using backticks + +Identifiers may contain reserved words or non-standard characters when surrounded with backticks (`), for example: + +```typespec +op `op`(): void; +``` + +### Correct Order of Application for augment decorators + +Augment decorators applied last + +### Added migration script for specs using Cadl + +Migration script available for existing specs, see `@typespec/migrate` for details + +### Added public formatIdentifier function + +Added public formatIdentifier function. + +### Visibility defaults to read + +Default visibility is configurable, but default to 'read'. + +## Breaking Changes + +### Cadl renamed to Typespec + +All core cadl packages moved from the `@cadl-lang` group to the `@typespec` group + +| Old Package Name | New Package Name | +| --------------------- | ------------------------------ | +| @cadl-lang/compiler | @typespec/compiler | +| @cadl-lang/rest | @typespec/rest, @typespec/http | +| @cadl-lang/migrate | @typespec/migrate | +| @cadl-lang/openapi | @typespec/openapi | +| @cadl-lang/openapi3 | @typespec/openapi3 | +| @cadl-lang/versioning | @typespec/versioning | + +### `rest` library split into `http` and `rest` libraries + +Basic http protocol support is in the `http` library, support for resources and ReST are in the `rest` library. The migration tool will correctly update imports in your spec to match the new +libraries. + +### Removed Support for Visual Studio 2019 in Visual Studio IDE extension + +You must use a later version of Visual Studio + +### Removed `emitters` option in configuration + +Use `emit` and `options` instead diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2023-04-11.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-04-11.md new file mode 100644 index 0000000000..6f0fa53770 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-04-11.md @@ -0,0 +1,116 @@ +--- +title: April 2023 +--- + +# Release Notes April 2023 (2023-04-11) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### @typespec/compiler + +- Emit diagnostic when ambiguous symbol exists between global and usings +- Add support for referencing metatypes ModelProperty `::type` and Operation `::returnType` and `::parameters` +- Relax constraint on derived type overrides +- Prevent use of augment decorators on instantiated templates. +- Allow projectedNames helpers to work with previous projections +- Add helper `interpolatePath` for emitter to do additional interpolation on config properties +- Api: Update `getTypeName` to omit standard library namespace +- Allow overloads in interfaces to work under projection +- Add pre-projection support +- Provide access to extended interfaces in type graph +- Document member ordering and fix projection rename reordering + +### @typespec/openapi3 + +- Support shared routes +- Update to use new `interpolatePath` logic to resolve the `output-file` + +### @typespec/migrate + +- Add migrate script for zonedDateTime +- Add migration script for `@header` and `@query` format required + +## Bug Fixes + +### @typespec/compiler + +- Fix: emitter framework will now visit scalar declarations +- Fix: Alias unknown ref crash +- Fix: Empty model expression assignable to array +- Fix: `tsp code uninstall` not finding extension to uninstall +- Fix: Issue where template parameter type check wouldn't work if constraint is exact same type as next validation + +### @typespec/rest + +- Fix: Issue where `@action("")` was treated the same as `@action`. Now this emits an error. + +### @typespec/versioning + +- Fix: Issue with using version as a template parameter across different namespaces. Includes a significant change in the versioning library internals. +- Fix:Use pre-projections to fix issues with versioned resources. + +### VS Code extension + +- Fix: Highlighting of TypeSpec code blocks in markdown. + +## Breaking Changes + +### @typespec/versioning: Removed deprecated versioning symbols. + +- Removed `@versionedDependency` decorator. Use `@useDependency` instead. +- Removed `getRenamedFromVersion`. Use `getRenamedFromVersions` instead. +- Removed `getRenamedFromOldName`. Use `getNameAtVersion` instead. +- Removed `getAddedOn`, `addedAfter`, `getRemovedOn` and `removedOnOrBefore`. Use `existsAtVersion` instead. +- Removed `renamedAfter`. Use `hasDifferentNameAtVersion` instead. + +### @typespec/compiler: Removed `zonedDateTime` and replaced with `utcDateTime` and `offsetDateTime` + +To disambiguate important time concepts and encourage best practice behavior in representing date-time types we +removed `zonedDateTime` which was being used to represent a time with offset, and replaced it with two new types that are more precisely defined: + +- `utcDateTime` which represents a precise instant in time. This type should be used to represent time values given in coordinated universal time (UTC) and unix timestamps. This is the preferred mechanism for capturing dateTime in most service specifications. +- `offsetDateTime` which represents a time with offset. Note that while this time contains an offset from UTC, it does not contain any additional time zone information. + +#### Change instances of `zonedDateTime` to `utcDateTime` + +##### Old + +```typespec +model MyModel { + createdAt: zonedDateTime; +} +``` + +#### New + +```typespec +model MyModel { + createdAt: utcDateTime; +} +``` + +#### Use the (experimental) Migration tool to make this change + +The (experimental) migration tool will automatically migrate instances of `zonedDateTime` to `utcDateTime`. To perform all migrations in a TypeSpec or Cadl specification package, execute: + +```bash +npx @typespec/migrate +``` + +If you would like to execute from a different folder or don't have a package.json that indicates compiler package versions, please see command line options: + +```bash +npx @typespec/migrate --help +``` + +### @typespec/http: Removed header and query default format + +`@header` and `@query` no longer default the `format` to `csv` and `multi` respectively. A value must now be provided when the type is an array. The migration tool can also be used to make this change. + +### @typespec/lint: Removed global state + +Rules from another library can no longer be enabled on a LibraryLinter. diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2023-05-10.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-05-10.md new file mode 100644 index 0000000000..249a9b0777 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-05-10.md @@ -0,0 +1,133 @@ +--- +title: May 2023 +--- + +# Release Notes May 2023 (2023-05-10) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### @typespec/compiler features + +- Add `@encode` decorator, with new formats for date and duration encoding support + - `"rfc3339"`, `"rfc7231'` for `utcDateTime`, `offsetDateTime` types + - `"unixTimestamp"` support for `utcDateTime` type + - `"iso8601"` support for `duration` types + - `"base64"`, `"base64url"` support for `bytes` types +- Allow default values for required model properties and parameters +- `sourceModel` property added to `Model` types +- `sourceOperation` property added to `Operation` types +- `Model` and `Scalar` types added to `TypeSpec.Reflection` namespace + +### @typespec/http features + +- add `@sharedRoute` decorator +- allow union types within a response status code + +### @typespec/openapi3 features + +- Enhanced support for shared routes +- Support for union types within a response status code + +## Bug Fixes + +- General fixes to generated reference documentation for all modules + +### @typespec/compiler fixes + +- Fix: compiler mismatch error recommendation +- Fix: Interface with templated operation causing crash if defined after use +- Fix: Issue with templated operations in templated interface would get cached only by keying on the operation template args. +- Fix: `missing-index` diagnostic showing at the wrong location +- Fix: `--emit` pointing to emitter js entrypoint resolve correct options +- Fix: `scalar` template parameter name conflict with each other + +### @typespec/migrate fixes + +- Fix: incorrect resolution of tsp version +- Fix: always loading current version of compiler + +### @typespec/openapi3 fixes + +- Fix openapi3 emitter to mark request body required +- Fix issue where shared request bodies did not emit correctly. + +### @typespec/rest + +- Add validation to ensure that @action or @collectionAction operations have a specified name when used with `@sharedRoute` + +### @typespec/versioning + +- Fix: Crash during validation when using certain templated models from versioned library +- Added validation preventing version enums from having duplicate values. +- Fix issue where "is" dependencies were not detected. +- Raise error if versioned spec specifies a single service version. + +## Breaking Changes + +### `@typespec/compiler`: `isTemplateDeclaration` will only return true for the original declaration and not partially instantiated templates + +If library or emitter code needs to detect a partially instantiated template, the code will need to check `isTemplateInstance` _and_ `isTemplateDeclaration` properties are false. + +## Deprecations + +### `@typespec/compiler`: Use `@encode` instead of `@format` for encoding scalars and properties of type `bytes` + +The new `@encode` decorator should be used whenever the serialized type on the wire differs from the analogous TypeSpec type + +#### Old deprecated usage of `@format` decorator + +```typespec +model Foo { + @format("base64url") + bar: bytes; +} +``` + +#### New usage of `@encode` decorator + +```typespec +model Foo { + @encode("base64url") + bar: bytes; +} +``` + +### http: Use `@sharedRoute` instead of the `shared` property of `@route` options + +The new `@sharedRoute` decorator replaces `@route` options for identifying operations that share a route + +#### Old deprecated usage of `@route` decorator `shared` option + +```typespec +@route( + "/doStuff", + { + shared: true, + } +) +op doIntStuff(input: int32): int32; + +@route( + "/doStuff", + { + shared: true, + } +) +op doStringStuff(input: string): string; +``` + +#### New usage of `@sharedRoute` decorator + +```typespec +@sharedRoute +@route("/doStuff") +op doIntStuff(input: int32): int32; + +@sharedRoute +@route("/doStuff") +op doStringStuff(input: string): string; +``` diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2023-06-06.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-06-06.md new file mode 100644 index 0000000000..d8df3c9510 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-06-06.md @@ -0,0 +1,152 @@ +--- +title: June 2023 +--- + +# Release Notes June 2023 (2023-06-06) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +- Json Schema Emitter +- New decimal types +- Support for using doc comments instead of the @doc decorator +- New `valueof` type constraint modifier for type literals +- Lazy evaluation of emitter configuration +- Signature Help for Template Arguments and other IDE improvements + +### New Decimal Types + +Added support for `decimal` and `decimal128` types + +```typespec +model Foo { + price: decimal; + shortPrice: decimal128; +} +``` + +These types represent values stored in decimal format which are often used in financial calculations to avoid rounding errors introduced by binary floating point formats. `decimal` can store values of any size and precision, while `decimal128` corresponds to the 128 bit decimal floating point format described by IEEE 754. + +### Support for Doc Comments + +Doc comments (`/** */`) will be treated as the documentation for types, unless there is an explicit `@doc` decorator + +```typespec +/** This will now be the documentation for model Foo */ +model Foo { + name: string; +} +``` + +### New `valueof` type constraint modifier to require type literals + +Templates and decorators can now constrain arguments to literal types. For example, the following template constraint: + +```typespec +model Foo { + @doc(T) + name: string; +} +``` + +would match quoted literal strings, "this", as well as references to enum values. Templates and decorators that require string values should change to using this new formulation. + +### Allow lazy evaluation of emitter config + +- Validate linter configuration only for linters that are executing. This removes warnings for emitters that are configured but not available in a particular compilation. + +### Enable Signature Help for Template Arguments + +- Template completion will now have similar help in IDE language server as decorators currently do. + +### Show documentation Comments on Aliases in IDE Language Tooling + +- Documentation comments will show up in the IDE, just as documentation comments for other library types. + +### Ensure a dev release for all packages + +- Packages with no changes will now release with a `-dev.0` version in dev releases. + +### Json Schema Emitter + +- Core packages now contain a Json Schema emitter `@typespec/json-schema` + +## Bug Fixes + +-`tspconfig.yaml` should always get resolved relative to the entrypoint. + +- `Array` and `Record` doc comments are treated as developer documentation. + +- Fixed formatting of comment between decorator and `op` statement. + +- Decorators on operations may reference the same operation, or may reference an operation that references this operation. + +```typespec +interface FooOperations { + @nextPageOperation(getNextPage) // allowed + getNextPage(pageLink: url): Page; +} +``` + +- Fix validation for `unixTimeStamp`. + +- Fix diagnostic for `intrinsic type expected` to not assume `string` as the required type. + +- Fix error message for `@encode` errors. + +- Fix error handling when template is missing or invalid in `tsp init`. + +- Emitter framework: uppercase type argument type names when constructing a declaration name from a template instantiation. + +- Add reference documentation for missing decorators. + +- Remove dependency on `node-fetch`. + +- Remove inaccurate output directory message from compilation success. + +- Allow template resolution over http redirects for `tsp init` templates. + +- Improve signature help for an unterminated argument list. + +## New Deprecations + +- Templates that use decorators with the `valueof` constraint will receive a warning if their input types are not similarly constrained. + +```typespec +model Foo { + @doc(T) // valueof constraint here will cause a warning + id: uuid; +} +``` + +should be changed to apply the valueof constraint to their parameters that are passed to such decorators: + +```typespec +model Foo { + @doc(T) // no warning + id: uuid; +} +``` + +- The `object` type is deprecated. Templates and decorators should use TypeSpec.Reflection.Model to indicate a model contraint. In specs, `{}` designates and empty model, `unknown[]` indicates and empty array, and `Record` indicates a keyed type with unknown property types. + +## Breaking Changes + +- Decorators that require literal type value marshalling MUST change to using the `valueof` keyword. + +```typespec +extern dec myDecorator(target: Type, name: string); +``` + +Must be changed to use the valueof decorator + +```typespec +extern dec myDecorator(target: Type, name: valueof string); +``` + +- Arrays are no longer assignable to an empty model (or object) + +- Remove `@format(\"url\") from url scalar. OpenAPI emitters will still emit the appropriate format, emitters should rely on the scalar type to determine how to process the url type, not the format string. diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2023-07-11.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-07-11.md new file mode 100644 index 0000000000..f59cd4be2d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-07-11.md @@ -0,0 +1,92 @@ +--- +title: July 2023 +--- + +# Release Notes July 2023 (2023-07-11) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### `@typespec/compiler` and core language + +- New built-in linter system. Typespec libraries are able to define linting rules which can be configured in `tspconfig.yaml`. See documentation for [configuring a linter](https://microsoft.github.io/typespec/introduction/configuration#linter---configuring-linters) and [writing a linter](https://microsoft.github.io/typespec/extending-typespec/linters) +- Allow decorators, directives and doc comments to be specified in any order +- Format doc comments above decorators and directives +- Improve formatting for properties with comments and decorators +- Support for new Unicode 15.0 identifier characters + +### Emitter framework + +- Add `writeOutput` to TypeEmitter for additional customization in writing generated files +- Add `meta` property to source files and declarations to store arbitrary metadata +- Add support for emitting enum member references +- Add new `TypeEmitter` methods for scalar instantiation + +### `@typespec/http` library + +- Add documentation on automatic header name resolution from property name for `@header` decorator + +### `@typespec/json-schema` emitter + +- Support `@extension` for adding arbitrary vendor extensions into the output +- Add support for `Record` +- Support templates instantiated with intrinsic types and type expressions +- Export emitter and related types from the npm package +- By default, types that are not marked with `@jsonSchema` or are within a namespace with `@jsonSchema` are bundled into the schemas that reference them. Set the `emitAllRefs` option to true to get the previous behavior of emitting all types referenced as JSON Schema + +### `@typespec/openapi3` emitter + +- Omit `x-typespec-name` extension by default from openapi3 output. A new configuration and command line option `include-x-typespec-name: \"inline-only\" | \"never\"` has been added to get previous behavior + +### `@typespec/rest` library + +- Add `isListOperation` function migrated from `@typespec/compiler` + +## Bug Fixes + +### `@typespec/compiler` and core language bug fixes + +- Add support for `UTF-8 with bom` for other files loaded by typespec compiler. `.tsp` files already had support, this make it more available for any library/emitter using the compiler api to load a file. +- Fix signature help after comment with no closing parenthesis or angle bracket +- Doc comment `/** */` should override base type doc in `model is` or `op is` +- Formatter incorrectly formatting `::` to `.` +- Fix formatting issue with comment between decorator and scalar or interface +- Fix stack overflow when a circular reference with `op is` exists inside an interface. +- Clean up handling of non-standard entrypoints in language server +- Fix stack overflow when referencing decorator target in checker and projections + +### `@typespec/openapi3` emitter bug fixes + +- OpenAPI emitters: treat union namespaces like namespaces for other types + +### Emitter framework bug fixes + +- Fix that some context methods were not being passed the expected parameters +- Fix that context was set incorrectly for some `TypeEmitter` methods, and add missing context methods for model properties, enum members, and union variants + +### `@typespec/json-schema` emitter bug fixes + +- Fix a bug that could result in a schema being bundled more than once + +## Breaking Changes + +### For Specification Authors + +- Update tsp init template schema for future extensibility. Older tsp version will fail validation when trying to initialize a project with a new template definition. +- Json Schema Emitter: the namespace has been corrected to TypeSpec.JsonSchema. Update any using statements from `JsonSchema` to `TypeSpec.JsonSchema`, and any references from `JsonSchema.[Type]` to `TypeSpec.JsonSchema.[Type]`. + +### For Emitters and Libraries + +- Minimum version of TypeScript updated to 5.0. TypeSpec is using new features available in TypeScript 5.0 which result in a definition file not parsable by older version. Note that this only affect compiling TypeScript code and is not breaking any JS or TypeSpec code. [See more information on typescript 5.0](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/) +- Emitter Framework: Add support for templates instantiated with types without declared names. In such cases, `TypeEmitter`'s declarationName method may return `undefined`, and so the various `*Instantiation` methods might be called with an undefined name, and `AssetEmitter`'s `emitDeclarationName` method might return undefined. +- Make internal `@resourceTypeForKeyParam` decorator in `@typespec/rest` library private + +## Deprecations + +- `@list` decorator from TypeSpec core is deprecated. Use `@listsResource` from `@typespec/http` instead +- `isListOperation` function from TypeSpec core is deprecated. Use `isListOperation` from `@typespec/http` instead +- `getListOperationType` from TypeSpec core is deprecated +- `@typespec/linter` Package is deprecated in favor of built-in linter system diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2023-08-08.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-08-08.md new file mode 100644 index 0000000000..2258de93d2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-08-08.md @@ -0,0 +1,59 @@ +--- +title: August 2023 +--- + +# Release Notes August 2023 (2023-08-08) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### `@typespec/compiler` New Features + +- Allow unnamed variants in named unions +- Add `#deprecated` directive to replace `@deprecated` decorator, allowing deprecation any language element +- Add a new util `resolveCompilerOptions` to resolve compiler options from a given entrypoint. This will resolve the options from the tspconfig.yaml in the same way the cli would. +- Improvements to compiler watch mode. Files loaded in previous compilation will be watched for changes. +- Allow library dependency versions to be specified in init templates using the form `{ name: \"the-lib\", version: \"1.0.0\" }` +- Update init template version compare to be greaterThanAndEqual instead of greaterThan. + +### `@typespec/http` New Features + +- Update model, operation and template docs for OpenAPI developers +- Add collection format support for query and header properties: simple, form, ssv, tsv, pipes + +### `@typespec/openapi` and `@typespec/openapi3` New Features + +- Add new `@info` decorator providing the ability to specify the additional fields from openapi info object. +- Support collection format support for query and header properties: simple, form, ssv, tsv, pipes +- Change datetimes encoded with `rfc7231` to produce format `http-date` instead of `date-time-rfc7231` to be inline with [Openapi format registry](https://spec.openapis.org/registry/format/) + +## Bug Fixes + +### `@typespec/compiler` Bug Fixes + +- Fix: Compiler version mismatch error would fire incorrectly +- Fix some issues with not reporting deprecation on template constraints +- Fix issue where using augment decorators on spread model properties, enum members or operations extended from parent interface would have no effect. +- Fix issue where using augment decorator on operation parameters applied to source operation parameter as well. +- Fix `warn-as-error` configuration in `tspconfig.yaml` was ignored +- Emit diagnostic for an unresolved metatype property reference +- Fix crash when `using` argument is not a namespace + +### `@typespec/openapi3` Bug Fixes + +- Fix: Emit clear diagnostics for empty unions and enum types +- Fix: Apply `@minItems` and `@maxItems` decorators on model array + +### `@typespec/jsonschema` + +- Fix: Crash when using interfaces inside a `@jsonSchema` namespace + +## Breaking Changes + +### `@typespec/compiler` Breaking Changes + +- Emitter Framework: `sourceFile` method can return a `Promise`. This allows running async processes when generating the file content, such as a formatter. This results in a potential breaking change if calling `emitSourceFile` where you'll have to add `await` before. +- The helper function `formatTypeSpec` is now async. Formatter was updated to use prettier 3.0. diff --git a/packages/website-astro/src/content/docs/latest/release-notes/release-2023-09-12.md b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-09-12.md new file mode 100644 index 0000000000..ba0bf66744 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/release-notes/release-2023-09-12.md @@ -0,0 +1,87 @@ +--- +title: September 2023 +--- + +# Release Notes September 2023 (2023-09-12) + +:::danger +This release contains **breaking changes** +::: + +## New Features + +### `@typespec/compiler` New Features + +- Allow library authors to precisely define the visibility of operation templates with new decorators `@parameterVisibility` and `@returnTypeVisibility`, paired with corresponding accessor methods `getParameterVisibility` and `getReturnTypeVisibility`. +- Add coloring for documentation comments in Visual Studio and Visual Studio Code language extensions. +- Change yaml parser from `js-yaml` to `yaml`, enabling more precise validation and error reporting in `tspconfig.yaml` +- Added validation to ensure that properties of a derived model (using `extends`) are compatible with the base model indexer. +- Export `CompilerOptions` TypeScript type. +- Report library information when library code crashes during `$onValidate` execution. +- Diagnostics reported on a node with an `id` property will highlight the id instead of the entire node. For example, if a diagnostic is reported on a `model` type, the model name will be highlighted, instead of the entire model definition. + +### `@typespec/http` New Features + +- Add new helper method `resolveRequestVisibility` which incorporates settings from new core decorators `@parameterVisibility` and `@returnTypeVisibility`. This replaces the deprecated `getRequestVisibility` helper. +- Add new helper method `getDefaultVisibilityForVerb` which returns the default visibility for Http verbs. +- Add validation step to issue a warning when an `operation is` statement does not include route information from the original operation container (`interface` or `namespace`). This helps to prevent unexpected route changes when using operation references. +- Add validation to prevent runtime errors when `OAuth2Auth` is given invalid `OAuth2Flow` arguments. + +### `@typespec/json-schema` New Features + +- Support decimal scalar types. + +### `@typespec/openapi3` New Features + +- Allow library authors to override default Http verb visibility in operation declarations. + +### `@typespec/protobuf` New features + +- Support `omit-unreachable-types` option. +- Automatically convert empty operation parameters into a reference to `google.protobuf.Empty` instead of synthesizing an empty model. + +### `typespec-vscode` New features + +- Add color definition for `@param` tag in documentation comments + +## Bug Fixes + +### `@typespec/compiler` Bug Fixes + +- Fix issue where specifying a directory using the `--config` command line option would search the parent folder hierarchy looking for `tspconfig.yaml`. +- Fix Stack overflow when a model property references itself. +- Fix compiler crash when using the alias of a namespace that has decorators. +- Fix compiler freeze when an invalid token appears between doc comment and type. +- Fix compiler crash when relating recursive types. +- Fix typo in format error diagnostic. + +### `@typespec/openapi3` Bug Fixes + +- Fixed issue where parameters marked with visibility \"create\" did not appear in a `PATCH` request body. +- Fixed incorrect usage of `exclusiveMinimum` and `exclusiveMaximum` boolean properties. +- Use `anyOf` instead of `oneOf` for operations with shared routes and different request or response bodies. +- Fix handling of `Record` in `model is` and `model extends` statements. + +### `@typespec/versioning` Bug Fixes + +- Fixed validation in `@typeChangedFrom` for incorrect versioned references. + +## Deprecations + +### `@typespec/compiler` Deprecations + +- The `@deprecated` decorator has been marked as deprecated. Use `#deprecated` directive instead. + +### `@typespec/http` Deprecations + +- The `getRequestVisibility` helper function is now deprecated. Use `resolveRequestVisibility` or `getDefaultVisibilityForVerb` instead. + +## Breaking Changes + +### `@typespec/compiler` Breaking Changes + +- A semicolon is now required at the end of augment decorator statements. The formatter was already inserting the semicolon, if omitted. For example: + + ```tsp + @@doc(MyType.myProperty, "Documentation for myProperty"); + ``` diff --git a/packages/website-astro/src/content/docs/latest/release-notes/signature-help.png b/packages/website-astro/src/content/docs/latest/release-notes/signature-help.png new file mode 100644 index 0000000000..63d02f100c Binary files /dev/null and b/packages/website-astro/src/content/docs/latest/release-notes/signature-help.png differ diff --git a/packages/website-astro/src/content/docs/latest/standard-library/built-in-data-types.md b/packages/website-astro/src/content/docs/latest/standard-library/built-in-data-types.md new file mode 100644 index 0000000000..9badf3d43e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/built-in-data-types.md @@ -0,0 +1,415 @@ +--- +title: "Built-in Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- +# Data types +## TypeSpec +### `Array` {#Array} + + + + +```typespec +model Array +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | The type of the array elements | + + + +### `DefaultKeyVisibility` {#DefaultKeyVisibility} + +Applies a visibility setting to a collection of properties. + +```typespec +model DefaultKeyVisibility +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | An object whose properties are spread. | +| Visibility | The visibility to apply to all properties. | + + + +### `object` {#object} + +Represent a model + +```typespec +model object +``` + + + +### `OmitDefaults` {#OmitDefaults} + +Represents a collection of properties with default values omitted. + +```typespec +model OmitDefaults +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | An object whose spread property defaults are all omitted. | + + + +### `OmitProperties` {#OmitProperties} + +Represents a collection of omitted properties. + +```typespec +model OmitProperties +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | An object whose properties are spread. | +| TKeys | The property keys to omit. | + + + +### `OptionalProperties` {#OptionalProperties} + +Represents a collection of optional properties. + +```typespec +model OptionalProperties +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | An object whose spread properties are all optional. | + + + +### `Record` {#Record} + + + + +```typespec +model Record +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | The type of the properties | + + + +### `ServiceOptions` {#ServiceOptions} + +Service options. + +```typespec +model ServiceOptions +``` + + + +### `UpdateableProperties` {#UpdateableProperties} + +Represents a collection of updateable properties. + +```typespec +model UpdateableProperties +``` + +#### Template Parameters +| Name | Description | +|------|-------------| +| T | An object whose spread properties are all updateable. | + + + +### `BytesKnownEncoding` {#BytesKnownEncoding} + +Known encoding to use on bytes + +```typespec +enum BytesKnownEncoding +``` + + + +### `DateTimeKnownEncoding` {#DateTimeKnownEncoding} + +Known encoding to use on utcDateTime or offsetDateTime + +```typespec +enum DateTimeKnownEncoding +``` + + + +### `DurationKnownEncoding` {#DurationKnownEncoding} + +Known encoding to use on duration + +```typespec +enum DurationKnownEncoding +``` + + + +### `boolean` {#boolean} + +Boolean with `true` and `false` values. + +```typespec +scalar boolean +``` + + + +### `bytes` {#bytes} + +Represent a byte array + +```typespec +scalar bytes +``` + + + +### `decimal` {#decimal} + +A decimal number with any length and precision. + +```typespec +scalar decimal +``` + + + +### `decimal128` {#decimal128} + +A 128-bit decimal number. + +```typespec +scalar decimal128 +``` + + + +### `duration` {#duration} + +A duration/time period. e.g 5s, 10h + +```typespec +scalar duration +``` + + + +### `float` {#float} + +A number with decimal value + +```typespec +scalar float +``` + + + +### `float32` {#float32} + +A 32 bit floating point number. (`±5.0 × 10^−324` to `±1.7 × 10^308`) + +```typespec +scalar float32 +``` + + + +### `float64` {#float64} + +A 32 bit floating point number. (`±1.5 x 10^−45` to `±3.4 x 10^38`) + +```typespec +scalar float64 +``` + + + +### `int16` {#int16} + +A 16-bit integer. (`-32,768` to `32,767`) + +```typespec +scalar int16 +``` + + + +### `int32` {#int32} + +A 32-bit integer. (`-2,147,483,648` to `2,147,483,647`) + +```typespec +scalar int32 +``` + + + +### `int64` {#int64} + +A 64-bit integer. (`-9,223,372,036,854,775,808` to `9,223,372,036,854,775,807`) + +```typespec +scalar int64 +``` + + + +### `int8` {#int8} + +A 8-bit integer. (`-128` to `127`) + +```typespec +scalar int8 +``` + + + +### `integer` {#integer} + +A whole number + +```typespec +scalar integer +``` + + + +### `numeric` {#numeric} + +A numeric type + +```typespec +scalar numeric +``` + + + +### `offsetDateTime` {#offsetDateTime} + +A date and time in a particular time zone, e.g. "April 10th at 3:00am in PST" + +```typespec +scalar offsetDateTime +``` + + + +### `plainDate` {#plainDate} + +A date on a calendar without a time zone, e.g. "April 10th" + +```typespec +scalar plainDate +``` + + + +### `plainTime` {#plainTime} + +A time on a clock without a time zone, e.g. "3:00 am" + +```typespec +scalar plainTime +``` + + + +### `safeint` {#safeint} + +An integer that can be serialized to JSON (`−9007199254740991 (−(2^53 − 1))` to `9007199254740991 (2^53 − 1)` ) + +```typespec +scalar safeint +``` + + + +### `string` {#string} + +A sequence of textual characters. + +```typespec +scalar string +``` + + + +### `uint16` {#uint16} + +A 16-bit unsigned integer (`0` to `65,535`) + +```typespec +scalar uint16 +``` + + + +### `uint32` {#uint32} + +A 32-bit unsigned integer (`0` to `4,294,967,295`) + +```typespec +scalar uint32 +``` + + + +### `uint64` {#uint64} + +A 64-bit unsigned integer (`0` to `18,446,744,073,709,551,615`) + +```typespec +scalar uint64 +``` + + + +### `uint8` {#uint8} + +A 8-bit unsigned integer (`0` to `255`) + +```typespec +scalar uint8 +``` + + + +### `url` {#url} + +Represent a URL string as described by https://url.spec.whatwg.org/ + +```typespec +scalar url +``` + + + +### `utcDateTime` {#utcDateTime} + +An instant in coordinated universal time (UTC)" + +```typespec +scalar utcDateTime +``` + + diff --git a/packages/website-astro/src/content/docs/latest/standard-library/built-in-decorators.md b/packages/website-astro/src/content/docs/latest/standard-library/built-in-decorators.md new file mode 100644 index 0000000000..a6dcb9ade1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/built-in-decorators.md @@ -0,0 +1,997 @@ +--- +title: "Built-in Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- +# Built-in Decorators +## TypeSpec +### `@deprecated` {#@deprecated} + +Mark this type as deprecated. + +NOTE: This decorator **should not** be used, use the `#deprecated` directive instead. + +```typespec +@deprecated(message: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| message | `valueof scalar string` | Deprecation message. | + +#### Examples + +Use the `#deprecated` directive instead: + +```typespec +#deprecated "Use ActionV2" +op Action(): T; +``` + + +### `@discriminator` {#@discriminator} + +Specify the property to be used to discriminate this type. + +```typespec +@discriminator(propertyName: valueof string) +``` + +#### Target + +`union Model | Union` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| propertyName | `valueof scalar string` | The property name to use for discrimination | + +#### Examples + +```typespec +@discriminator("kind") +union Pet{ cat: Cat, dog: Dog } + +model Cat {kind: "cat", meow: boolean} +model Dog {kind: "dog", bark: boolean} +``` + +```typespec +@discriminator("kind") +model Pet{ kind: string } + +model Cat extends Pet {kind: "cat", meow: boolean} +model Dog extends Pet {kind: "dog", bark: boolean} +``` + + +### `@doc` {#@doc} + +Attach a documentation string. + +```typespec +@doc(doc: valueof string, formatArgs?: {}) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| doc | `valueof scalar string` | Documentation string | +| formatArgs | `model {}` | Record with key value pair that can be interpolated in the doc. | + +#### Examples + +```typespec +@doc("Represent a Pet available in the PetStore") +model Pet {} +``` + + +### `@encode` {#@encode} + +Specify how to encode the target type. + +```typespec +@encode(encoding: string | EnumMember, encodedAs?: Scalar) +``` + +#### Target + +`union Scalar | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| encoding | `union string \| EnumMember` | Known name of an encoding. | +| encodedAs | `Scalar` | What target type is this being encoded as. Default to string. | + +#### Examples +##### offsetDateTime encoded with rfc7231 + + +```tsp +@encode("rfc7231") +scalar myDateTime extends offsetDateTime; +``` + +##### utcDateTime encoded with unixTimestamp + + +```tsp +@encode("unixTimestamp", int32) +scalar myDateTime extends unixTimestamp; +``` + + +### `@error` {#@error} + +Specify that this model is an error type. Operations return error types when the operation has failed. + +```typespec +@error +``` + +#### Target + +`Model` + +#### Parameters +None + +#### Examples + +```typespec +@error +model PetStoreError { +code: string; +message: string; +} +``` + + +### `@errorsDoc` {#@errorsDoc} + +Attach a documentation string to describe the error return types of an operation. +If an operation returns a union of success and errors it only describe the errors. See `@errorsDoc` for success documentation. + +```typespec +@errorsDoc(doc: valueof string) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| doc | `valueof scalar string` | Documentation string | + +#### Examples + +```typespec +@errorsDoc("Returns doc") +op get(): Pet | NotFound; +``` + + +### `@format` {#@format} + +Specify a known data format hint for this string type. For example `uuid`, `uri`, etc. +This differs from the `@pattern` decorator which is meant to specify a regular expression while `@format` accepts a known format name. +The format names are open ended and are left to emitter to interpret. + +```typespec +@format(format: valueof string) +``` + +#### Target + +`union string | bytes | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| format | `valueof scalar string` | format name. | + +#### Examples + +```typespec +@format("uuid") +scalar uuid extends string; +``` + + +### `@friendlyName` {#@friendlyName} + +Specifies how a templated type should name their instances. + +```typespec +@friendlyName(name: valueof string, formatArgs?: unknown) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| name | `valueof scalar string` | name the template instance should take | +| formatArgs | `(intrinsic) unknown` | Model with key value used to interpolate the name | + +#### Examples + +```typespec +@friendlyName("{name}List", T) +model List { +value: T[]; +nextLink: string; +} +``` + + +### `@inspectType` {#@inspectType} + +A debugging decorator used to inspect a type. + +```typespec +@inspectType(text: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| text | `valueof scalar string` | Custom text to log | + + + +### `@inspectTypeName` {#@inspectTypeName} + +A debugging decorator used to inspect a type name. + +```typespec +@inspectTypeName(text: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| text | `valueof scalar string` | Custom text to log | + + + +### `@key` {#@key} + +Mark a model property as the key to identify instances of that type + +```typespec +@key(altName?: valueof string) +``` + +#### Target + +`ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| altName | `valueof scalar string` | Name of the property. If not specified, the decorated property name is used. | + +#### Examples + +```typespec +model Pet { +@key id: string; +} +``` + + +### `@knownValues` {#@knownValues} + +Provide a set of known values to a string type. + +```typespec +@knownValues(values: Enum) +``` + +#### Target + +`union string | numeric | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| values | `Enum` | Known values enum. | + +#### Examples + +```typespec +@knownValues(KnownErrorCode) +scalar ErrorCode extends string; + +enum KnownErrorCode { +NotFound, +Invalid, +} +``` + + +### `@list` {#@list} + +Mark this operation as a `list` operation for resource types. + +```typespec +@list(listedType?: Model) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| listedType | `Model` | Optional type of the items in the list. | + + + +### `@maxItems` {#@maxItems} + +Specify the maximum number of items this array should have. + +```typespec +@maxItems(value: valueof integer) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar integer` | Maximum number | + +#### Examples + +```typespec +@maxItems(5) +model Endpoints is string[]; +``` + + +### `@maxLength` {#@maxLength} + +Specify the maximum length this string type should be. + +```typespec +@maxLength(value: valueof integer) +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar integer` | Maximum length | + +#### Examples + +```typespec +@maxLength(20) +scalar Username extends string; +``` + + +### `@maxValue` {#@maxValue} + +Specify the maximum value this numeric type should be. + +```typespec +@maxValue(value: valueof numeric) +``` + +#### Target + +`union numeric | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar numeric` | Maximum value | + +#### Examples + +```typespec +@maxValue(200) +scalar Age is int32; +``` + + +### `@maxValueExclusive` {#@maxValueExclusive} + +Specify the maximum value this numeric type should be, exclusive of the given +value. + +```typespec +@maxValueExclusive(value: valueof numeric) +``` + +#### Target + +`union numeric | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar numeric` | Maximum value | + +#### Examples + +```typespec +@maxValueExclusive(50) +scalar distance is float64; +``` + + +### `@minItems` {#@minItems} + +Specify the minimum number of items this array should have. + +```typespec +@minItems(value: valueof integer) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar integer` | Minimum number | + +#### Examples + +```typespec +@minItems(1) +model Endpoints is string[]; +``` + + +### `@minLength` {#@minLength} + +Specify the minimum length this string type should be. + +```typespec +@minLength(value: valueof integer) +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar integer` | Minimum length | + +#### Examples + +```typespec +@minLength(2) +scalar Username extends string; +``` + + +### `@minValue` {#@minValue} + +Specify the minimum value this numeric type should be. + +```typespec +@minValue(value: valueof numeric) +``` + +#### Target + +`union numeric | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar numeric` | Minimum value | + +#### Examples + +```typespec +@minValue(18) +scalar Age is int32; +``` + + +### `@minValueExclusive` {#@minValueExclusive} + +Specify the minimum value this numeric type should be, exclusive of the given +value. + +```typespec +@minValueExclusive(value: valueof numeric) +``` + +#### Target + +`union numeric | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| value | `valueof scalar numeric` | Minimum value | + +#### Examples + +```typespec +@minValueExclusive(0) +scalar distance is float64; +``` + + +### `@overload` {#@overload} + +Specify this operation is an overload of the given operation. + +```typespec +@overload(overloadbase: Operation) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| overloadbase | `Operation` | Base operation that should be a union of all overloads | + +#### Examples + +```typespec +op upload(data: string | bytes, @header contentType: "text/plain" | "application/octet-stream"): void; +@overload(upload) +op uploadString(data: string, @header contentType: "text/plain" ): void; +@overload(upload) +op uploadBytes(data: bytes, @header contentType: "application/octet-stream"): void; +``` + + +### `@parameterVisibility` {#@parameterVisibility} + +Sets which visibilities apply to parameters for the given operation. + +```typespec +@parameterVisibility(...visibilities: valueof string[]) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| visibilities | `valueof model string[]` | List of visibility strings which apply to this operation. | + + + +### `@pattern` {#@pattern} + +Specify the the pattern this string should respect using simple regular expression syntax. +The following syntax is allowed: alternations (`|`), quantifiers (`?`, `*`, `+`, and `{ }`), wildcard (`.`), and grouping parentheses. +Advanced features like look-around, capture groups, and references are not supported. + +```typespec +@pattern(pattern: valueof string) +``` + +#### Target + +`union string | bytes | ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| pattern | `valueof scalar string` | Regular expression. | + +#### Examples + +```typespec +@pattern("[a-z]+") +scalar LowerAlpha extends string; +``` + + +### `@projectedName` {#@projectedName} + +Provide an alternative name for this type. + +```typespec +@projectedName(targetName: valueof string, projectedName: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| targetName | `valueof scalar string` | Projection target | +| projectedName | `valueof scalar string` | Alternative name | + +#### Examples + +```typespec +model Certificate { +@projectedName("json", "exp") +expireAt: int32; +} +``` + + +### `@returnsDoc` {#@returnsDoc} + +Attach a documentation string to describe the successful return types of an operation. +If an operation returns a union of success and errors it only describe the success. See `@errorsDoc` for error documentation. + +```typespec +@returnsDoc(doc: valueof string) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| doc | `valueof scalar string` | Documentation string | + +#### Examples + +```typespec +@returnsDoc("Returns doc") +op get(): Pet | NotFound; +``` + + +### `@returnTypeVisibility` {#@returnTypeVisibility} + +Sets which visibilities apply to the return type for the given operation. + +```typespec +@returnTypeVisibility(...visibilities: valueof string[]) +``` + +#### Target + +`Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| visibilities | `valueof model string[]` | List of visibility strings which apply to this operation. | + + + +### `@secret` {#@secret} + +Mark this string as a secret value that should be treated carefully to avoid exposure + +```typespec +@secret +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters +None + +#### Examples + +```typespec +@secret +scalar Password is string; +``` + + +### `@service` {#@service} + +Mark this namespace as describing a service and configure service properties. + +```typespec +@service(options?: ServiceOptions) +``` + +#### Target + +`Namespace` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| options | `model ServiceOptions` | Optional configuration for the service. | + +#### Examples + +```typespec +@service +namespace PetStore; +``` + +##### Setting service title + +```typespec +@service({title: "Pet store"}) +namespace PetStore; +``` + +##### Setting service version + +```typespec +@service({version: "1.0"}) +namespace PetStore; +``` + + +### `@summary` {#@summary} + +Typically a short, single-line description. + +```typespec +@summary(summary: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| summary | `valueof scalar string` | Summary string. | + +#### Examples + +```typespec +@summary("This is a pet") +model Pet {} +``` + + +### `@tag` {#@tag} + +Attaches a tag to an operation, interface, or namespace. Multiple `@tag` decorators can be specified to attach multiple tags to a TypeSpec element. + +```typespec +@tag(tag: valueof string) +``` + +#### Target + +`union Namespace | Interface | Operation` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| tag | `valueof scalar string` | Tag value | + + + +### `@visibility` {#@visibility} + +Indicates that a property is only considered to be present or applicable ("visible") with +the in the given named contexts ("visibilities"). When a property has no visibilities applied +to it, it is implicitly visible always. + +As far as the TypeSpec core library is concerned, visibilities are open-ended and can be arbitrary +strings, but the following visibilities are well-known to standard libraries and should be used +with standard emitters that interpret them as follows: + +- "read": output of any operation. +- "create": input to operations that create an entity.. +- "query": input to operations that read data. +- "update": input to operations that update data. +- "delete": input to operations that delete data. + +See also: [Automatic visibility](https://microsoft.github.io/typespec/standard-library/http/operations#automatic-visibility) + +```typespec +@visibility(...visibilities: valueof string[]) +``` + +#### Target + +`ModelProperty` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| visibilities | `valueof model string[]` | List of visibilities which apply to this property. | + +#### Examples + +```typespec +model Dog { +// the service will generate an ID, so you don't need to send it. +@visibility("read") id: int32; +// the service will store this secret name, but won't ever return it +@visibility("create", "update") secretName: string; +// the regular name is always present +name: string; +} +``` + + +### `@withDefaultKeyVisibility` {#@withDefaultKeyVisibility} + +Set the visibility of key properties in a model if not already set. + +```typespec +@withDefaultKeyVisibility(visibility: valueof string) +``` + +#### Target + +`Model` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| visibility | `valueof scalar string` | The desired default visibility value. If a key property already has a `visibility` decorator then the default visibility is not applied. | + + + +### `@withOptionalProperties` {#@withOptionalProperties} + +Returns the model with required properties removed. + +```typespec +@withOptionalProperties +``` + +#### Target + +`Model` + +#### Parameters +None + + + +### `@withoutDefaultValues` {#@withoutDefaultValues} + +Returns the model with any default values removed. + +```typespec +@withoutDefaultValues +``` + +#### Target + +`Model` + +#### Parameters +None + + + +### `@withoutOmittedProperties` {#@withoutOmittedProperties} + +Returns the model with the given properties omitted. + +```typespec +@withoutOmittedProperties(omit: string | Union) +``` + +#### Target + +`Model` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| omit | `union string \| Union` | List of properties to omit | + + + +### `@withUpdateableProperties` {#@withUpdateableProperties} + +Returns the model with non-updateable properties removed. + +```typespec +@withUpdateableProperties +``` + +#### Target + +`Model` + +#### Parameters +None + + + +### `@withVisibility` {#@withVisibility} + +Removes properties that are not considered to be present or applicable +("visible") in the given named contexts ("visibilities"). Can be used +together with spread to effectively spread only visible properties into +a new model. + +See also: [Automatic visibility](https://microsoft.github.io/typespec/standard-library/http/operations#automatic-visibility) + +When using an emitter that applies visibility automatically, it is generally +not necessary to use this decorator. + +```typespec +@withVisibility(...visibilities: valueof string[]) +``` + +#### Target + +`Model` + +#### Parameters +| Name | Type | Description | +|------|------|-------------| +| visibilities | `valueof model string[]` | List of visibilities which apply to this property. | + +#### Examples + +```typespec +model Dog { +@visibility("read") id: int32; +@visibility("create", "update") secretName: string; +name: string; +} + +// The spread operator will copy all the properties of Dog into DogRead, +// and @withVisibility will then remove those that are not visible with +// create or update visibility. +// +// In this case, the id property is removed, and the name and secretName +// properties are kept. +@withVisibility("create", "update") +model DogCreateOrUpdate { +...Dog; +} + +// In this case the id and name properties are kept and the secretName property +// is removed. +@withVisibility("read") +model DogRead { +...Dog; +} +``` + diff --git a/packages/website-astro/src/content/docs/latest/standard-library/discriminated-types.md b/packages/website-astro/src/content/docs/latest/standard-library/discriminated-types.md new file mode 100644 index 0000000000..3c616c844f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/discriminated-types.md @@ -0,0 +1,104 @@ +--- +title: Discriminated types +--- + +TypeSpec can express unions and inheritance. However, when sending types over the wire many languages need a way to discriminate between the various union variants or models in an inheritance hierarchy. + +TypeSpec provide the [`@discriminator` decorator](./built-in-decorators#@discriminator) to be able to help with this pattern. + +### Using polymorphism + +#### `string` discriminator + +```typespec +@discriminator("kind") +model Pet { + name: string; + weight?: float32; +} +model Cat extends Pet { + kind: "cat"; + meow: int32; +} +model Dog extends Pet { + kind: "dog"; + bark: string; +} +``` + +#### `enum` discriminator + +```typespec +enum PetKind { + cat, + dog, +} + +@discriminator("kind") +model Pet { + kind: PetKind; + name: string; + weight?: float32; +} +model Cat extends Pet { + kind: PetKind.cat; + meow: int32; +} +model Dog extends Pet { + kind: PetKind.dog; + bark: string; +} +``` + +#### Nested discriminator + +```tsp +@discriminator("kind") +model Pet { + kind: string; + name: string; + weight?: float32; +} + +@discriminator("breed") +model Cat extends Pet { + kind: "cat"; + breed: string; + meow: int32; +} + +@discriminator("breed") +model Siamese extends Cat { + breed: "siamese"; +} + +@discriminator("breed") +model Bengal extends Cat { + breed: "bengal"; +} + +model Dog extends Pet { + kind: "dog"; + bark: string; +} +``` + +### Using unions + +```typespec +@discriminator("kind") +union Pet { + cat: Cat, + dog: Dog, +} + +model Cat { + kind: "cat"; + meow: int32; +} + +model Dog { + kind: "dog"; + bark: string; +} +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/authentication.md b/packages/website-astro/src/content/docs/latest/standard-library/http/authentication.md new file mode 100644 index 0000000000..70390f5561 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/authentication.md @@ -0,0 +1,113 @@ +--- +title: Authentication +--- + +# Configure Http Authentication + +Notes: + +- Authentication right now can ONLY be configured at the service level. + +## Configure + +Authentication can be configured using the `@useAuth` decorator on the service namespace. The decorator accept a few options: + +- A security scheme (see options [here](https://github.com/microsoft/typespec/blob/main/packages/http/lib/auth.tsp)). This means this is the security scheme to use to authenticate this service. + +```typespec +@useAuth(Auth1) +``` + +- A tuple of security scheme. This means ALL the different security schemes of the tuple MUST be used together to authenticate this service. + +```typespec +// Use BOTH Auth1 or Auth2 +@useAuth([Auth1, Auth2]) +``` + +- A union of security scheme. This means EITHER of the security schemes can be used to authenticate this service + +```typespec +// Use EITHER Auth1 or Auth2 +@useAuth(Auth1 | Auth2) +``` + +- A union of tuple security scheme. This means EITHER of the security groups schemes can be used to authenticate this service + +```typespec +// Use EITHER (Auth1 AND Auth2) OR Auth3 +@useAuth([Auth1, Auth2] | Auth3) +``` + +## Available security schemes + +Models can be found in https://github.com/microsoft/typespec/blob/main/packages/http/lib/auth.tsp + +### `BasicAuth` + +Basic authentication is a simple authentication scheme built into the HTTP protocol. +The client sends HTTP requests with the Authorization header that contains the word Basic word followed by a space and a base64-encoded string username:password. +For example, to authorize as demo / p@55w0rd the client would send + +``` + Authorization: Basic ZGVtbzpwQDU1dzByZA== +``` + +```typespec +@useAuth(BasicAuth) +``` + +### `BearerAuth` + +Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. +The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. +The client must send this token in the Authorization header when making requests to protected resources: + +``` + Authorization: Bearer +``` + +```typespec +@useAuth(BearerAuth) +``` + +### `ApiKeyAuth` + +An API key is a token that a client provides when making API calls. The key can be sent in the query string: + +``` +GET /something?api_key=abcdef12345 +``` + +```typespec +@useAuth(ApiKeyAuth) +``` + +or as a request header + +``` +GET /something HTTP/1.1 +X-API-Key: abcdef12345 +``` + +```typespec +@useAuth(ApiKeyAuth) +``` + +or as a cookie + +``` +GET /something HTTP/1.1 +Cookie: X-API-KEY=abcdef12345 +``` + +```typespec +@useAuth(ApiKeyAuth) +``` + +### `OAuth2Auth` + +OAuth 2.0 is an authorization protocol that gives an API client limited access to user data on a web server. +OAuth relies on authentication scenarios called flows, which allow the resource owner (user) to share the protected content from the resource server without sharing their credentials. +For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner. +For more information about OAuth 2.0, see oauth.net and RFC 6749. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/cheat-sheet.md b/packages/website-astro/src/content/docs/latest/standard-library/http/cheat-sheet.md new file mode 100644 index 0000000000..cfad5acd06 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/cheat-sheet.md @@ -0,0 +1,52 @@ +--- +title: Cheat sheet +--- + +## Verb + +| Feature | Example | +| ---------------- | --------------------------- | +| Get operation | `@get op read(): void` | +| Put operation | `@put op set(): void` | +| Post operation | `@post op add(): void` | +| Patch operation | `@patch op patch(): void` | +| Delete operation | `@delete op delete(): void` | +| Head operation | `@head op read(): void` | + +## Routing + +| Feature | Example | +| ---------------------------------- | ------------------------------------------------------------------------------------------ | +| Fixed route | `@route("/pets") op list(): Pet[]` | +| Route with path parameter | `@route("/pets/{petId}") op getPet(petId: string): Pet` | +| Route with multiple path parameter | `@route("/stores/{storeId}/pets/{petId}/") op getPet(storeId: string, petId: string): Pet` | + +## Data types + +| Feature | Example | +| ----------------------- | ------------------------------------------- | +| Request header | `op read(@header traceparent: string): Pet` | +| Response header | `op read(): {@header eTag: string, ...Pet}` | +| Query parameter | `op list(@query filter: string): Pet[]` | +| Explicit body parameter | `op add(@body pet: Pet): void` | +| Implicit body parameter | `op add(...Pet): void` | +| Status code | `op read(): {@statusCode _: 200, ...Pet}` | + +## Server + +| Feature | Example | +| ------------- | ------------------------------------------------------------------------------------- | +| Single | `@server("https://example.com", "Example 1 endpoint")` | +| Multiple | `@server("https://example1.com", "E1") @server("https://example2.com", "E2")` | +| Parameterized | `@server("https://{region}.example.com", "Region scoped endpoint", {region: string})` | + +## Authentication + +_Details: [Authentication](./authentication.md)_ + +| Feature | Example | +| --------------- | ------------------------------------------- | +| Basic auth | `@useAuth(BasicAuth)` | +| Bearer auth | `@useAuth(BearerAuth)` | +| Api key auth | `@useAuth(ApiKeyAuth<"header", "Api-Key">)` | +| OAuth2 key auth | `@useAuth(OAuth2Flow<[MyScope]>)` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/content-types.md b/packages/website-astro/src/content/docs/latest/standard-library/http/content-types.md new file mode 100644 index 0000000000..f2420d1fd4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/content-types.md @@ -0,0 +1,99 @@ +--- +title: Content types +--- + +## Default behavior + +Content type is assumed to be `application/json` by default regardless of the type of the request or response body. + +**Examples:** + +```typespec +op download(): bytes; // Returns a json string with the bytes serialized as a base64. +op getContent(): string; // Returns a json string +op getPet(): { + // Json object with a name property. + name: string; +}; +``` + +## Specify content type + +The content type for an operation can be specified by including a header parameter named `contentType`. + +#### Request content type + +```typespec +op uploadImage(@header contentType: "image/png", @body image: bytes): void; +``` + +#### Response content type: + +```typespec +op downloadImage(): { + @header contentType: "image/png"; + @body image: bytes; +}; +``` + +#### Multiple content types + +If there is multiples content types for the same body, they can be specified using a union of string. + +```typespec +op uploadImage(@header contentType: "image/png" | "image/jpeg", @body image: bytes): void; +``` + +## Content type negotiation + +There could be cases where you might the same endpoint to return different content depending on the content type requested. This can be achieved in 2 ways: + +- using shared routes where different content response is represented as a different operation that share the same endpoint +- using overloads where each different content response is an overload. + +For example assuming there is an api that lets you download the avatar as a `png` or `jpeg` which is decided by what `Accept` header is sent. + +### Option 1: Using shared route + +```tsp +model PngImage { + @header contentType: "image/png"; + @body image: bytes; +} + +model JpegImage { + @header contentType: "image/jpeg"; + @body image: bytes; +} + +@route("/avatar") +@sharedRoute +op getAvatarAsPng(@header accept: "image/png"): PngImage; + +@route("/avatar") +@sharedRoute +op getAvatarAsJpeg(@header accept: "image/jpeg"): JpegImage; +``` + +### Option 2: Using overload + +```tsp +model PngImage { + @header contentType: "image/png"; + @body image: bytes; +} + +model JpegImage { + @header contentType: "image/jpeg"; + @body image: bytes; +} + +@route("/avatar") +op getAvatar(@header accept: "image/png" | "image/jpeg"): PngImage | JpegImage; + +@overload(getAvatar) +op getAvatarAsPng(@header accept: "image/png"): PngImage; + +@overload(getAvatar) +op getAvatarAsJpeg(@header accept: "image/jpeg"): JpegImage; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/encoding.md b/packages/website-astro/src/content/docs/latest/standard-library/http/encoding.md new file mode 100644 index 0000000000..5089b05dd1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/encoding.md @@ -0,0 +1,136 @@ +--- +title: Encoding of types +--- + +This document describe how the http library interpret TypeSpec built-in types and how to configure + +## `bytes` + +**Default behavior:** + +- `bytes` are serialized as `base64` when used inside a model serialized as JSON +- In request or response body it represent a binary payload. + +:::note +This behavior is only a specification and MUST be respected by the emitter. The http library DOES NOT automatically apply the `@encode("base64")` when used inside a JSON model. +::: + +Use `@encode` to configure + +```tsp +model Pet { + icon: bytes; // Serialize as base64 + @encode(BytesKnownEncoding.base64url) // Serialize as base64url + other: bytes; +} + +op read(): Pet; + +op download(): bytes; // Return application/octet-stream +op upload(@body data: bytes): void; // Accept application/octet-stream +``` + +## `utcDatetime` and `offsetDateTime` + +**Default behavior:** + +- Encoded as `rfc7231` when used in a header +- Encoded as `rfc3339` otherwise. + +:::note +This behavior is only a specification and MUST be respected by the emitter. The http library DOES NOT automatically apply the `@encode("rfc7231")` on `utcDatetime` and `offsetDateTime` when used in a header. +::: + +Use `@encode` to configure. + + + + + + + +
TypeSpecExample payload
+ +```tsp +model User { + // Headers + @header("Created-At") createdAtHeader: utcDateTime; + + @header("Created-At-Rfc3339") + @encode(DateTimeKnownEncoding.rfc3339) + createdAtHeaderRfc3339Encoding: utcDateTime; + + // In Json payload + createdAt: utcDateTime; // rfc3339 + + updatedAt: offsetDateTime; // rfc3339 + + @encode(DateTimeKnownEncoding.rfc7231) + createdAtPretty: utcDateTime; // rfc7231 + + @encode(DateTimeKnownEncoding.rfc7231) + updatedAtPretty: offsetDateTime; // rfc7231 + + @encode(DateTimeKnownEncoding.unixTimestamp, int32) + createdAtUnix: utcDateTime; // unixTime +} +``` + + + +```yaml +Created-At: Wed, 12 Oct 2022 07:20:50 GMT +Created-At-Rfc3339: 2022-10-12T07:20:50.52Z +``` + +```json +{ + "createdAt": "2022-10-12T07:20:50.52Z", + "updatedAt": "2022-10-25T07:20:50.52+07:00", + "createdAtPretty": "Wed, 12 Oct 2022 07:20:50 GMT", + "updatedAtPretty": "Tue, 25 Oct 2022 00:20:50 GMT", + "createdAtUnix": 1665559250520 +} +``` + +
+ +## `duration` + +**Default behavior:** + +- Encoded as `ISO8601` + +Use `@encode` to configure. + + + + + + + +
TypeSpecExample payload
+ +```tsp +model User { + runtime: duration; // ISO8601 + + @encode(DurationKnownEncoding.seconds, int32) + runtimeInSecondsInt: duration; // in seconds as an int32 + + @encode(DurationKnownEncoding.seconds, float32) + runtimeInSecondsFloat: duration; // in seconds as a float32 +} +``` + + + +```json +{ + "runtime": "PT5M5S", + "runtimeInSecondsInt": "305", + "runtimeInSecondsFloat": "305.0" +} +``` + +
diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/operations.md b/packages/website-astro/src/content/docs/latest/standard-library/http/operations.md new file mode 100644 index 0000000000..3ca6eded77 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/operations.md @@ -0,0 +1,415 @@ +--- +title: Operations +--- + +# Http Operations + +## Operation verb + +**Default behavior:** + +- If `@post` operation has a request body +- `@get` otherwise + +**Configure:** + +You can use one of the [verb decorators](./reference/decorators.md): `@get`, `@put`, etc. + +## Route + +An operation route can be specified using the `@route` decorator. + +```typespec +@route("/pets") op list(): Pet[]; +``` + +Route path parameters are declared using `{}`. Providing `@path` on the model property with the matching name is optional. + +```typespec +@route("/pets/{petId}") op get(petId: string): Pet; +// or explicit @path +@route("/pets/{petId}") op get(@path petId: string): Pet; +``` + +Route can be specified on a parent namespace or interface. In that case all the operations, interfaces and namespaces underneath will be prefixed with it. + +```typespec +@route("/store") +namespace PetStore { + op hello(): void; // `/store` + @route("ping") op ping(): void; // `/store/ping` + + @route("/pets") + interface Pets { + list(): Pet[]; // `/store/pets` + @route("{petId}") read(petId: string): Pet; // `/store/pets/{petId}` + } +} +``` + +## Path and query parameters + +Model properties and parameters which should be passed as path and query parameters use the `@path` and `@query` parameters respectively. Let's modify our list operation to support pagination, and add a read operation to our Pets resource: + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): Pet[]; + op read(@path petId: int32): Pet; +} +``` + +Path parameters are appended to the URL unless a substitution with that parameter name exists on the resource path. For example, we might define a sub-resource using the following TypeSpec. Note how the path parameter for our sub-resource's list operation corresponds to the substitution in the URL. + +```typespec +@route("/pets/{petId}/toys") +namespace PetToys { + op list(@path petId: int32): Toy[]; +} +``` + +## Request & response bodies + +Request and response bodies can be declared explicitly using the `@body` decorator. Let's add an endpoint to create a pet. Let's also use this decorator for the responses, although this doesn't change anything about the API. + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): { + @body pets: Pet[]; + }; + op read(@path petId: int32): { + @body pet: Pet; + }; + @post + op create(@body pet: Pet): {}; +} +``` + +Note that in the absence of explicit `@body`: + +1. The set of parameters that are not marked @header, @query, or @path form the request body. +2. The set of properties of the return model that are not marked @header or @statusCode form the response body. +3. If the return type is not a model, then it defines the response body. + +This is how we were able to return Pet and Pet[] bodies without using @body for list and read. We can actually write +create in the same terse style by spreading the Pet object into the parameter list like this: + +See also [metadata](./operations.md#metadata) for more advanced details. + +```typespec +@route("/pets") +namespace Pets { + @post + op create(...Pet): {}; +} +``` + +## Headers + +Model properties and parameters that should be passed in a header use the `@header` decorator. The decorator takes the header name as a parameter. If a header name is not provided, it is inferred from the property or parameter name. Let's add `etag` support to our pet store's read operation. + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): { + @body pets: Pet[]; + }; + op read(@path petId: int32, @header ifMatch?: string): { + @header eTag: string; + @body pet: Pet; + }; + @post + op create(@body pet: Pet): {}; +} +``` + +## Status codes + +**Default behavior:** + +- `4xx,5xx` if response is marked with `@error` +- `200` otherwise + +**Configure:** + +Use the `@header` decorator on a property named `statusCode` to declare a status code for a response. Generally, setting this to just `int32` isn't particularly useful. Instead, use number literal types to create a discriminated union of response types. Let's add status codes to our responses, and add a 404 response to our read endpoint. + +```typespec +@route("/pets") +namespace Pets { + @error + model Error { + code: string; + } + + op list(@query skip: int32, @query top: int32): { + @body pets: Pet[]; // statusCode: 200 Implicit + }; + op read(@path petId: int32, @header ifMatch?: string): { + @statusCode statusCode: 200; + @header eTag: string; + @body pet: Pet; + } | { + @statusCode statusCode: 404; + }; + op create(@body pet: Pet): { + @statusCode statusCode: 204; + } | Error; //statusCode: 4xx,5xx as Error use `@error` decorator +} +``` + +## Content type + +[See content types docs](./content-types.md) + +### Default behavior + +Depending on the body of the operation http library will assume different content types: + +- `bytes`: `application/octet-stream` +- `string`: `text/plain` +- an `object` or anything else: `application/json` + +**Examples:** + +```typespec +op download(): bytes; // response content type is application/octet-stream +op upload(@body file: bytes): void; // request content type is application/octet-stream +op getContent(): string; // response content type is text/plain +op getPet(): { + // response content type is application/json + name: string; +}; +``` + +### Specify content type + +The content type for an operation can be specified by including a header parameter named `contentType`. + +#### Request content type + +```typespec +op uploadImage(@header contentType: "image/png", @body image: bytes): void; +``` + +#### Response content type: + +```typespec +op downloadImage(): { + @header contentType: "image/png"; + @body image: bytes; +}; +``` + +#### Multiple content types + +```typespec +op uploadImage(@header contentType: "image/png" | "image/jpeg", @body image: bytes): void; +``` + +## Built-in response shapes + +Since status codes are so common for REST APIs, TypeSpec comes with some built-in types for common status codes so you don't need to declare status codes so frequently. + +There is also a `Body` type, which can be used as a shorthand for { @body body: T } when an explicit body is required. + +Lets update our sample one last time to use these built-in types: + +```typespec +model ETag { + @header eTag: string; +} +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): OkResponse & Body; + op read(@path petId: int32, @header ifMatch?: string): (OkResponse & + Body & + ETag) | NotFoundResponse; + @post + op create(...Pet): NoContentResponse; +} +``` + +Note that the default status code is 200 for non-empty bodies and 204 for empty bodies. Similarly, explicit `Body` is not required when T is known to be a model. So the following terser form is equivalent: + +```typespec +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): Pet[]; + op read(@path petId: int32, @header ifMatch?: string): (Pet & ETag) | NotFoundResponse; + @post + op create(...Pet): {}; +} +``` + +Finally, another common style is to make helper response types that are +shared across a larger service definition. In this style, you can be +entirely explicit while also keeping operation definitions concise. + +For example, we could write : + +```typespec +model ListResponse { + ...OkResponse; + ...Body; +} + +model ReadSuccessResponse { + ...OkResponse; + ...ETag; + ...Body; +} + +alias ReadResponse = ReadSuccessResponse | NotFoundResponse; + +model CreateResponse { + ...NoContentResponse; +} + +@route("/pets") +namespace Pets { + op list(@query skip: int32, @query top: int32): ListResponse; + op read(@path petId: int32, @header ifMatch?: string): ReadResponse; + @post + op create(...Pet): CreateResponse; +} +``` + +## Automatic visibility + +The `@typespec/rest` library understands the following well-known [visibilities](../../standard-library/built-in-decorators.md#visibility-decorators) and provides functionality for emitters to apply them based on whether on request vs. response and HTTP method usage as detailed in the table below. + +See [handling visibility and metadata](../../extending-typespec/emitter-metadata-handling.md) for how to incorporate this into + +| Name | Visible in | +| -------- | -------------------- | +| "read" | Any response | +| "query" | GET or HEAD request | +| "create" | POST or PUT request | +| "update" | PATCH or PUT request | +| "delete" | DELETE request | + +This allows a single logical TypeSpec model to be used as in the following example: + +```typespec +model User { + name: string; + @visibility("read") id: string; + @visibility("create") password: string; +} + +@route("/users") +interface Users { + @post create(@path id: string, ...User): User; + @get get(@path id: string): User; +} +``` + +There is a single logical user entity represented by the single TypeSpec type `User`, but the HTTP payload for this entity varies based on context. When returned in a response, the `id` property is included, but when sent in a request, it is not. Similarly, the `password` property is only included in create requests, but not present in responses. + +The OpenAPI v3 emitter will apply these visibilities automatically, without explicit use of `@withVisibility`, and it will generate separate schemas suffixed by visibility when necessary. `@visibility("read")` can be expressed in OpenAPI without generating additional schema by specifying `readOnly: true` and the OpenAPI v3 emitter will leverage this a an optimization, but other visibilities will generate additional schemas. For example, `@visibility("create")` applied to a model property of a type named Widget will generate a `WidgetCreate` schema. + +Another emitter such as one generating client code can see and preserve a single logical type and deal with these HTTP payload differences by means other than type proliferation. + +Modeling with logical entities rather than HTTP-specific shapes also keeps the TypeSpec spec decoupled from HTTP and REST and can allow the same spec to be used with multiple protocols. + +## Metadata + +The properties that designate content for the HTTP envelope (`@header`, `@path`, `@query`, `@statusCode`) rather than the content in an HTTP payload are often called "metadata". + +Metadata is determined to be applicable or inapplicable based on the context that it is used: + +| Context | Applicability | +| ------------- | ------------------- | +| `@query` | request only | +| `@path` | request only | +| `@statusCode` | response only | +| `@header` | request or response | + +Additionally metadata that appears in an array element type always inapplicable. + +When metadata is deemed "inapplicable", for example, if a `@path` property is seen in a response, it becomes part of the payload instead unless the [@includeInapplicableMetadataInPayload](./reference/decorators.md#@TypeSpec.Rest.includeinapplicablemetadatainpayload) decorator is used and given a value of `false`. + +The handling of metadata applicability furthers the goal of keeping a single logical model in TypeSpec. For example, this defines a logical `User` entity that has a name, ID and password, but further annotates that the ID is sent in the HTTP path and the HTTP body in responses. Also, using automatically visibility as before, we further indicate that the password is only present in create requests. + +```typespec +model User { + name: string; + @path id: string; + @visibility("create") password: string; +} +``` + +Then, we can write operations in terms of the logical entity: + +```typespec +@route("/users") +interface Users { + @post create(...User): User; +} +``` + +Abstractly, this expresses that a create operation that takes and returns a user. But concretely, at the HTTP protocol level, a create request and response look like this: + +``` +POST /Users/TypeSpecFan42 HTTP/1.1 +Content-Type: application/json +{ + "name": "TypeSpec Fan", + "password": "Y0uW1llN3v3rGu3ss!" +} + +HTTP/1.1 200 OK +Content-Type: application/json +{ + name: "TypeSpec Fan", + id: "TypeSpecFan42 +} +``` + +### Visibility vs. Metadata applicability + +Metadata properties are filtered based on visibility as [described above](#automatic-visibility). This is done independently before applicability is considered. If a a metadata property is not visible then it is neither part of the envelope nor the HTTP payload, irrespective of its applicability. + +### Nested metadata + +Metadata properties are not required to be top-level. They can also be nested deeper in a parameter or response model type. For example: + +```typespec +model Thing { + headers: { + @header example: string; + }; + name: string; +} +``` + +Note that nesting in this sense does not require the use of anonymous models. This is equivalent: + +```typespec +model Thing { + headers: Headers; + name: string; +} +model Headers { + @header example: string; +} +``` + +In the event that this nesting introduces duplication, then the least nested property with a given name is preferred and the duplicate metadata properties are ignored. + +```typespec +model Thing { + headers: { + @header example: string; // preferred + more: { + @header example: string; // ignored + }; + }; +} +``` + +## Emitter resources + +See [Handling metadata and visibility in emitters for REST API](../../extending-typespec/emitter-metadata-handling.md) for information on how to handle metadata applicability and automatic visibility in a custom emitter. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/data-types.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/data-types.md new file mode 100644 index 0000000000..d575a9d13d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/data-types.md @@ -0,0 +1,301 @@ +--- +title: "Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Data types + +## TypeSpec.Http + +### `AcceptedResponse` {#TypeSpec.Http.AcceptedResponse} + +The request has been accepted for processing, but processing has not yet completed. + +```typespec +model TypeSpec.Http.AcceptedResponse +``` + +### `ApiKeyAuth` {#TypeSpec.Http.ApiKeyAuth} + +An API key is a token that a client provides when making API calls. The key can be sent in the query string: + +``` +GET /something?api_key=abcdef12345 +``` + +or as a request header + +``` +GET /something HTTP/1.1 +X-API-Key: abcdef12345 +``` + +or as a cookie + +``` +GET /something HTTP/1.1 +Cookie: X-API-KEY=abcdef12345 +``` + +```typespec +model TypeSpec.Http.ApiKeyAuth +``` + +#### Template Parameters + +| Name | Description | +| --------- | --------------------------- | +| TLocation | The location of the API key | +| TName | The name of the API key | + +### `AuthorizationCodeFlow` {#TypeSpec.Http.AuthorizationCodeFlow} + +Authorization Code flow + +```typespec +model TypeSpec.Http.AuthorizationCodeFlow +``` + +### `BadRequestResponse` {#TypeSpec.Http.BadRequestResponse} + +The server could not understand the request due to invalid syntax. + +```typespec +model TypeSpec.Http.BadRequestResponse +``` + +### `BasicAuth` {#TypeSpec.Http.BasicAuth} + +Basic authentication is a simple authentication scheme built into the HTTP protocol. +The client sends HTTP requests with the Authorization header that contains the word Basic word followed by a space and a base64-encoded string username:password. +For example, to authorize as demo / `p@55w0rd` the client would send + +``` +Authorization: Basic ZGVtbzpwQDU1dzByZA== +``` + +```typespec +model TypeSpec.Http.BasicAuth +``` + +### `BearerAuth` {#TypeSpec.Http.BearerAuth} + +Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. +The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. +The client must send this token in the Authorization header when making requests to protected resources: + +``` +Authorization: Bearer +``` + +```typespec +model TypeSpec.Http.BearerAuth +``` + +### `Body` {#TypeSpec.Http.Body} + +Defines a model with a single property of the given type, marked with `@body`. + +This can be useful in situations where you cannot use a bare T as the body +and it is awkward to add a property. + +```typespec +model TypeSpec.Http.Body +``` + +#### Template Parameters + +| Name | Description | +| ---- | ---------------------------------------- | +| T | The type of the model's `body` property. | + +### `ClientCredentialsFlow` {#TypeSpec.Http.ClientCredentialsFlow} + +Client credentials flow + +```typespec +model TypeSpec.Http.ClientCredentialsFlow +``` + +### `ConflictResponse` {#TypeSpec.Http.ConflictResponse} + +The request conflicts with the current state of the server. + +```typespec +model TypeSpec.Http.ConflictResponse +``` + +### `CreatedResponse` {#TypeSpec.Http.CreatedResponse} + +The request has succeeded and a new resource has been created as a result. + +```typespec +model TypeSpec.Http.CreatedResponse +``` + +### `ForbiddenResponse` {#TypeSpec.Http.ForbiddenResponse} + +Access is forbidden. + +```typespec +model TypeSpec.Http.ForbiddenResponse +``` + +### `HeaderOptions` {#TypeSpec.Http.HeaderOptions} + +Header options. + +```typespec +model TypeSpec.Http.HeaderOptions +``` + +### `ImplicitFlow` {#TypeSpec.Http.ImplicitFlow} + +Implicit flow + +```typespec +model TypeSpec.Http.ImplicitFlow +``` + +### `LocationHeader` {#TypeSpec.Http.LocationHeader} + +The Location header contains the URL where the status of the long running operation can be checked. + +```typespec +model TypeSpec.Http.LocationHeader +``` + +### `MovedResponse` {#TypeSpec.Http.MovedResponse} + +The URL of the requested resource has been changed permanently. The new URL is given in the response. + +```typespec +model TypeSpec.Http.MovedResponse +``` + +### `NoContentResponse` {#TypeSpec.Http.NoContentResponse} + +There is no content to send for this request, but the headers may be useful. + +```typespec +model TypeSpec.Http.NoContentResponse +``` + +### `NotFoundResponse` {#TypeSpec.Http.NotFoundResponse} + +The server cannot find the requested resource. + +```typespec +model TypeSpec.Http.NotFoundResponse +``` + +### `NotModifiedResponse` {#TypeSpec.Http.NotModifiedResponse} + +The client has made a conditional request and the resource has not been modified. + +```typespec +model TypeSpec.Http.NotModifiedResponse +``` + +### `OAuth2Auth` {#TypeSpec.Http.OAuth2Auth} + +OAuth 2.0 is an authorization protocol that gives an API client limited access to user data on a web server. +OAuth relies on authentication scenarios called flows, which allow the resource owner (user) to share the protected content from the resource server without sharing their credentials. +For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner. +For more information about OAuth 2.0, see oauth.net and RFC 6749. + +```typespec +model TypeSpec.Http.OAuth2Auth +``` + +#### Template Parameters + +| Name | Description | +| ------ | ---------------------------------- | +| TFlows | The list of supported OAuth2 flows | + +### `OkResponse` {#TypeSpec.Http.OkResponse} + +The request has succeeded. + +```typespec +model TypeSpec.Http.OkResponse +``` + +### `PasswordFlow` {#TypeSpec.Http.PasswordFlow} + +Resource Owner Password flow + +```typespec +model TypeSpec.Http.PasswordFlow +``` + +### `PlainData` {#TypeSpec.Http.PlainData} + +Produces a new model with the same properties as T, but with `@query`, +`@header`, `@body`, and `@path` decorators removed from all properties. + +```typespec +model TypeSpec.Http.PlainData +``` + +#### Template Parameters + +| Name | Description | +| ---- | -------------------------------------- | +| T | The model to spread as the plain data. | + +### `QueryOptions` {#TypeSpec.Http.QueryOptions} + +Query parameter options. + +```typespec +model TypeSpec.Http.QueryOptions +``` + +### `Response` {#TypeSpec.Http.Response} + +Describes an HTTP response. + +```typespec +model TypeSpec.Http.Response +``` + +#### Template Parameters + +| Name | Description | +| ------ | -------------------------------- | +| Status | The status code of the response. | + +### `UnauthorizedResponse` {#TypeSpec.Http.UnauthorizedResponse} + +Access is unauthorized. + +```typespec +model TypeSpec.Http.UnauthorizedResponse +``` + +### `ApiKeyLocation` {#TypeSpec.Http.ApiKeyLocation} + +Describes the location of the API key + +```typespec +enum TypeSpec.Http.ApiKeyLocation +``` + +### `AuthType` {#TypeSpec.Http.AuthType} + +Authentication type + +```typespec +enum TypeSpec.Http.AuthType +``` + +### `OAuth2FlowType` {#TypeSpec.Http.OAuth2FlowType} + +Describes the OAuth2 flow type + +```typespec +enum TypeSpec.Http.OAuth2FlowType +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/decorators.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/decorators.md new file mode 100644 index 0000000000..71892dba54 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/decorators.md @@ -0,0 +1,427 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.Http + +### `@body` {#@TypeSpec.Http.body} + +Explicitly specify that this property is to be set as the body + +```typespec +@TypeSpec.Http.body +``` + +#### Target + +`ModelProperty` + +#### Parameters + +None + +#### Examples + +```typespec +op upload(@body image: bytes): void; +op download(): { + @body image: bytes; +}; +``` + +### `@delete` {#@TypeSpec.Http.delete} + +Specify the HTTP verb for the target operation to be `DELETE`. + +```typespec +@TypeSpec.Http.delete +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@delete op set(petId: string): void; +``` + +### `@get` {#@TypeSpec.Http.get} + +Specify the HTTP verb for the target operation to be `GET`. + +```typespec +@TypeSpec.Http.get +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@get op read(): string; +``` + +### `@head` {#@TypeSpec.Http.head} + +Specify the HTTP verb for the target operation to be `HEAD`. + +```typespec +@TypeSpec.Http.head +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@head op ping(petId: string): void; +``` + +### `@header` {#@TypeSpec.Http.header} + +Specify this property is to be sent or received as an HTTP header. + +```typespec +@TypeSpec.Http.header(headerNameOrOptions?: string | TypeSpec.Http.HeaderOptions) +``` + +#### Target + +`ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| headerNameOrOptions | `union string \| TypeSpec.Http.HeaderOptions` | Optional name of the header when sent over HTTP or header options.
By default the header name will be the property name converted from camelCase to kebab-case. (e.g. `contentType` -> `content-type`) | + +#### Examples + +```typespec +op read(@header accept: string): { + @header("ETag") eTag: string; +}; +op create( + @header({ + name: "X-Color", + format: "csv", + }) + colors: string[], +): void; +``` + +##### Implicit header name + +```typespec +op read(): { + @header contentType: string; +}; // headerName: content-type +op update(@header ifMatch: string): void; // headerName: if-match +``` + +### `@includeInapplicableMetadataInPayload` {#@TypeSpec.Http.includeInapplicableMetadataInPayload} + +Specify if inapplicable metadata should be included in the payload for the given entity. + +```typespec +@TypeSpec.Http.includeInapplicableMetadataInPayload(value: valueof boolean) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ----- | ------------------------ | --------------------------------------------------------------- | +| value | `valueof scalar boolean` | If true, inapplicable metadata will be included in the payload. | + +### `@patch` {#@TypeSpec.Http.patch} + +Specify the HTTP verb for the target operation to be `PATCH`. + +```typespec +@TypeSpec.Http.patch +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@patch op update(pet: Pet): void; +``` + +### `@path` {#@TypeSpec.Http.path} + +Explicitly specify that this property is to be interpolated as a path parameter. + +```typespec +@TypeSpec.Http.path(paramName?: valueof string) +``` + +#### Target + +`ModelProperty` + +#### Parameters + +| Name | Type | Description | +| --------- | ----------------------- | --------------------------------------------------- | +| paramName | `valueof scalar string` | Optional name of the parameter in the url template. | + +#### Examples + +```typespec +@route("/read/{explicit}/things/{implicit}") +op read(@path explicit: string, implicit: string): void; +``` + +### `@post` {#@TypeSpec.Http.post} + +Specify the HTTP verb for the target operation to be `POST`. + +```typespec +@TypeSpec.Http.post +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@post op create(pet: Pet): void; +``` + +### `@put` {#@TypeSpec.Http.put} + +Specify the HTTP verb for the target operation to be `PUT`. + +```typespec +@TypeSpec.Http.put +``` + +#### Target + +`Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@put op set(pet: Pet): void; +``` + +### `@query` {#@TypeSpec.Http.query} + +Specify this property is to be sent as a query parameter. + +```typespec +@TypeSpec.Http.query(queryNameOrOptions?: string | TypeSpec.Http.QueryOptions) +``` + +#### Target + +`ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ------------------ | -------------------------------------------- | ------------------------------------------------------------------------------- | +| queryNameOrOptions | `union string \| TypeSpec.Http.QueryOptions` | Optional name of the query when included in the url or query parameter options. | + +#### Examples + +```typespec +op read(@query select: string, @query("order-by") orderBy: string): void; +op list( + @query({ + name: "id", + format: "multi", + }) + ids: string[], +): void; +``` + +### `@route` {#@TypeSpec.Http.route} + +Defines the relative route URI for the target operation + +The first argument should be a URI fragment that may contain one or more path parameter fields. +If the namespace or interface that contains the operation is also marked with a `@route` decorator, +it will be used as a prefix to the route URI of the operation. + +`@route` can only be applied to operations, namespaces, and interfaces. + +```typespec +@TypeSpec.Http.route(path: valueof string, options?: (anonymous model)) +``` + +#### Target + +`union Namespace | Interface | Operation` + +#### Parameters + +| Name | Type | Description | +| ------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | +| path | `valueof scalar string` | Relative route path. Cannot include query parameters. | +| options | `model (anonymous model)` | Set of parameters used to configure the route. Supports `{shared: true}` which indicates that the route may be shared by several operations. | + +#### Examples + +```typespec +@route("/widgets") +op getWidget(@path id: string): Widget; +``` + +### `@server` {#@TypeSpec.Http.server} + +Specify the endpoint for this service. + +```typespec +@TypeSpec.Http.server(url: valueof string, description: valueof string, parameters?: Record) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| ----------- | ----------------------- | ------------------------------------------------------- | +| url | `valueof scalar string` | Server endpoint | +| description | `valueof scalar string` | Description of the endpoint | +| parameters | `model Record` | Optional set of parameters used to interpolate the url. | + +#### Examples + +```typespec +@service +@server("https://example.com", "Single server endpoint") +namespace PetStore; +``` + +##### parameterized + +```typespec +@server("https://{region}.foo.com", "Regional endpoint", { +@doc("Region name") +region?: string = "westus", +}) +``` + +### `@sharedRoute` {#@TypeSpec.Http.sharedRoute} + +`@sharedRoute` marks the operation as sharing a route path with other operations. + +When an operation is marked with `@sharedRoute`, it enables other operations to share the same +route path as long as those operations are also marked with `@sharedRoute`. + +`@sharedRoute` can only be applied directly to operations. + +```typespec +@sharedRoute +@route("/widgets") +op getWidget(@path id: string): Widget; +``` + +```typespec +@TypeSpec.Http.sharedRoute +``` + +#### Target + +`Operation` + +#### Parameters + +None + +### `@statusCode` {#@TypeSpec.Http.statusCode} + +Specify the status code for this response. Property type must be a status code integer or a union of status code integer. + +```typespec +@TypeSpec.Http.statusCode +``` + +#### Target + +`ModelProperty` + +#### Parameters + +None + +#### Examples + +```typespec +op read(): {@statusCode: 200, @body pet: Pet} +op create(): {@statusCode: 201 | 202} +``` + +### `@useAuth` {#@TypeSpec.Http.useAuth} + +Specify this service authentication. See the [documentation in the Http library](https://microsoft.github.io/typespec/standard-library/http/authentication) for full details. + +```typespec +@TypeSpec.Http.useAuth(auth: {} | Union | {}[]) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| ---- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| auth | `union {} \| Union \| {}[]` | Authentication configuration. Can be a single security scheme, a union(either option is valid authentication) or a tuple(Must use all authentication together) | + +#### Examples + +```typespec +@service +@useAuth(BasicAuth) +namespace PetStore; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/index.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/index.md new file mode 100644 index 0000000000..725b01bad4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/index.md @@ -0,0 +1,81 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec HTTP protocol binding + +## Install + + + + +```bash +npm install @typespec/http +``` + + + + +```bash +npm install --save-peer @typespec/http +``` + + + + +## TypeSpec.Http + +### Decorators + +- [`@body`](./decorators.md#@TypeSpec.Http.body) +- [`@delete`](./decorators.md#@TypeSpec.Http.delete) +- [`@get`](./decorators.md#@TypeSpec.Http.get) +- [`@head`](./decorators.md#@TypeSpec.Http.head) +- [`@header`](./decorators.md#@TypeSpec.Http.header) +- [`@includeInapplicableMetadataInPayload`](./decorators.md#@TypeSpec.Http.includeInapplicableMetadataInPayload) +- [`@patch`](./decorators.md#@TypeSpec.Http.patch) +- [`@path`](./decorators.md#@TypeSpec.Http.path) +- [`@post`](./decorators.md#@TypeSpec.Http.post) +- [`@put`](./decorators.md#@TypeSpec.Http.put) +- [`@query`](./decorators.md#@TypeSpec.Http.query) +- [`@route`](./decorators.md#@TypeSpec.Http.route) +- [`@server`](./decorators.md#@TypeSpec.Http.server) +- [`@sharedRoute`](./decorators.md#@TypeSpec.Http.sharedRoute) +- [`@statusCode`](./decorators.md#@TypeSpec.Http.statusCode) +- [`@useAuth`](./decorators.md#@TypeSpec.Http.useAuth) + +### Models + +- [`AcceptedResponse`](./data-types.md#TypeSpec.Http.AcceptedResponse) +- [`ApiKeyAuth`](./data-types.md#TypeSpec.Http.ApiKeyAuth) +- [`AuthorizationCodeFlow`](./data-types.md#TypeSpec.Http.AuthorizationCodeFlow) +- [`BadRequestResponse`](./data-types.md#TypeSpec.Http.BadRequestResponse) +- [`BasicAuth`](./data-types.md#TypeSpec.Http.BasicAuth) +- [`BearerAuth`](./data-types.md#TypeSpec.Http.BearerAuth) +- [`Body`](./data-types.md#TypeSpec.Http.Body) +- [`ClientCredentialsFlow`](./data-types.md#TypeSpec.Http.ClientCredentialsFlow) +- [`ConflictResponse`](./data-types.md#TypeSpec.Http.ConflictResponse) +- [`CreatedResponse`](./data-types.md#TypeSpec.Http.CreatedResponse) +- [`ForbiddenResponse`](./data-types.md#TypeSpec.Http.ForbiddenResponse) +- [`HeaderOptions`](./data-types.md#TypeSpec.Http.HeaderOptions) +- [`ImplicitFlow`](./data-types.md#TypeSpec.Http.ImplicitFlow) +- [`LocationHeader`](./data-types.md#TypeSpec.Http.LocationHeader) +- [`MovedResponse`](./data-types.md#TypeSpec.Http.MovedResponse) +- [`NoContentResponse`](./data-types.md#TypeSpec.Http.NoContentResponse) +- [`NotFoundResponse`](./data-types.md#TypeSpec.Http.NotFoundResponse) +- [`NotModifiedResponse`](./data-types.md#TypeSpec.Http.NotModifiedResponse) +- [`OAuth2Auth`](./data-types.md#TypeSpec.Http.OAuth2Auth) +- [`OkResponse`](./data-types.md#TypeSpec.Http.OkResponse) +- [`PasswordFlow`](./data-types.md#TypeSpec.Http.PasswordFlow) +- [`PlainData`](./data-types.md#TypeSpec.Http.PlainData) +- [`QueryOptions`](./data-types.md#TypeSpec.Http.QueryOptions) +- [`Response`](./data-types.md#TypeSpec.Http.Response) +- [`UnauthorizedResponse`](./data-types.md#TypeSpec.Http.UnauthorizedResponse) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/enumerations/Visibility.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/enumerations/Visibility.md new file mode 100644 index 0000000000..c78bd9f91c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/enumerations/Visibility.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[E] Visibility" + +--- +Flags enum representation of well-known visibilities that are used in +REST API. + +## Enumeration Members + +| Member | Value | Description | +| :------ | :------ | :------ | +| `All` | `31` | - | +| `Create` | `2` | - | +| `Delete` | `8` | - | +| `Item` | `1048576` | Additional flag to indicate when something is nested in a collection
and therefore no metadata is applicable. | +| `None` | `0` | - | +| `Patch` | `2097152` | Additional flag to indicate when the verb is path and therefore
will have fields made optional if request visibility includes update. | +| `Query` | `16` | - | +| `Read` | `1` | - | +| `Update` | `4` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$body.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$body.md new file mode 100644 index 0000000000..08f4597c71 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$body.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $body" + +--- +```ts +$body(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$delete.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$delete.md new file mode 100644 index 0000000000..9d1cbc7d2d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$delete.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $delete" + +--- +```ts +$delete(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$get.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$get.md new file mode 100644 index 0000000000..81fd259857 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$get.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $get" + +--- +```ts +$get(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$head.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$head.md new file mode 100644 index 0000000000..2759bf9991 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$head.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $head" + +--- +```ts +$head(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$header.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$header.md new file mode 100644 index 0000000000..d5f560f5de --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$header.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $header" + +--- +```ts +$header( + context, + entity, + headerNameOrOptions?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` | +| `headerNameOrOptions`? | `StringLiteral` \| `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$includeInapplicableMetadataInPayload.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$includeInapplicableMetadataInPayload.md new file mode 100644 index 0000000000..4797ed6bbe --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$includeInapplicableMetadataInPayload.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] $includeInapplicableMetadataInPayload" + +--- +```ts +$includeInapplicableMetadataInPayload( + context, + entity, + value): void +``` + +Specifies if inapplicable metadata should be included in the payload for +the given entity. This is true by default unless changed by this +decorator. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | `DecoratorContext` | - | +| `entity` | `Type` | Target model, namespace, or model property. If applied to a
model or namespace, applies recursively to child models,
namespaces, and model properties unless overridden by
applying this decorator to a child. | +| `value` | `boolean` | `true` to include inapplicable metadata in payload, false to
exclude it. | + +## Returns + +## See + +isApplicableMetadata diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$onValidate.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$onValidate.md new file mode 100644 index 0000000000..df5dda0051 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$onValidate.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] $onValidate" + +--- +```ts +$onValidate(program): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$patch.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$patch.md new file mode 100644 index 0000000000..a9555a332f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$patch.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $patch" + +--- +```ts +$patch(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$path.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$path.md new file mode 100644 index 0000000000..50616f10c8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$path.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $path" + +--- +```ts +$path( + context, + entity, + paramName?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` | +| `paramName`? | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$plainData.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$plainData.md new file mode 100644 index 0000000000..f2ffd4286e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$plainData.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $plainData" + +--- +```ts +$plainData(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$post.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$post.md new file mode 100644 index 0000000000..d2b97129dc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$post.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $post" + +--- +```ts +$post(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$put.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$put.md new file mode 100644 index 0000000000..a8011177d0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$put.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $put" + +--- +```ts +$put(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$query.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$query.md new file mode 100644 index 0000000000..2f8f230b95 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$query.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $query" + +--- +```ts +$query( + context, + entity, + queryNameOrOptions?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` | +| `queryNameOrOptions`? | `StringLiteral` \| `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$route.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$route.md new file mode 100644 index 0000000000..a70fe4adb5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$route.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] $route" + +--- +```ts +$route( + context, + entity, + path, + parameters?): void +``` + +`@route` defines the relative route URI for the target operation + +The first argument should be a URI fragment that may contain one or more path parameter fields. +If the namespace or interface that contains the operation is also marked with a `@route` decorator, +it will be used as a prefix to the route URI of the operation. + +`@route` can only be applied to operations, namespaces, and interfaces. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Type` | +| `path` | `string` | +| `parameters`? | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$server.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$server.md new file mode 100644 index 0000000000..4456caa306 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$server.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[F] $server" + +--- +```ts +$server( + context, + target, + url, + description, + parameters?): void +``` + +Configure the server url for the service. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | `DecoratorContext` | Decorator context | +| `target` | `Namespace` | Decorator target(Must be a namespace) | +| `url` | `string` | - | +| `description` | `string` | Description for this server. | +| `parameters`? | `Model` | | + +## Returns + +## Optional + +Parameters to interpolate in the server url. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$sharedRoute.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$sharedRoute.md new file mode 100644 index 0000000000..c0e11dd7dd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$sharedRoute.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[F] $sharedRoute" + +--- +```ts +$sharedRoute(context, entity): void +``` + +`@sharedRoute` marks the operation as sharing a route path with other operations. + +When an operation is marked with `@sharedRoute`, it enables other operations to share the same +route path as long as those operations are also marked with `@sharedRoute`. + +`@sharedRoute` can only be applied directly to operations. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$statusCode.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$statusCode.md new file mode 100644 index 0000000000..cfbc299977 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$statusCode.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $statusCode" + +--- +```ts +$statusCode(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$useAuth.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$useAuth.md new file mode 100644 index 0000000000..c9be7e0c30 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/$useAuth.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $useAuth" + +--- +```ts +$useAuth( + context, + serviceNamespace, + authConfig): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `serviceNamespace` | `Namespace` | +| `authConfig` | `Model` \| `Tuple` \| `Union` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/DefaultRouteProducer.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/DefaultRouteProducer.md new file mode 100644 index 0000000000..c3baa9cc3f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/DefaultRouteProducer.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] DefaultRouteProducer" + +--- +```ts +DefaultRouteProducer( + program, + operation, + parentSegments, + overloadBase, +options): DiagnosticResult +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | +| `parentSegments` | `string`[] | +| `overloadBase` | `undefined` \| [`HttpOperation`](../interfaces/HttpOperation.md) | +| `options` | [`RouteOptions`](../interfaces/RouteOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/createMetadataInfo.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/createMetadataInfo.md new file mode 100644 index 0000000000..fc9c4b7c80 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/createMetadataInfo.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] createMetadataInfo" + +--- +```ts +createMetadataInfo(program, options?): MetadataInfo +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `options`? | [`MetadataInfoOptions`](../interfaces/MetadataInfoOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/gatherMetadata.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/gatherMetadata.md new file mode 100644 index 0000000000..ddecacfe31 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/gatherMetadata.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[F] gatherMetadata" + +--- +```ts +gatherMetadata( + program, + diagnostics, + type, + visibility, + isMetadataCallback, +rootMapOut?): Set +``` + +Walks the given type and collects all applicable metadata and `@body` +properties recursively. + +## Parameters + +| Parameter | Type | Default value | Description | +| :------ | :------ | :------ | :------ | +| `program` | `Program` | `undefined` | - | +| `diagnostics` | `DiagnosticCollector` | `undefined` | - | +| `type` | `Type` | `undefined` | - | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | `undefined` | - | +| `isMetadataCallback` | (`program`, `property`) => `boolean` | `isMetadata` | - | +| `rootMapOut`? | `Map`<`ModelProperty`, `ModelProperty`\> | `undefined` | If provided, the map will be populated to link
nested metadata properties to their root properties. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getAllHttpServices.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getAllHttpServices.md new file mode 100644 index 0000000000..63f1e62d6d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getAllHttpServices.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getAllHttpServices" + +--- +```ts +getAllHttpServices(program, options?): [HttpService[], readonly Diagnostic[]] +``` + +Returns all the services defined. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `options`? | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getAllRoutes.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getAllRoutes.md new file mode 100644 index 0000000000..4b4588af1e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getAllRoutes.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getAllRoutes" + +--- +```ts +getAllRoutes(program, options?): [HttpOperation[], readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `options`? | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | + +## Returns + +## Deprecated + +use `getAllHttpServices` instead diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getAuthentication.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getAuthentication.md new file mode 100644 index 0000000000..972a1ae8e8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getAuthentication.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getAuthentication" + +--- +```ts +getAuthentication(program, namespace): ServiceAuthentication | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getContentTypes.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getContentTypes.md new file mode 100644 index 0000000000..b72f3b5765 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getContentTypes.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[F] getContentTypes" + +--- +```ts +getContentTypes(property): [string[], readonly Diagnostic[]] +``` + +Resolve the content types from a model property by looking at the value. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `property` | `ModelProperty` | Model property | + +## Returns + +List of contnet types and any diagnostics if there was an issue. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHeaderFieldName.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHeaderFieldName.md new file mode 100644 index 0000000000..524de93e36 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHeaderFieldName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getHeaderFieldName" + +--- +```ts +getHeaderFieldName(program, entity): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHeaderFieldOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHeaderFieldOptions.md new file mode 100644 index 0000000000..96ee40708c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHeaderFieldOptions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getHeaderFieldOptions" + +--- +```ts +getHeaderFieldOptions(program, entity): HeaderFieldOptions +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHttpOperation.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHttpOperation.md new file mode 100644 index 0000000000..6e53c0d77e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHttpOperation.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getHttpOperation" + +--- +```ts +getHttpOperation( + program, + operation, + options?): [HttpOperation, readonly Diagnostic[]] +``` + +Return the Http Operation details for a given TypeSpec operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | - | +| `operation` | `Operation` | Operation | +| `options`? | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | Optional option on how to resolve the http details. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHttpService.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHttpService.md new file mode 100644 index 0000000000..281ee897be --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getHttpService.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getHttpService" + +--- +```ts +getHttpService( + program, + serviceNamespace, + options?): [HttpService, readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `serviceNamespace` | `Namespace` | +| `options`? | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getOperationParameters.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getOperationParameters.md new file mode 100644 index 0000000000..48bb22851b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getOperationParameters.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getOperationParameters" + +--- +```ts +getOperationParameters( + program, + operation, + overloadBase?, + knownPathParamNames?, + options?): [HttpOperationParameters, readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `program` | `Program` | `undefined` | +| `operation` | `Operation` | `undefined` | +| `overloadBase`? | [`HttpOperation`](../interfaces/HttpOperation.md) | `undefined` | +| `knownPathParamNames`? | `string`[] | `[]` | +| `options`? | [`OperationParameterOptions`](../interfaces/OperationParameterOptions.md) | `{}` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getOperationVerb.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getOperationVerb.md new file mode 100644 index 0000000000..20d663b6b8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getOperationVerb.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getOperationVerb" + +--- +```ts +getOperationVerb(program, entity): HttpVerb | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getPathParamName.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getPathParamName.md new file mode 100644 index 0000000000..e5e188999f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getPathParamName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getPathParamName" + +--- +```ts +getPathParamName(program, entity): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getPathParamOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getPathParamOptions.md new file mode 100644 index 0000000000..d15be02de9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getPathParamOptions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getPathParamOptions" + +--- +```ts +getPathParamOptions(program, entity): PathParameterOptions +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getQueryParamName.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getQueryParamName.md new file mode 100644 index 0000000000..696a31c9dd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getQueryParamName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getQueryParamName" + +--- +```ts +getQueryParamName(program, entity): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getQueryParamOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getQueryParamOptions.md new file mode 100644 index 0000000000..785bc543a6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getQueryParamOptions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getQueryParamOptions" + +--- +```ts +getQueryParamOptions(program, entity): QueryParameterOptions +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRequestVisibility.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRequestVisibility.md new file mode 100644 index 0000000000..6da65bcb1b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRequestVisibility.md @@ -0,0 +1,30 @@ +--- +jsApi: true +title: "[F] getRequestVisibility" + +--- +```ts +getRequestVisibility(verb): Visibility +``` + +Determines the visibility to use for a request with the given verb. + +- GET | HEAD => Visibility.Query +- POST => Visibility.Create +- PATCH => Visibility.Update +- PUT => Visibility.Create | Update +- DELETE => Visibility.Delete + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `verb` | [`HttpVerb`](../type-aliases/HttpVerb.md) | The HTTP verb for the operation. | + +## Returns + +The applicable parameter visibility or visibilities for the request. + +## Deprecated + +Use `resolveRequestVisibility` instead, or if you only want the default visibility for a verb, `getDefaultVisibilityForVerb`. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getResponsesForOperation.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getResponsesForOperation.md new file mode 100644 index 0000000000..6b262563a5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getResponsesForOperation.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getResponsesForOperation" + +--- +```ts +getResponsesForOperation(program, operation): [HttpOperationResponse[], readonly Diagnostic[]] +``` + +Get the responses for a given operation. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRouteOptionsForNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRouteOptionsForNamespace.md new file mode 100644 index 0000000000..73f28e58b8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRouteOptionsForNamespace.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getRouteOptionsForNamespace" + +--- +```ts +getRouteOptionsForNamespace(program, namespace): RouteOptions | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRoutePath.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRoutePath.md new file mode 100644 index 0000000000..47013e291f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRoutePath.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getRoutePath" + +--- +```ts +getRoutePath(program, entity): RoutePath | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Interface` \| `Namespace` \| `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRouteProducer.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRouteProducer.md new file mode 100644 index 0000000000..dfd2808edd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getRouteProducer.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getRouteProducer" + +--- +```ts +getRouteProducer(program, operation): RouteProducer +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getServers.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getServers.md new file mode 100644 index 0000000000..5209b6a692 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getServers.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getServers" + +--- +```ts +getServers(program, type): HttpServer[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getStatusCodeDescription.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getStatusCodeDescription.md new file mode 100644 index 0000000000..7af635a291 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getStatusCodeDescription.md @@ -0,0 +1,33 @@ +--- +jsApi: true +title: "[F] getStatusCodeDescription" + +--- +```ts +getStatusCodeDescription(statusCode): + | undefined + | "Informational" + | "Successful" + | "Redirection" + | "Client error" + | "Server error" + | "The request has succeeded." + | "The request has succeeded and a new resource has been created as a result." + | "The request has been accepted for processing, but processing has not yet completed." + | "There is no content to send for this request, but the headers may be useful. " + | "The URL of the requested resource has been changed permanently. The new URL is given in the response." + | "The client has made a conditional request and the resource has not been modified." + | "The server could not understand the request due to invalid syntax." + | "Access is unauthorized." + | "Access is forbidden" + | "The server cannot find the requested resource." + | "The request conflicts with the current state of the server." + | "Precondition failed." + | "Service unavailable." +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `statusCode` | `string` \| `number` \| [`HttpStatusCodeRange`](../interfaces/HttpStatusCodeRange.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getStatusCodes.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getStatusCodes.md new file mode 100644 index 0000000000..839f283fbe --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getStatusCodes.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getStatusCodes" + +--- +```ts +getStatusCodes(program, entity): HttpStatusCodes +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getStatusCodesWithDiagnostics.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getStatusCodesWithDiagnostics.md new file mode 100644 index 0000000000..befc459194 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getStatusCodesWithDiagnostics.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getStatusCodesWithDiagnostics" + +--- +```ts +getStatusCodesWithDiagnostics(program, type): [HttpStatusCodes, readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getVisibilitySuffix.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getVisibilitySuffix.md new file mode 100644 index 0000000000..4cdda1001e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/getVisibilitySuffix.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] getVisibilitySuffix" + +--- +```ts +getVisibilitySuffix(visibility, canonicalVisibility): string +``` + +Provides a naming suffix to create a unique name for a type with this +visibility. + +The canonical visibility (default Visibility.Read) gets empty suffix, +otherwise visibilities are joined in pascal-case with `Or`. And `Item` is +if `Visibility.Item` is produced. + +Examples (with canonicalVisibility = Visibility.Read): + - Visibility.Read => "" + - Visibility.Update => "Update" + - Visibility.Create | Visibility.Update => "CreateOrUpdate" + - Visibility.Create | Visibility.Item => "CreateItem" + - Visibility.Create | Visibility.Update | Visibility.Item => "CreateOrUpdateItem" + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | `undefined` | +| `canonicalVisibility` | `undefined` \| [`Visibility`](../enumerations/Visibility.md) | `Visibility.None` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/includeInapplicableMetadataInPayload2.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/includeInapplicableMetadataInPayload2.md new file mode 100644 index 0000000000..30af155e4e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/includeInapplicableMetadataInPayload2.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] includeInapplicableMetadataInPayload" +--- + +```ts +includeInapplicableMetadataInPayload(program, property): boolean +``` + +Determines if the given model property should be included in the payload if it is +inapplicable metadata. + +## Parameters + +| Parameter | Type | +| :--------- | :-------------- | +| `program` | `Program` | +| `property` | `ModelProperty` | + +## Returns + +## See + +- isApplicableMetadata +- $includeInapplicableMetadataInPayload diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/includeInterfaceRoutesInNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/includeInterfaceRoutesInNamespace.md new file mode 100644 index 0000000000..ab7e3e2f8e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/includeInterfaceRoutesInNamespace.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] includeInterfaceRoutesInNamespace" + +--- +```ts +includeInterfaceRoutesInNamespace( + program, + target, + sourceInterface): void +``` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | Program | +| `target` | `Namespace` | Target namespace | +| `sourceInterface` | `string` | Interface that should be included in namespace. | + +## Returns + +## Deprecated + +DO NOT USE. For internal use only as a workaround. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isApplicableMetadata.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isApplicableMetadata.md new file mode 100644 index 0000000000..d67080497b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isApplicableMetadata.md @@ -0,0 +1,30 @@ +--- +jsApi: true +title: "[F] isApplicableMetadata" + +--- +```ts +isApplicableMetadata( + program, + property, + visibility, + isMetadataCallback): boolean +``` + +Determines if the given property is metadata that is applicable with the +given visibility. + +- No metadata is applicable with Visibility.Item present. +- If only Visibility.Read is present, then only `@header` and `@status` + properties are applicable. +- If Visibility.Read is not present, all metadata properties other than + `@statusCode` are applicable. + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `program` | `Program` | `undefined` | +| `property` | `ModelProperty` | `undefined` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | `undefined` | +| `isMetadataCallback` | (`program`, `property`) => `boolean` | `isMetadata` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isApplicableMetadataOrBody.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isApplicableMetadataOrBody.md new file mode 100644 index 0000000000..0766374972 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isApplicableMetadataOrBody.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] isApplicableMetadataOrBody" + +--- +```ts +isApplicableMetadataOrBody( + program, + property, + visibility, + isMetadataCallback): boolean +``` + +Determines if the given property is metadata or marked `@body` and +applicable with the given visibility. + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `program` | `Program` | `undefined` | +| `property` | `ModelProperty` | `undefined` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | `undefined` | +| `isMetadataCallback` | (`program`, `property`) => `boolean` | `isMetadata` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isBody.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isBody.md new file mode 100644 index 0000000000..ba6a93bb59 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isBody.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isBody" + +--- +```ts +isBody(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isContentTypeHeader.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isContentTypeHeader.md new file mode 100644 index 0000000000..f4601f390f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isContentTypeHeader.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isContentTypeHeader" + +--- +```ts +isContentTypeHeader(program, property): boolean +``` + +Check if the given model property is the content type header. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | Program | +| `property` | `ModelProperty` | Model property. | + +## Returns + +True if the model property is marked as a header and has the name `content-type`(case insensitive.) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isHeader.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isHeader.md new file mode 100644 index 0000000000..e45fcf8309 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isHeader.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isHeader" + +--- +```ts +isHeader(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isMetadata.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isMetadata.md new file mode 100644 index 0000000000..3222e3c661 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isMetadata.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[F] isMetadata" + +--- +```ts +isMetadata(program, property): boolean +``` + +Determines if a property is metadata. A property is defined to be +metadata if it is marked `@header`, `@query`, `@path`, or `@statusCode`. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `property` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isOverloadSameEndpoint.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isOverloadSameEndpoint.md new file mode 100644 index 0000000000..55c0a6446f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isOverloadSameEndpoint.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isOverloadSameEndpoint" + +--- +```ts +isOverloadSameEndpoint(overload): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `overload` | [`HttpOperation`](../interfaces/HttpOperation.md) & `object` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isPathParam.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isPathParam.md new file mode 100644 index 0000000000..56ed9917c3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isPathParam.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isPathParam" + +--- +```ts +isPathParam(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isQueryParam.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isQueryParam.md new file mode 100644 index 0000000000..20917a8cef --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isQueryParam.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isQueryParam" + +--- +```ts +isQueryParam(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isSharedRoute.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isSharedRoute.md new file mode 100644 index 0000000000..2aab23560f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isSharedRoute.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isSharedRoute" + +--- +```ts +isSharedRoute(program, operation): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isStatusCode.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isStatusCode.md new file mode 100644 index 0000000000..6d2c3dbd78 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isStatusCode.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isStatusCode" + +--- +```ts +isStatusCode(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isVisible.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isVisible.md new file mode 100644 index 0000000000..bf10fe75fe --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/isVisible.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isVisible" + +--- +```ts +isVisible( + program, + property, + visibility): boolean +``` + +Determines if the given property is visible with the given visibility. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `property` | `ModelProperty` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/listHttpOperationsIn.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/listHttpOperationsIn.md new file mode 100644 index 0000000000..4d726d7d73 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/listHttpOperationsIn.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] listHttpOperationsIn" + +--- +```ts +listHttpOperationsIn( + program, + container, + options?): [HttpOperation[], readonly Diagnostic[]] +``` + +Get all the Http Operation in the given container. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | Program | +| `container` | [`OperationContainer`](../type-aliases/OperationContainer.md) | Namespace or interface containing operations | +| `options`? | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | Resolution options | + +## Returns diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/reportIfNoRoutes.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/reportIfNoRoutes.md new file mode 100644 index 0000000000..1f91975eeb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/reportIfNoRoutes.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] reportIfNoRoutes" + +--- +```ts +reportIfNoRoutes(program, routes): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `routes` | [`HttpOperation`](../interfaces/HttpOperation.md)[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/resolvePathAndParameters.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/resolvePathAndParameters.md new file mode 100644 index 0000000000..94c273380e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/resolvePathAndParameters.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] resolvePathAndParameters" + +--- +```ts +resolvePathAndParameters( + program, + operation, + overloadBase, +options): DiagnosticResult +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | +| `overloadBase` | `undefined` \| [`HttpOperation`](../interfaces/HttpOperation.md) | +| `options` | [`RouteResolutionOptions`](../interfaces/RouteResolutionOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/resolveRequestVisibility.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/resolveRequestVisibility.md new file mode 100644 index 0000000000..a186cc04ad --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/resolveRequestVisibility.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[F] resolveRequestVisibility" + +--- +```ts +resolveRequestVisibility( + program, + operation, + verb): Visibility +``` + +Returns the applicable parameter visibility or visibilities for the request if `@requestVisibility` was used. +Otherwise, returns the default visibility based on the HTTP verb for the operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | - | +| `operation` | `Operation` | The TypeSpec Operation for the request. | +| `verb` | [`HttpVerb`](../type-aliases/HttpVerb.md) | The HTTP verb for the operation. | + +## Returns + +The applicable parameter visibility or visibilities for the request. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setAuthentication.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setAuthentication.md new file mode 100644 index 0000000000..95b1e8cd32 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setAuthentication.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] setAuthentication" + +--- +```ts +setAuthentication( + program, + serviceNamespace, + auth): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `serviceNamespace` | `Namespace` | +| `auth` | [`ServiceAuthentication`](../interfaces/ServiceAuthentication.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setRoute.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setRoute.md new file mode 100644 index 0000000000..ee3af48db7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setRoute.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] setRoute" + +--- +```ts +setRoute( + context, + entity, + details): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Type` | +| `details` | [`RoutePath`](../interfaces/RoutePath.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setRouteOptionsForNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setRouteOptionsForNamespace.md new file mode 100644 index 0000000000..320776737e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setRouteOptionsForNamespace.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] setRouteOptionsForNamespace" + +--- +```ts +setRouteOptionsForNamespace( + program, + namespace, + options): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | +| `options` | [`RouteOptions`](../interfaces/RouteOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setRouteProducer.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setRouteProducer.md new file mode 100644 index 0000000000..3cb9e47bc8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setRouteProducer.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] setRouteProducer" + +--- +```ts +setRouteProducer( + program, + operation, + routeProducer): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | +| `routeProducer` | [`RouteProducer`](../type-aliases/RouteProducer.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setSharedRoute.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setSharedRoute.md new file mode 100644 index 0000000000..d922723c21 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setSharedRoute.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] setSharedRoute" + +--- +```ts +setSharedRoute(program, operation): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setStatusCode.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setStatusCode.md new file mode 100644 index 0000000000..aa7246eb1b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/setStatusCode.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] setStatusCode" + +--- +```ts +setStatusCode( + program, + entity, + codes): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Model` \| `ModelProperty` | +| `codes` | `string`[] | + +## Returns + +## Deprecated + +DO NOT USE, for internal use only. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/validateRouteUnique.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/validateRouteUnique.md new file mode 100644 index 0000000000..c9779ec6a9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/functions/validateRouteUnique.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] validateRouteUnique" + +--- +```ts +validateRouteUnique( + program, + diagnostics, + operations): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `diagnostics` | `DiagnosticCollector` | +| `operations` | [`HttpOperation`](../interfaces/HttpOperation.md)[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/index.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/index.md new file mode 100644 index 0000000000..ccaa57f7ed --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/index.md @@ -0,0 +1,137 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Enumerations + +- [Visibility](enumerations/Visibility.md) + +### Interfaces + +- [ApiKeyAuth](interfaces/ApiKeyAuth.md) +- [AuthenticationOption](interfaces/AuthenticationOption.md) +- [AuthorizationCodeFlow](interfaces/AuthorizationCodeFlow.md) +- [BasicAuth](interfaces/BasicAuth.md) +- [BearerAuth](interfaces/BearerAuth.md) +- [ClientCredentialsFlow](interfaces/ClientCredentialsFlow.md) +- [HeaderFieldOptions](interfaces/HeaderFieldOptions.md) +- [HttpAuthBase](interfaces/HttpAuthBase.md) +- [HttpOperation](interfaces/HttpOperation.md) +- [HttpOperationBody](interfaces/HttpOperationBody.md) +- [HttpOperationParameters](interfaces/HttpOperationParameters.md) +- [HttpOperationRequestBody](interfaces/HttpOperationRequestBody.md) +- [HttpOperationResponse](interfaces/HttpOperationResponse.md) +- [HttpOperationResponseContent](interfaces/HttpOperationResponseContent.md) +- [HttpServer](interfaces/HttpServer.md) +- [HttpService](interfaces/HttpService.md) +- [HttpStatusCodeRange](interfaces/HttpStatusCodeRange.md) +- [ImplicitFlow](interfaces/ImplicitFlow.md) +- [MetadataInfo](interfaces/MetadataInfo.md) +- [MetadataInfoOptions](interfaces/MetadataInfoOptions.md) +- [OAuth2Scope](interfaces/OAuth2Scope.md) +- [Oauth2Auth](interfaces/Oauth2Auth.md) +- [OperationParameterOptions](interfaces/OperationParameterOptions.md) +- [PasswordFlow](interfaces/PasswordFlow.md) +- [PathParameterOptions](interfaces/PathParameterOptions.md) +- [QueryParameterOptions](interfaces/QueryParameterOptions.md) +- [RouteOptions](interfaces/RouteOptions.md) +- [RoutePath](interfaces/RoutePath.md) +- [RouteProducerResult](interfaces/RouteProducerResult.md) +- [RouteResolutionOptions](interfaces/RouteResolutionOptions.md) +- [ServiceAuthentication](interfaces/ServiceAuthentication.md) + +### Type Aliases + +- [HttpAuth](type-aliases/HttpAuth.md) +- [HttpOperationParameter](type-aliases/HttpOperationParameter.md) +- [HttpStatusCodes](type-aliases/HttpStatusCodes.md) +- [HttpStatusCodesEntry](type-aliases/HttpStatusCodesEntry.md) +- [HttpVerb](type-aliases/HttpVerb.md) +- [OAuth2Flow](type-aliases/OAuth2Flow.md) +- [OAuth2FlowType](type-aliases/OAuth2FlowType.md) +- [OperationContainer](type-aliases/OperationContainer.md) +- [OperationDetails](type-aliases/OperationDetails.md) +- [OperationVerbSelector](type-aliases/OperationVerbSelector.md) +- [RouteProducer](type-aliases/RouteProducer.md) +- [StatusCode](type-aliases/StatusCode.md) + +### Variables + +- [$lib](variables/$lib.md) +- [namespace](variables/namespace.md) + +### Functions + +- [$body](functions/$body.md) +- [$delete](functions/$delete.md) +- [$get](functions/$get.md) +- [$head](functions/$head.md) +- [$header](functions/$header.md) +- [$includeInapplicableMetadataInPayload](functions/$includeInapplicableMetadataInPayload.md) +- [$onValidate](functions/$onValidate.md) +- [$patch](functions/$patch.md) +- [$path](functions/$path.md) +- [$plainData](functions/$plainData.md) +- [$post](functions/$post.md) +- [$put](functions/$put.md) +- [$query](functions/$query.md) +- [$route](functions/$route.md) +- [$server](functions/$server.md) +- [$sharedRoute](functions/$sharedRoute.md) +- [$statusCode](functions/$statusCode.md) +- [$useAuth](functions/$useAuth.md) +- [DefaultRouteProducer](functions/DefaultRouteProducer.md) +- [createMetadataInfo](functions/createMetadataInfo.md) +- [gatherMetadata](functions/gatherMetadata.md) +- [getAllHttpServices](functions/getAllHttpServices.md) +- [getAllRoutes](functions/getAllRoutes.md) +- [getAuthentication](functions/getAuthentication.md) +- [getContentTypes](functions/getContentTypes.md) +- [getHeaderFieldName](functions/getHeaderFieldName.md) +- [getHeaderFieldOptions](functions/getHeaderFieldOptions.md) +- [getHttpOperation](functions/getHttpOperation.md) +- [getHttpService](functions/getHttpService.md) +- [getOperationParameters](functions/getOperationParameters.md) +- [getOperationVerb](functions/getOperationVerb.md) +- [getPathParamName](functions/getPathParamName.md) +- [getPathParamOptions](functions/getPathParamOptions.md) +- [getQueryParamName](functions/getQueryParamName.md) +- [getQueryParamOptions](functions/getQueryParamOptions.md) +- [getRequestVisibility](functions/getRequestVisibility.md) +- [getResponsesForOperation](functions/getResponsesForOperation.md) +- [getRouteOptionsForNamespace](functions/getRouteOptionsForNamespace.md) +- [getRoutePath](functions/getRoutePath.md) +- [getRouteProducer](functions/getRouteProducer.md) +- [getServers](functions/getServers.md) +- [getStatusCodeDescription](functions/getStatusCodeDescription.md) +- [getStatusCodes](functions/getStatusCodes.md) +- [getStatusCodesWithDiagnostics](functions/getStatusCodesWithDiagnostics.md) +- [getVisibilitySuffix](functions/getVisibilitySuffix.md) +- [includeInapplicableMetadataInPayload](functions/includeInapplicableMetadataInPayload.md) +- [includeInterfaceRoutesInNamespace](functions/includeInterfaceRoutesInNamespace.md) +- [isApplicableMetadata](functions/isApplicableMetadata.md) +- [isApplicableMetadataOrBody](functions/isApplicableMetadataOrBody.md) +- [isBody](functions/isBody.md) +- [isContentTypeHeader](functions/isContentTypeHeader.md) +- [isHeader](functions/isHeader.md) +- [isMetadata](functions/isMetadata.md) +- [isOverloadSameEndpoint](functions/isOverloadSameEndpoint.md) +- [isPathParam](functions/isPathParam.md) +- [isQueryParam](functions/isQueryParam.md) +- [isSharedRoute](functions/isSharedRoute.md) +- [isStatusCode](functions/isStatusCode.md) +- [isVisible](functions/isVisible.md) +- [listHttpOperationsIn](functions/listHttpOperationsIn.md) +- [reportIfNoRoutes](functions/reportIfNoRoutes.md) +- [resolvePathAndParameters](functions/resolvePathAndParameters.md) +- [resolveRequestVisibility](functions/resolveRequestVisibility.md) +- [setAuthentication](functions/setAuthentication.md) +- [setRoute](functions/setRoute.md) +- [setRouteOptionsForNamespace](functions/setRouteOptionsForNamespace.md) +- [setRouteProducer](functions/setRouteProducer.md) +- [setSharedRoute](functions/setSharedRoute.md) +- [setStatusCode](functions/setStatusCode.md) +- [validateRouteUnique](functions/validateRouteUnique.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ApiKeyAuth.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ApiKeyAuth.md new file mode 100644 index 0000000000..a7f2719fa1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ApiKeyAuth.md @@ -0,0 +1,44 @@ +--- +jsApi: true +title: "[I] ApiKeyAuth" + +--- +An API key is a token that a client provides when making API calls. The key can be sent in the query string: +``` +GET /something?api_key=abcdef12345 +``` + +or as a request header + +``` +GET /something HTTP/1.1 +X-API-Key: abcdef12345 +``` + +or as a cookie + +``` +GET /something HTTP/1.1 +Cookie: X-API-KEY=abcdef12345 +``` + +## Extends + +- [`HttpAuthBase`](HttpAuthBase.md) + +## Type parameters + +| Parameter | +| :------ | +| `TLocation` extends `ApiKeyLocation` | +| `TName` extends `string` | + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `description?` | `string` | Optional description. | [`HttpAuthBase`](HttpAuthBase.md).`description` | +| `id` | `string` | Id of the authentication scheme. | [`HttpAuthBase`](HttpAuthBase.md).`id` | +| `in` | `TLocation` | - | - | +| `name` | `TName` | - | - | +| `type` | `"apiKey"` | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/AuthenticationOption.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/AuthenticationOption.md new file mode 100644 index 0000000000..02df8838ac --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/AuthenticationOption.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] AuthenticationOption" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `schemes` | [`HttpAuth`](../type-aliases/HttpAuth.md)[] | For this authentication option all the given auth have to be used together. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/AuthorizationCodeFlow.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/AuthorizationCodeFlow.md new file mode 100644 index 0000000000..8d08d57e88 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/AuthorizationCodeFlow.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[I] AuthorizationCodeFlow" + +--- +Authorization Code flow + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `authorizationUrl` | `string` | - | +| `refreshUrl?` | `string` | - | +| `scopes` | [`OAuth2Scope`](OAuth2Scope.md)[] | - | +| `tokenUrl` | `string` | - | +| `type` | `"authorizationCode"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/BasicAuth.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/BasicAuth.md new file mode 100644 index 0000000000..64ab64df50 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/BasicAuth.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] BasicAuth" + +--- +Basic authentication is a simple authentication scheme built into the HTTP protocol. +The client sends HTTP requests with the Authorization header that contains the word Basic word followed by a space and a base64-encoded string username:password. +For example, to authorize as demo / p@55w0rd the client would send +``` + Authorization: Basic ZGVtbzpwQDU1dzByZA== +``` + +## Extends + +- [`HttpAuthBase`](HttpAuthBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `description?` | `string` | Optional description. | [`HttpAuthBase`](HttpAuthBase.md).`description` | +| `id` | `string` | Id of the authentication scheme. | [`HttpAuthBase`](HttpAuthBase.md).`id` | +| `scheme` | `"basic"` | - | - | +| `type` | `"http"` | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/BearerAuth.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/BearerAuth.md new file mode 100644 index 0000000000..93a3cecf47 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/BearerAuth.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] BearerAuth" + +--- +Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. +The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. +The client must send this token in the Authorization header when making requests to protected resources: +``` + Authorization: Bearer +``` + +## Extends + +- [`HttpAuthBase`](HttpAuthBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `description?` | `string` | Optional description. | [`HttpAuthBase`](HttpAuthBase.md).`description` | +| `id` | `string` | Id of the authentication scheme. | [`HttpAuthBase`](HttpAuthBase.md).`id` | +| `scheme` | `"bearer"` | - | - | +| `type` | `"http"` | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ClientCredentialsFlow.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ClientCredentialsFlow.md new file mode 100644 index 0000000000..5f2581ad8b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ClientCredentialsFlow.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] ClientCredentialsFlow" + +--- +Client credentials flow + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `refreshUrl?` | `string` | - | +| `scopes` | [`OAuth2Scope`](OAuth2Scope.md)[] | - | +| `tokenUrl` | `string` | - | +| `type` | `"clientCredentials"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HeaderFieldOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HeaderFieldOptions.md new file mode 100644 index 0000000000..837614e712 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HeaderFieldOptions.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] HeaderFieldOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `format?` | \| `"csv"` \| `"multi"` \| `"ssv"` \| `"tsv"` \| `"pipes"` \| `"simple"` \| `"form"` | The string format of the array. "csv" and "simple" are used interchangeably, as are
"multi" and "form". | +| `name` | `string` | - | +| `type` | `"header"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpAuthBase.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpAuthBase.md new file mode 100644 index 0000000000..a0f47d0f33 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpAuthBase.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[I] HttpAuthBase" + +--- +## Extended By + +- [`BasicAuth`](BasicAuth.md) +- [`BearerAuth`](BearerAuth.md) +- [`ApiKeyAuth`](ApiKeyAuth.md) +- [`Oauth2Auth`](Oauth2Auth.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description?` | `string` | Optional description. | +| `id` | `string` | Id of the authentication scheme. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperation.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperation.md new file mode 100644 index 0000000000..54b3006633 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperation.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[I] HttpOperation" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `container` | [`OperationContainer`](../type-aliases/OperationContainer.md) | Parent type being the interface, namespace or global namespace. | +| `operation` | `Operation` | Operation type reference. | +| `overloading?` | [`HttpOperation`](HttpOperation.md) | Overload this operation | +| `overloads?` | [`HttpOperation`](HttpOperation.md)[] | List of operations that overloads this one. | +| `parameters` | [`HttpOperationParameters`](HttpOperationParameters.md) | Parameters. | +| `path` | `string` | Route path | +| `pathSegments` | `string`[] | Path segments | +| `responses` | [`HttpOperationResponse`](HttpOperationResponse.md)[] | Responses. | +| `verb` | [`HttpVerb`](../type-aliases/HttpVerb.md) | Route verb. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationBody.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationBody.md new file mode 100644 index 0000000000..177aa96c62 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationBody.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] HttpOperationBody" + +--- +## Extended By + +- [`HttpOperationRequestBody`](HttpOperationRequestBody.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `contentTypes` | `string`[] | Content types. | +| `type` | `Type` | Type of the operation body. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationParameters.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationParameters.md new file mode 100644 index 0000000000..46ee03bfa2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationParameters.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] HttpOperationParameters" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `body?` | [`HttpOperationRequestBody`](HttpOperationRequestBody.md) | - | +| `bodyParameter?` | `ModelProperty` | **Deprecated**

use body.parameter | +| `bodyType?` | `Type` | **Deprecated**

use body.type | +| `parameters` | [`HttpOperationParameter`](../type-aliases/HttpOperationParameter.md)[] | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationRequestBody.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationRequestBody.md new file mode 100644 index 0000000000..2a9975009b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationRequestBody.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] HttpOperationRequestBody" + +--- +Represent the body information for an http request. + +## Note + +the `type` must be a `Model` if the content type is multipart. + +## Extends + +- [`HttpOperationBody`](HttpOperationBody.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `contentTypes` | `string`[] | Content types. | [`HttpOperationBody`](HttpOperationBody.md).`contentTypes` | +| `parameter?` | `ModelProperty` | If the body was explicitly set as a property. Correspond to the property with `@body` | - | +| `type` | `Type` | Type of the operation body. | [`HttpOperationBody`](HttpOperationBody.md).`type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationResponse.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationResponse.md new file mode 100644 index 0000000000..0696432090 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationResponse.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] HttpOperationResponse" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description?` | `string` | Response description. | +| `responses` | [`HttpOperationResponseContent`](HttpOperationResponseContent.md)[] | Responses contents. | +| `statusCode` | [`StatusCode`](../type-aliases/StatusCode.md) | **Deprecated**

use [statusCodes](HttpOperationResponse.md) | +| `statusCodes` | `number` \| `"*"` \| [`HttpStatusCodeRange`](HttpStatusCodeRange.md) | Status code or range of status code for the response. | +| `type` | `Type` | Response typespec type. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationResponseContent.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationResponseContent.md new file mode 100644 index 0000000000..09b3215d45 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpOperationResponseContent.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] HttpOperationResponseContent" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `body?` | [`HttpOperationBody`](HttpOperationBody.md) | - | +| `headers?` | `Record`<`string`, `ModelProperty`\> | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpServer.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpServer.md new file mode 100644 index 0000000000..aa04851859 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpServer.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] HttpServer" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description` | `string` | - | +| `parameters` | `Map`<`string`, `ModelProperty`\> | - | +| `url` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpService.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpService.md new file mode 100644 index 0000000000..53d2857318 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpService.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] HttpService" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `namespace` | `Namespace` | - | +| `operations` | [`HttpOperation`](HttpOperation.md)[] | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpStatusCodeRange.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpStatusCodeRange.md new file mode 100644 index 0000000000..24f8700bf3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/HttpStatusCodeRange.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] HttpStatusCodeRange" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `end` | `number` | - | +| `start` | `number` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ImplicitFlow.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ImplicitFlow.md new file mode 100644 index 0000000000..ea657e4562 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ImplicitFlow.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] ImplicitFlow" + +--- +Implicit flow + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `authorizationUrl` | `string` | - | +| `refreshUrl?` | `string` | - | +| `scopes` | [`OAuth2Scope`](OAuth2Scope.md)[] | - | +| `type` | `"implicit"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/MetadataInfo.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/MetadataInfo.md new file mode 100644 index 0000000000..0903bf3af8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/MetadataInfo.md @@ -0,0 +1,107 @@ +--- +jsApi: true +title: "[I] MetadataInfo" + +--- +Provides information about changes that happen to a data type's payload +when inapplicable metadata is added or invisible properties are removed. + +Results are computed on demand and expensive computations are memoized. + +## Methods + +### getEffectivePayloadType() + +```ts +getEffectivePayloadType(type, visibility): Type +``` + +If type is an anonymous model, tries to find a named model that has the +same set of properties when non-payload properties are excluded. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `Type` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | + +*** + +### isEmptied() + +```ts +isEmptied(type, visibility): boolean +``` + +Determines if the given type is a model that becomes empty once +applicable metadata is removed and visibility is applied. + +Note that a model is not considered emptied if it was already empty in +the first place, or has a base model or indexer. + +When the type of a property is emptied by visibility, the property +itself is also removed. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `undefined` \| `Type` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | + +*** + +### isOptional() + +```ts +isOptional(property, visibility): boolean +``` + +Determines if the given property is optional in the request or +response payload for the given visibility. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | `ModelProperty` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | + +*** + +### isPayloadProperty() + +```ts +isPayloadProperty(property, visibility): boolean +``` + +Determines if the given property is part of the request or response +payload and not applicable metadata [isApplicableMetadata](../functions/isApplicableMetadata.md) or +filtered out by the given visibility. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | `ModelProperty` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | + +*** + +### isTransformed() + +```ts +isTransformed(type, visibility): boolean +``` + +Determines if the given type is transformed by applying the given +visibility and removing invisible properties or adding inapplicable +metadata properties. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `undefined` \| `Type` | +| `visibility` | [`Visibility`](../enumerations/Visibility.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/MetadataInfoOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/MetadataInfoOptions.md new file mode 100644 index 0000000000..d31ce48a8d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/MetadataInfoOptions.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[I] MetadataInfoOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `canonicalVisibility?` | [`Visibility`](../enumerations/Visibility.md) | The visibility to be used as the baseline against which
[MetadataInfo.isEmptied](MetadataInfo.md#isemptied) and [MetadataInfo.isTransformed](MetadataInfo.md#istransformed)
are computed. If not specified, [Visibility.None](../enumerations/Visibility.md) is used, which
will consider that any model that has fields that are only visible to
some visibilities as transformed. | + +## Methods + +### canShareProperty() + +```ts +optional canShareProperty(property): boolean +``` + +Optional callback to indicate that a property can be shared with the +canonical representation even for visibilities where it is not visible. + +This is used, for example, in OpenAPI emit where a property can be +marked `readOnly: true` to represent @visibility("read") without +creating a separate schema schema for [Visibility.Read](../enumerations/Visibility.md). + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/OAuth2Scope.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/OAuth2Scope.md new file mode 100644 index 0000000000..58030f0a1f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/OAuth2Scope.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] OAuth2Scope" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description?` | `string` | - | +| `value` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/Oauth2Auth.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/Oauth2Auth.md new file mode 100644 index 0000000000..1e23a42405 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/Oauth2Auth.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[I] Oauth2Auth" + +--- +OAuth 2.0 is an authorization protocol that gives an API client limited access to user data on a web server. +OAuth relies on authentication scenarios called flows, which allow the resource owner (user) to share the protected content from the resource server without sharing their credentials. +For that purpose, an OAuth 2.0 server issues access tokens that the client applications can use to access protected resources on behalf of the resource owner. +For more information about OAuth 2.0, see oauth.net and RFC 6749. + +## Extends + +- [`HttpAuthBase`](HttpAuthBase.md) + +## Type parameters + +| Parameter | +| :------ | +| `TFlows` extends [`OAuth2Flow`](../type-aliases/OAuth2Flow.md)[] | + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `description?` | `string` | Optional description. | [`HttpAuthBase`](HttpAuthBase.md).`description` | +| `flows` | `TFlows` | - | - | +| `id` | `string` | Id of the authentication scheme. | [`HttpAuthBase`](HttpAuthBase.md).`id` | +| `type` | `"oauth2"` | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/OperationParameterOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/OperationParameterOptions.md new file mode 100644 index 0000000000..796a441838 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/OperationParameterOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] OperationParameterOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `verbSelector?` | [`OperationVerbSelector`](../type-aliases/OperationVerbSelector.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/PasswordFlow.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/PasswordFlow.md new file mode 100644 index 0000000000..4c0ba57d72 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/PasswordFlow.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] PasswordFlow" + +--- +Resource Owner Password flow + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `authorizationUrl` | `string` | - | +| `refreshUrl?` | `string` | - | +| `scopes` | [`OAuth2Scope`](OAuth2Scope.md)[] | - | +| `type` | `"password"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/PathParameterOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/PathParameterOptions.md new file mode 100644 index 0000000000..105e571681 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/PathParameterOptions.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] PathParameterOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | - | +| `type` | `"path"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/QueryParameterOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/QueryParameterOptions.md new file mode 100644 index 0000000000..7ac6b91f02 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/QueryParameterOptions.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] QueryParameterOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `format?` | \| `"csv"` \| `"multi"` \| `"ssv"` \| `"tsv"` \| `"pipes"` \| `"simple"` \| `"form"` | The string format of the array. "csv" and "simple" are used interchangeably, as are
"multi" and "form". | +| `name` | `string` | - | +| `type` | `"query"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RouteOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RouteOptions.md new file mode 100644 index 0000000000..6f88a4d2cb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RouteOptions.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[I] RouteOptions" + +--- +## Extended By + +- [`RouteResolutionOptions`](RouteResolutionOptions.md) + +## Indexable + + \[`prop`: `string`\]: `any` + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `paramOptions?` | [`OperationParameterOptions`](OperationParameterOptions.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RoutePath.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RoutePath.md new file mode 100644 index 0000000000..7829364bb6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RoutePath.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] RoutePath" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | - | +| `shared` | `boolean` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RouteProducerResult.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RouteProducerResult.md new file mode 100644 index 0000000000..688453edb2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RouteProducerResult.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] RouteProducerResult" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `parameters` | [`HttpOperationParameters`](HttpOperationParameters.md) | - | +| `segments` | `string`[] | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RouteResolutionOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RouteResolutionOptions.md new file mode 100644 index 0000000000..6731e98e36 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/RouteResolutionOptions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] RouteResolutionOptions" + +--- +## Extends + +- [`RouteOptions`](RouteOptions.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `listOptions?` | `ListOperationOptions` | - | - | +| `paramOptions?` | [`OperationParameterOptions`](OperationParameterOptions.md) | - | [`RouteOptions`](RouteOptions.md).`paramOptions` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ServiceAuthentication.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ServiceAuthentication.md new file mode 100644 index 0000000000..0245bf7799 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/interfaces/ServiceAuthentication.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] ServiceAuthentication" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `options` | [`AuthenticationOption`](AuthenticationOption.md)[] | Either one of those options can be used independently to authenticate. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpAuth.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpAuth.md new file mode 100644 index 0000000000..06bb976461 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpAuth.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] HttpAuth" + +--- +```ts +type HttpAuth: BasicAuth | BearerAuth | ApiKeyAuth | Oauth2Auth; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpOperationParameter.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpOperationParameter.md new file mode 100644 index 0000000000..d6a790a219 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpOperationParameter.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] HttpOperationParameter" + +--- +```ts +type HttpOperationParameter: HeaderFieldOptions | QueryParameterOptions | PathParameterOptions & object; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `param` | `ModelProperty` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpStatusCodes.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpStatusCodes.md new file mode 100644 index 0000000000..8420e0f83e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpStatusCodes.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] HttpStatusCodes" + +--- +```ts +type HttpStatusCodes: HttpStatusCodesEntry[]; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpStatusCodesEntry.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpStatusCodesEntry.md new file mode 100644 index 0000000000..717df4a69d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpStatusCodesEntry.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] HttpStatusCodesEntry" + +--- +```ts +type HttpStatusCodesEntry: HttpStatusCodeRange | number | "*"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpVerb.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpVerb.md new file mode 100644 index 0000000000..e8c878b690 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/HttpVerb.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] HttpVerb" + +--- +```ts +type HttpVerb: + | "get" + | "put" + | "post" + | "patch" + | "delete" + | "head"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OAuth2Flow.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OAuth2Flow.md new file mode 100644 index 0000000000..5d4664957e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OAuth2Flow.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] OAuth2Flow" + +--- +```ts +type OAuth2Flow: AuthorizationCodeFlow | ImplicitFlow | PasswordFlow | ClientCredentialsFlow; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OAuth2FlowType.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OAuth2FlowType.md new file mode 100644 index 0000000000..599818333a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OAuth2FlowType.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] OAuth2FlowType" + +--- +```ts +type OAuth2FlowType: OAuth2Flow["type"]; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OperationContainer.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OperationContainer.md new file mode 100644 index 0000000000..b349f604c9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OperationContainer.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] OperationContainer" + +--- +```ts +type OperationContainer: Namespace | Interface; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OperationDetails.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OperationDetails.md new file mode 100644 index 0000000000..43a0fed1f2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OperationDetails.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] OperationDetails" + +--- +```ts +type OperationDetails: HttpOperation; +``` + +## Deprecated + +use `HttpOperation`. To remove in November 2022 release. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OperationVerbSelector.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OperationVerbSelector.md new file mode 100644 index 0000000000..d8815ecd75 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/OperationVerbSelector.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] OperationVerbSelector" + +--- +```ts +type OperationVerbSelector: (program, operation) => HttpVerb | undefined; +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/RouteProducer.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/RouteProducer.md new file mode 100644 index 0000000000..336a0c4b25 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/RouteProducer.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[T] RouteProducer" + +--- +```ts +type RouteProducer: (program, operation, parentSegments, overloadBase, options) => DiagnosticResult; +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | +| `parentSegments` | `string`[] | +| `overloadBase` | [`HttpOperation`](../interfaces/HttpOperation.md) \| `undefined` | +| `options` | [`RouteOptions`](../interfaces/RouteOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/StatusCode.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/StatusCode.md new file mode 100644 index 0000000000..a51f7c07c0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/type-aliases/StatusCode.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] StatusCode" + +--- +```ts +type StatusCode: \${number}\ | "*"; +``` + +## Deprecated + +Use `HttpStatusCodesEntry` instead. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/variables/$lib.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/variables/$lib.md new file mode 100644 index 0000000000..3da9627f33 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/variables/$lib.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] $lib" + +--- +```ts +const $lib: TypeSpecLibrary>; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..7b486f6f90 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/http/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.Http" = "TypeSpec.Http"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/data-types.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/data-types.md new file mode 100644 index 0000000000..e07738cf02 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/data-types.md @@ -0,0 +1,32 @@ +--- +title: "Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Data types + +## TypeSpec.JsonSchema + +### `Json` {#TypeSpec.JsonSchema.Json} + +Specify that the provided template argument should be emitted as raw JSON or YAML +as opposed to a schema. Use in combination with the + +```typespec +model TypeSpec.JsonSchema.Json +``` + +#### Template Parameters + +| Name | Description | +| ---- | ------------------------------- | +| T | the type to convert to raw JSON | + +### `Format` {#TypeSpec.JsonSchema.Format} + +Well-known JSON Schema formats. + +```typespec +enum TypeSpec.JsonSchema.Format +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/decorators.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/decorators.md new file mode 100644 index 0000000000..d039d2027f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/decorators.md @@ -0,0 +1,293 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.JsonSchema + +### `@baseUri` {#@TypeSpec.JsonSchema.baseUri} + +Set the base URI for any schemas emitted from types within this namespace. + +```typespec +@TypeSpec.JsonSchema.baseUri(baseUri: valueof string) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| ------- | ----------------------- | ------------------------------------------------------------------------ | +| baseUri | `valueof scalar string` | the base URI. Schema IDs inside this namespace are relative to this URI. | + +### `@contains` {#@TypeSpec.JsonSchema.contains} + +Specify that the array must contain at least one instance of the provided type. +Use `@minContains` and `@maxContains` to customize how many instances to expect. + +```typespec +@TypeSpec.JsonSchema.contains(value: unknown) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | --------------------- | -------------------------------- | +| value | `(intrinsic) unknown` | The type the array must contain. | + +### `@contentEncoding` {#@TypeSpec.JsonSchema.contentEncoding} + +Specify the encoding used for the contents of a string. + +```typespec +@TypeSpec.JsonSchema.contentEncoding(value: valueof string) +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------------- | ----------- | +| value | `valueof scalar string` |
| + +### `@contentMediaType` {#@TypeSpec.JsonSchema.contentMediaType} + +Specify the content type of content stored in a string. + +```typespec +@TypeSpec.JsonSchema.contentMediaType(value: valueof string) +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------------- | ------------------------------------- | +| value | `valueof scalar string` | the media type of the string contents | + +### `@contentSchema` {#@TypeSpec.JsonSchema.contentSchema} + +Specify the schema for the contents of a string when interpreted according to the content's +media type and encoding. + +```typespec +@TypeSpec.JsonSchema.contentSchema(value: unknown) +``` + +#### Target + +`union string | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | --------------------- | --------------------------------- | +| value | `(intrinsic) unknown` | the schema of the string contents | + +### `@extension` {#@TypeSpec.JsonSchema.extension} + +Specify a custom property to add to the emitted schema. Useful for adding custom keywords +and other vendor-specific extensions. The value will be converted to a schema unless the parameter +is wrapped in the `Json` template. For example, `@extension("x-schema", { x: "value" })` will +emit a JSON schema value for `x-schema`, whereas `@extension("x-schema", Json<{x: "value"}>)` will +emit the raw JSON code `{x: "value"}`. + +```typespec +@TypeSpec.JsonSchema.extension(key: valueof string, value: unknown) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------------- | ------------------------------------------------------------------------------------ | +| key | `valueof scalar string` | the name of the keyword of vendor extension, e.g. `x-custom`. | +| value | `(intrinsic) unknown` | the value of the keyword. Will be converted to a schema unless wrapped in `Json`. | + +### `@id` {#@TypeSpec.JsonSchema.id} + +Specify the JSON Schema id. If this model or a parent namespace has a base URI, +the provided ID will be relative to that base URI. + +By default, the id will be constructed based on the declaration's name. + +```typespec +@TypeSpec.JsonSchema.id(id: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ---- | ----------------------- | ----------------------------------------------- | +| id | `valueof scalar string` | the id of the JSON schema for this declaration. | + +### `@jsonSchema` {#@TypeSpec.JsonSchema.jsonSchema} + +Add to namespaces to emit models within that namespace to JSON schema. +Add to another declaration to emit that declaration to JSON schema. + +Optionally, for namespaces, you can provide a baseUri, and for other declarations, +you can provide the id. + +```typespec +@TypeSpec.JsonSchema.jsonSchema(baseUri?: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | ----------------------- | --------------------------------------------------- | +| baseUri | `valueof scalar string` | Schema IDs are interpreted as relative to this URI. | + +### `@maxContains` {#@TypeSpec.JsonSchema.maxContains} + +Specify that the array must contain at most some number of the types provided +by the contains decorator. + +```typespec +@TypeSpec.JsonSchema.maxContains(value: valueof int32) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ---------------------- | ------------------------------------------------------ | +| value | `valueof scalar int32` | The maximum number of instances the array must contain | + +### `@maxProperties` {#@TypeSpec.JsonSchema.maxProperties} + +Specify the maximum number of properties this object can have. + +```typespec +@TypeSpec.JsonSchema.maxProperties(value: valueof int32) +``` + +#### Target + +`union Record | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ---------------------- | ------------------------------------------------------ | +| value | `valueof scalar int32` | The maximum number of properties this object can have. | + +### `@minContains` {#@TypeSpec.JsonSchema.minContains} + +Specify that the array must contain at least some number of the types provided +by the contains decorator. + +```typespec +@TypeSpec.JsonSchema.minContains(value: valueof int32) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ---------------------- | ------------------------------------------------------ | +| value | `valueof scalar int32` | The minimum number of instances the array must contain | + +### `@minProperties` {#@TypeSpec.JsonSchema.minProperties} + +Specify the minimum number of properties this object can have. + +```typespec +@TypeSpec.JsonSchema.minProperties(value: valueof int32) +``` + +#### Target + +`union Record | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ---------------------- | ------------------------------------------------------ | +| value | `valueof scalar int32` | The minimum number of properties this object can have. | + +### `@multipleOf` {#@TypeSpec.JsonSchema.multipleOf} + +Specify that the numeric type must be a multiple of some numeric value. + +```typespec +@TypeSpec.JsonSchema.multipleOf(value: valueof numeric) +``` + +#### Target + +`union numeric | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ------------------------ | -------------------------------------------------- | +| value | `valueof scalar numeric` | The numeric type must be a multiple of this value. | + +### `@prefixItems` {#@TypeSpec.JsonSchema.prefixItems} + +Specify that the target array must begin with the provided types. + +```typespec +@TypeSpec.JsonSchema.prefixItems(value: unknown[]) +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------- | --------------------------------------------------------------------------- | +| value | `model unknown[]` | a tuple containing the types that must be present at the start of the array | + +### `@uniqueItems` {#@TypeSpec.JsonSchema.uniqueItems} + +Specify that every item in the array must be unique. + +```typespec +@TypeSpec.JsonSchema.uniqueItems +``` + +#### Target + +`union unknown[] | ModelProperty` + +#### Parameters + +None diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/emitter.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/emitter.md new file mode 100644 index 0000000000..a9d77988db --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/emitter.md @@ -0,0 +1,57 @@ +--- +title: "Emitter usage" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Emitter + +## Usage + +1. Via the command line + +```bash +tsp compile . --emit=@typespec/json-schema +``` + +2. Via the config + +```yaml +emit: + - "@typespec/json-schema" +``` + +## Emitter options + +### `file-type` + +**Type:** `"yaml" | "json"` + +Serialize the schema as either yaml or json. + +### `int64-strategy` + +**Type:** `"string" | "number"` + +How to handle 64 bit integers on the wire. Options are: + +- string: serialize as a string (widely interoperable) +- number: serialize as a number (not widely interoperable) + +### `bundleId` + +**Type:** `string` + +When provided, bundle all the schemas into a single json schema document with schemas under $defs. The provided id is the id of the root document and is also used for the file name. + +### `emitAllModels` + +**Type:** `boolean` + +When true, emit all model declarations to JSON Schema without requiring the @jsonSchema decorator. + +### `emitAllRefs` + +**Type:** `boolean` + +When true, emit all references as json schema files, even if the referenced type does not have the `@jsonSchema` decorator or is not within a namespace with the `@jsonSchema` decorator. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/index.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/index.md new file mode 100644 index 0000000000..bbc10f06d4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/index.md @@ -0,0 +1,60 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec library for emitting TypeSpec to JSON Schema and converting JSON Schema to TypeSpec + +## Install + + + + +```bash +npm install @typespec/json-schema +``` + + + + +```bash +npm install --save-peer @typespec/json-schema +``` + + + + +## Emitter usage + +[See documentation](./emitter.md) + +## TypeSpec.JsonSchema + +### Decorators + +- [`@baseUri`](./decorators.md#@TypeSpec.JsonSchema.baseUri) +- [`@contains`](./decorators.md#@TypeSpec.JsonSchema.contains) +- [`@contentEncoding`](./decorators.md#@TypeSpec.JsonSchema.contentEncoding) +- [`@contentMediaType`](./decorators.md#@TypeSpec.JsonSchema.contentMediaType) +- [`@contentSchema`](./decorators.md#@TypeSpec.JsonSchema.contentSchema) +- [`@extension`](./decorators.md#@TypeSpec.JsonSchema.extension) +- [`@id`](./decorators.md#@TypeSpec.JsonSchema.id) +- [`@jsonSchema`](./decorators.md#@TypeSpec.JsonSchema.jsonSchema) +- [`@maxContains`](./decorators.md#@TypeSpec.JsonSchema.maxContains) +- [`@maxProperties`](./decorators.md#@TypeSpec.JsonSchema.maxProperties) +- [`@minContains`](./decorators.md#@TypeSpec.JsonSchema.minContains) +- [`@minProperties`](./decorators.md#@TypeSpec.JsonSchema.minProperties) +- [`@multipleOf`](./decorators.md#@TypeSpec.JsonSchema.multipleOf) +- [`@prefixItems`](./decorators.md#@TypeSpec.JsonSchema.prefixItems) +- [`@uniqueItems`](./decorators.md#@TypeSpec.JsonSchema.uniqueItems) + +### Models + +- [`Json`](./data-types.md#TypeSpec.JsonSchema.Json) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/classes/JsonSchemaEmitter.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/classes/JsonSchemaEmitter.md new file mode 100644 index 0000000000..34e4a1e707 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/classes/JsonSchemaEmitter.md @@ -0,0 +1,1789 @@ +--- +jsApi: true +title: "[C] JsonSchemaEmitter" + +--- +## Extends + +- `TypeEmitter`<`Record`<`string`, `any`\>, [`JSONSchemaEmitterOptions`](../interfaces/JSONSchemaEmitterOptions.md)\> + +## Constructors + +### new JsonSchemaEmitter(emitter) + +```ts +new JsonSchemaEmitter(emitter): JsonSchemaEmitter +``` + +Constructs a TypeEmitter. Do not use this constructor directly, instead +call `createAssetEmitter` on the emitter context object. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `emitter` | `AssetEmitter`<`Record`<`string`, `any`\>, [`JSONSchemaEmitterOptions`](../interfaces/JSONSchemaEmitterOptions.md)\> | The asset emitter | + +#### Inherited from + +TypeEmitter, JSONSchemaEmitterOptions\>.constructor + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `private` | `#refToDecl` | `Map`<`string`, `Declaration`<`Record`<`string`, `unknown`\>\>\> | - | - | +| `private` | `#seenIds` | `Set`<`unknown`\> | - | - | +| `private` | `#typeForSourceFile` | `Map`<`SourceFile`<`any`\>, [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md)\> | - | - | +| `public` | `emitter` | `AssetEmitter`<`Record`<`string`, `any`\>, [`JSONSchemaEmitterOptions`](../interfaces/JSONSchemaEmitterOptions.md)\> | - | TypeEmitter.emitter | + +## Methods + +### #applyConstraints() + +```ts +private #applyConstraints(type, schema): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | \| `Model` \| `ModelProperty` \| `Scalar` \| `Enum` \| `Union` | +| `schema` | `ObjectBuilder`<`unknown`\> | + +*** + +### #checkForDuplicateId() + +```ts +private #checkForDuplicateId(id): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `id` | `string` | + +*** + +### #createDeclaration() + +```ts +private #createDeclaration( + type, + name, +schema): Declaration> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | +| `name` | `string` | +| `schema` | `ObjectBuilder`<`unknown`\> | + +*** + +### #fileExtension() + +```ts +private #fileExtension(): "json" | "yaml" +``` + +*** + +### #getCurrentSourceFile() + +```ts +private #getCurrentSourceFile(): SourceFile +``` + +*** + +### #getDeclId() + +```ts +private #getDeclId(type, name): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | +| `name` | `string` | + +*** + +### #isStdType() + +```ts +private #isStdType(type): boolean +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `Type` | + +*** + +### #newFileScope() + +```ts +private #newFileScope(type): object +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | + +#### Returns + +> | Member | Type | Description | +> | :------ | :------ | :------ | +> | `scope` | `Scope`<`Record`<`string`, `any`\>\> | - | +> + +*** + +### #requiredModelProperties() + +```ts +private #requiredModelProperties(model): undefined | string[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | + +*** + +### #scalarBuiltinBaseType() + +```ts +private #scalarBuiltinBaseType(scalar): null | Scalar +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `scalar` | `Scalar` | + +*** + +### arrayDeclaration() + +```ts +arrayDeclaration( + array, + name, +elementType): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | +| `name` | `string` | +| `elementType` | `Type` | + +#### Overrides + +TypeEmitter.arrayDeclaration + +*** + +### arrayDeclarationContext() + +```ts +arrayDeclarationContext(array): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | + +#### Overrides + +TypeEmitter.arrayDeclarationContext + +*** + +### arrayDeclarationReferenceContext() + +```ts +arrayDeclarationReferenceContext( + array, + name, + elementType): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | +| `name` | `string` | +| `elementType` | `Type` | + +#### Inherited from + +TypeEmitter.arrayDeclarationReferenceContext + +*** + +### arrayLiteral() + +```ts +arrayLiteral(array, elementType): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | +| `elementType` | `Type` | + +#### Overrides + +TypeEmitter.arrayLiteral + +*** + +### arrayLiteralContext() + +```ts +arrayLiteralContext(array, elementType): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | +| `elementType` | `Type` | + +#### Inherited from + +TypeEmitter.arrayLiteralContext + +*** + +### arrayLiteralReferenceContext() + +```ts +arrayLiteralReferenceContext(array, elementType): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `array` | `Model` | +| `elementType` | `Type` | + +#### Inherited from + +TypeEmitter.arrayLiteralReferenceContext + +*** + +### booleanLiteral() + +```ts +booleanLiteral(boolean): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `boolean` | `BooleanLiteral` | + +#### Overrides + +TypeEmitter.booleanLiteral + +*** + +### booleanLiteralContext() + +```ts +booleanLiteralContext(boolean): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `boolean` | `BooleanLiteral` | + +#### Inherited from + +TypeEmitter.booleanLiteralContext + +*** + +### declarationName() + +```ts +declarationName(declarationType): undefined | string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `declarationType` | `TypeSpecDeclaration` | + +#### Inherited from + +TypeEmitter.declarationName + +*** + +### enumDeclaration() + +```ts +enumDeclaration(en, name): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `en` | `Enum` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.enumDeclaration + +*** + +### enumDeclarationContext() + +```ts +enumDeclarationContext(en): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `en` | `Enum` | + +#### Overrides + +TypeEmitter.enumDeclarationContext + +*** + +### enumMember() + +```ts +enumMember(member): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `member` | `EnumMember` | + +#### Inherited from + +TypeEmitter.enumMember + +*** + +### enumMemberContext() + +```ts +enumMemberContext(member): object +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `member` | `EnumMember` | + +#### Inherited from + +TypeEmitter.enumMemberContext + +*** + +### enumMemberReference() + +```ts +enumMemberReference(member): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `member` | `EnumMember` | + +#### Overrides + +TypeEmitter.enumMemberReference + +*** + +### enumMembers() + +```ts +enumMembers(en): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `en` | `Enum` | + +#### Inherited from + +TypeEmitter.enumMembers + +*** + +### enumMembersContext() + +```ts +enumMembersContext(en): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `en` | `Enum` | + +#### Inherited from + +TypeEmitter.enumMembersContext + +*** + +### interfaceDeclaration() + +```ts +interfaceDeclaration(iface, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceDeclaration + +*** + +### interfaceDeclarationContext() + +```ts +interfaceDeclarationContext(iface, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceDeclarationContext + +*** + +### interfaceDeclarationOperations() + +```ts +interfaceDeclarationOperations(iface): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | + +#### Inherited from + +TypeEmitter.interfaceDeclarationOperations + +*** + +### interfaceDeclarationOperationsContext() + +```ts +interfaceDeclarationOperationsContext(iface): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | + +#### Inherited from + +TypeEmitter.interfaceDeclarationOperationsContext + +*** + +### interfaceDeclarationOperationsReferenceContext() + +```ts +interfaceDeclarationOperationsReferenceContext(iface): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | + +#### Inherited from + +TypeEmitter.interfaceDeclarationOperationsReferenceContext + +*** + +### interfaceDeclarationReferenceContext() + +```ts +interfaceDeclarationReferenceContext(iface, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `iface` | `Interface` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceDeclarationReferenceContext + +*** + +### interfaceOperationDeclaration() + +```ts +interfaceOperationDeclaration(operation, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceOperationDeclaration + +*** + +### interfaceOperationDeclarationContext() + +```ts +interfaceOperationDeclarationContext(operation, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceOperationDeclarationContext + +*** + +### interfaceOperationDeclarationReferenceContext() + +```ts +interfaceOperationDeclarationReferenceContext(operation, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.interfaceOperationDeclarationReferenceContext + +*** + +### intrinsic() + +```ts +intrinsic(intrinsic, name): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `intrinsic` | `IntrinsicType` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.intrinsic + +*** + +### intrinsicContext() + +```ts +intrinsicContext(intrinsic, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `intrinsic` | `IntrinsicType` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.intrinsicContext + +*** + +### modelDeclaration() + +```ts +modelDeclaration(model, name): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.modelDeclaration + +*** + +### modelDeclarationContext() + +```ts +modelDeclarationContext(model, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.modelDeclarationContext + +*** + +### modelDeclarationReferenceContext() + +```ts +modelDeclarationReferenceContext(model, name): Context +``` + +Set reference context for a model declaration. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `model` | `Model` | | +| `name` | `string` | - | + +#### Inherited from + +TypeEmitter.modelDeclarationReferenceContext + +*** + +### modelInstantiation() + +```ts +modelInstantiation(model, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | +| `name` | `undefined` \| `string` | + +#### Overrides + +TypeEmitter.modelInstantiation + +*** + +### modelInstantiationContext() + +```ts +modelInstantiationContext(model, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | +| `name` | `undefined` \| `string` | + +#### Overrides + +TypeEmitter.modelInstantiationContext + +*** + +### modelInstantiationReferenceContext() + +```ts +modelInstantiationReferenceContext(model, name): Context +``` + +Set reference context for a model declaration. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `model` | `Model` | | +| `name` | `undefined` \| `string` | - | + +#### Inherited from + +TypeEmitter.modelInstantiationReferenceContext + +*** + +### modelLiteral() + +```ts +modelLiteral(model): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | + +#### Overrides + +TypeEmitter.modelLiteral + +*** + +### modelLiteralContext() + +```ts +modelLiteralContext(model): Context +``` + +Set lexical context for a model literal. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `model` | `Model` | | + +#### Inherited from + +TypeEmitter.modelLiteralContext + +*** + +### modelLiteralReferenceContext() + +```ts +modelLiteralReferenceContext(model): Context +``` + +Set reference context for a model literal. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `model` | `Model` | | + +#### Inherited from + +TypeEmitter.modelLiteralReferenceContext + +*** + +### modelProperties() + +```ts +modelProperties(model): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | + +#### Overrides + +TypeEmitter.modelProperties + +*** + +### modelPropertiesContext() + +```ts +modelPropertiesContext(model): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | + +#### Inherited from + +TypeEmitter.modelPropertiesContext + +*** + +### modelPropertiesReferenceContext() + +```ts +modelPropertiesReferenceContext(model): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | `Model` | + +#### Inherited from + +TypeEmitter.modelPropertiesReferenceContext + +*** + +### modelPropertyLiteral() + +```ts +modelPropertyLiteral(property): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | `ModelProperty` | + +#### Overrides + +TypeEmitter.modelPropertyLiteral + +*** + +### modelPropertyLiteralContext() + +```ts +modelPropertyLiteralContext(property): Context +``` + +Set lexical context for a property of a model. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `property` | `ModelProperty` | | + +#### Inherited from + +TypeEmitter.modelPropertyLiteralContext + +*** + +### modelPropertyLiteralReferenceContext() + +```ts +modelPropertyLiteralReferenceContext(property): Context +``` + +Set reference context for a property of a model. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `property` | `ModelProperty` | | + +#### Inherited from + +TypeEmitter.modelPropertyLiteralReferenceContext + +*** + +### modelPropertyReference() + +```ts +modelPropertyReference(property): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | `ModelProperty` | + +#### Overrides + +TypeEmitter.modelPropertyReference + +*** + +### namespace() + +```ts +namespace(namespace): EmitterOutput> +``` + +Emit a namespace + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `namespace` | `Namespace` | | + +#### Returns + +Emitter output + +#### Inherited from + +TypeEmitter.namespace + +*** + +### namespaceContext() + +```ts +namespaceContext(namespace): Context +``` + +Set lexical context for a namespace + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `namespace` | `Namespace` | | + +#### Inherited from + +TypeEmitter.namespaceContext + +*** + +### namespaceReferenceContext() + +```ts +namespaceReferenceContext(namespace): Context +``` + +Set reference context for a namespace. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `namespace` | `Namespace` | | + +#### Inherited from + +TypeEmitter.namespaceReferenceContext + +*** + +### numericLiteral() + +```ts +numericLiteral(number): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `number` | `NumericLiteral` | + +#### Overrides + +TypeEmitter.numericLiteral + +*** + +### numericLiteralContext() + +```ts +numericLiteralContext(number): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `number` | `NumericLiteral` | + +#### Inherited from + +TypeEmitter.numericLiteralContext + +*** + +### operationDeclaration() + +```ts +operationDeclaration(operation, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.operationDeclaration + +*** + +### operationDeclarationContext() + +```ts +operationDeclarationContext(operation, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.operationDeclarationContext + +*** + +### operationDeclarationReferenceContext() + +```ts +operationDeclarationReferenceContext(operation, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.operationDeclarationReferenceContext + +*** + +### operationParameters() + +```ts +operationParameters(operation, parameters): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `parameters` | `Model` | + +#### Inherited from + +TypeEmitter.operationParameters + +*** + +### operationParametersContext() + +```ts +operationParametersContext(operation, parameters): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `parameters` | `Model` | + +#### Inherited from + +TypeEmitter.operationParametersContext + +*** + +### operationParametersReferenceContext() + +```ts +operationParametersReferenceContext(operation, parameters): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `parameters` | `Model` | + +#### Inherited from + +TypeEmitter.operationParametersReferenceContext + +*** + +### operationReturnType() + +```ts +operationReturnType(operation, returnType): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `returnType` | `Type` | + +#### Inherited from + +TypeEmitter.operationReturnType + +*** + +### operationReturnTypeContext() + +```ts +operationReturnTypeContext(operation, returnType): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `returnType` | `Type` | + +#### Inherited from + +TypeEmitter.operationReturnTypeContext + +*** + +### operationReturnTypeReferenceContext() + +```ts +operationReturnTypeReferenceContext(operation, returnType): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `operation` | `Operation` | +| `returnType` | `Type` | + +#### Inherited from + +TypeEmitter.operationReturnTypeReferenceContext + +*** + +### programContext() + +```ts +programContext(program): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | + +#### Overrides + +TypeEmitter.programContext + +*** + +### reference() + +```ts +reference( + targetDeclaration, + pathUp, + pathDown, +commonScope): object | EmitEntity> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `targetDeclaration` | `Declaration`<`Record`<`string`, `unknown`\>\> | +| `pathUp` | `Scope`<`Record`<`string`, `unknown`\>\>[] | +| `pathDown` | `Scope`<`Record`<`string`, `unknown`\>\>[] | +| `commonScope` | `null` \| `Scope`<`Record`<`string`, `unknown`\>\> | + +#### Overrides + +TypeEmitter.reference + +*** + +### scalarDeclaration() + +```ts +scalarDeclaration(scalar, name): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `scalar` | `Scalar` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.scalarDeclaration + +*** + +### scalarDeclarationContext() + +```ts +scalarDeclarationContext(scalar): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `scalar` | `Scalar` | + +#### Overrides + +TypeEmitter.scalarDeclarationContext + +*** + +### scalarInstantiation() + +```ts +scalarInstantiation(scalar, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `scalar` | `Scalar` | +| `name` | `undefined` \| `string` | + +#### Inherited from + +TypeEmitter.scalarInstantiation + +*** + +### scalarInstantiationContext() + +```ts +scalarInstantiationContext(scalar, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `scalar` | `Scalar` | +| `name` | `undefined` \| `string` | + +#### Inherited from + +TypeEmitter.scalarInstantiationContext + +*** + +### sourceFile() + +```ts +sourceFile(sourceFile): EmittedSourceFile +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `sourceFile` | `SourceFile`<`object`\> | + +#### Overrides + +TypeEmitter.sourceFile + +*** + +### stringLiteral() + +```ts +stringLiteral(string): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `string` | `StringLiteral` | + +#### Overrides + +TypeEmitter.stringLiteral + +*** + +### stringLiteralContext() + +```ts +stringLiteralContext(string): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `string` | `StringLiteral` | + +#### Inherited from + +TypeEmitter.stringLiteralContext + +*** + +### tupleLiteral() + +```ts +tupleLiteral(tuple): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `tuple` | `Tuple` | + +#### Inherited from + +TypeEmitter.tupleLiteral + +*** + +### tupleLiteralContext() + +```ts +tupleLiteralContext(tuple): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `tuple` | `Tuple` | + +#### Inherited from + +TypeEmitter.tupleLiteralContext + +*** + +### tupleLiteralReferenceContext() + +```ts +tupleLiteralReferenceContext(tuple): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `tuple` | `Tuple` | + +#### Inherited from + +TypeEmitter.tupleLiteralReferenceContext + +*** + +### tupleLiteralValues() + +```ts +tupleLiteralValues(tuple): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `tuple` | `Tuple` | + +#### Inherited from + +TypeEmitter.tupleLiteralValues + +*** + +### unionDeclaration() + +```ts +unionDeclaration(union, name): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | +| `name` | `string` | + +#### Overrides + +TypeEmitter.unionDeclaration + +*** + +### unionDeclarationContext() + +```ts +unionDeclarationContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Overrides + +TypeEmitter.unionDeclarationContext + +*** + +### unionDeclarationReferenceContext() + +```ts +unionDeclarationReferenceContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Inherited from + +TypeEmitter.unionDeclarationReferenceContext + +*** + +### unionInstantiation() + +```ts +unionInstantiation(union, name): EmitterOutput> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.unionInstantiation + +*** + +### unionInstantiationContext() + +```ts +unionInstantiationContext(union, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.unionInstantiationContext + +*** + +### unionInstantiationReferenceContext() + +```ts +unionInstantiationReferenceContext(union, name): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | +| `name` | `string` | + +#### Inherited from + +TypeEmitter.unionInstantiationReferenceContext + +*** + +### unionLiteral() + +```ts +unionLiteral(union): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Overrides + +TypeEmitter.unionLiteral + +*** + +### unionLiteralContext() + +```ts +unionLiteralContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Inherited from + +TypeEmitter.unionLiteralContext + +*** + +### unionLiteralReferenceContext() + +```ts +unionLiteralReferenceContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Inherited from + +TypeEmitter.unionLiteralReferenceContext + +*** + +### unionVariant() + +```ts +unionVariant(variant): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `variant` | `UnionVariant` | + +#### Overrides + +TypeEmitter.unionVariant + +*** + +### unionVariantContext() + +```ts +unionVariantContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Inherited from + +TypeEmitter.unionVariantContext + +*** + +### unionVariantReferenceContext() + +```ts +unionVariantReferenceContext(union): Context +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Inherited from + +TypeEmitter.unionVariantReferenceContext + +*** + +### unionVariants() + +```ts +unionVariants(union): EmitterOutput +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `union` | `Union` | + +#### Overrides + +TypeEmitter.unionVariants + +*** + +### unionVariantsContext() + +```ts +unionVariantsContext(): Context +``` + +#### Inherited from + +TypeEmitter.unionVariantsContext + +*** + +### unionVariantsReferenceContext() + +```ts +unionVariantsReferenceContext(): Context +``` + +#### Inherited from + +TypeEmitter.unionVariantsReferenceContext + +*** + +### writeOutput() + +```ts +writeOutput(sourceFiles): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `sourceFiles` | `SourceFile`<`Record`<`string`, `any`\>\>[] | + +#### Overrides + +TypeEmitter.writeOutput diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$baseUri.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$baseUri.md new file mode 100644 index 0000000000..4fb6ee2ccd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$baseUri.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $baseUri" + +--- +```ts +$baseUri( + context, + target, + baseUri): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Namespace` | +| `baseUri` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contains.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contains.md new file mode 100644 index 0000000000..77d35d5d4e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contains.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $contains" + +--- +```ts +$contains( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contentEncoding.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contentEncoding.md new file mode 100644 index 0000000000..2dcef7681d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contentEncoding.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $contentEncoding" + +--- +```ts +$contentEncoding( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `StringLiteral` \| `ModelProperty` | +| `value` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contentMediaType.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contentMediaType.md new file mode 100644 index 0000000000..efdd8b2caf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contentMediaType.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $contentMediaType" + +--- +```ts +$contentMediaType( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `StringLiteral` \| `ModelProperty` | +| `value` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contentSchema.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contentSchema.md new file mode 100644 index 0000000000..e0ea17ecb7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$contentSchema.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $contentSchema" + +--- +```ts +$contentSchema( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `StringLiteral` \| `ModelProperty` | +| `value` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$extension.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$extension.md new file mode 100644 index 0000000000..62fa25355f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$extension.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $extension" + +--- +```ts +$extension( + context, + target, + key, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Type` | +| `key` | `string` | +| `value` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$id.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$id.md new file mode 100644 index 0000000000..a9a22c68e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$id.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $id" + +--- +```ts +$id( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `Scalar` \| `Enum` \| `Union` | +| `value` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$jsonSchema.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$jsonSchema.md new file mode 100644 index 0000000000..d71d8272f1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$jsonSchema.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $jsonSchema" + +--- +```ts +$jsonSchema( + context, + target, + baseUriOrId?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Namespace` \| [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | +| `baseUriOrId`? | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$maxContains.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$maxContains.md new file mode 100644 index 0000000000..b6433ac379 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$maxContains.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxContains" + +--- +```ts +$maxContains( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$maxProperties.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$maxProperties.md new file mode 100644 index 0000000000..3797b6ed0a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$maxProperties.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxProperties" + +--- +```ts +$maxProperties( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$minContains.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$minContains.md new file mode 100644 index 0000000000..aa8d6c5779 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$minContains.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minContains" + +--- +```ts +$minContains( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$minProperties.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$minProperties.md new file mode 100644 index 0000000000..7220726f9e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$minProperties.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minProperties" + +--- +```ts +$minProperties( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$multipleOf.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$multipleOf.md new file mode 100644 index 0000000000..29df2c371b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$multipleOf.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $multipleOf" + +--- +```ts +$multipleOf( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` | +| `value` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$onEmit.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$onEmit.md new file mode 100644 index 0000000000..c8d2de9fb2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$onEmit.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] $onEmit" + +--- +```ts +$onEmit(context): Promise +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `EmitContext`<[`JSONSchemaEmitterOptions`](../interfaces/JSONSchemaEmitterOptions.md)\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$prefixItems.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$prefixItems.md new file mode 100644 index 0000000000..efe0c3c814 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$prefixItems.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $prefixItems" + +--- +```ts +$prefixItems( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | +| `value` | `Tuple` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$uniqueItems.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$uniqueItems.md new file mode 100644 index 0000000000..d1e815ecfc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$uniqueItems.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $uniqueItems" + +--- +```ts +$uniqueItems(context, target): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` \| `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$validatesRawJson.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$validatesRawJson.md new file mode 100644 index 0000000000..2b38c02950 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/$validatesRawJson.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $validatesRawJson" + +--- +```ts +$validatesRawJson( + context, + target, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `Model` | +| `value` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/findBaseUri.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/findBaseUri.md new file mode 100644 index 0000000000..8278960d03 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/findBaseUri.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] findBaseUri" + +--- +```ts +findBaseUri(program, target): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Namespace` \| [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getBaseUri.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getBaseUri.md new file mode 100644 index 0000000000..dd83a9c6c9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getBaseUri.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getBaseUri" + +--- +```ts +getBaseUri(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContains.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContains.md new file mode 100644 index 0000000000..17ffcc61ec --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContains.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getContains" + +--- +```ts +getContains(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContentEncoding.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContentEncoding.md new file mode 100644 index 0000000000..efff65e2a2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContentEncoding.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getContentEncoding" + +--- +```ts +getContentEncoding(program, target): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContentMediaType.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContentMediaType.md new file mode 100644 index 0000000000..774f13f7bf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContentMediaType.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getContentMediaType" + +--- +```ts +getContentMediaType(program, target): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContentSchema.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContentSchema.md new file mode 100644 index 0000000000..2ed8dd9350 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getContentSchema.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getContentSchema" + +--- +```ts +getContentSchema(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getExtensions.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getExtensions.md new file mode 100644 index 0000000000..d254dde711 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getExtensions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getExtensions" + +--- +```ts +getExtensions(program, target): ExtensionRecord[] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getId.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getId.md new file mode 100644 index 0000000000..468b2321a9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getId.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getId" + +--- +```ts +getId(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getJsonSchema.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getJsonSchema.md new file mode 100644 index 0000000000..39392a1288 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getJsonSchema.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getJsonSchema" + +--- +```ts +getJsonSchema(program, target): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getJsonSchemaTypes.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getJsonSchemaTypes.md new file mode 100644 index 0000000000..6dc439ba2f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getJsonSchemaTypes.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] getJsonSchemaTypes" + +--- +```ts +getJsonSchemaTypes(program): (Namespace | Model)[] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMaxContains.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMaxContains.md new file mode 100644 index 0000000000..1bd1d037a9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMaxContains.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxContains" + +--- +```ts +getMaxContains(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMaxProperties.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMaxProperties.md new file mode 100644 index 0000000000..b7fadc390d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMaxProperties.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxProperties" + +--- +```ts +getMaxProperties(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMinContains.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMinContains.md new file mode 100644 index 0000000000..44059475b4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMinContains.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinContains" + +--- +```ts +getMinContains(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMinProperties.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMinProperties.md new file mode 100644 index 0000000000..5ab738c867 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMinProperties.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinProperties" + +--- +```ts +getMinProperties(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMultipleOf.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMultipleOf.md new file mode 100644 index 0000000000..f312718da3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getMultipleOf.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMultipleOf" + +--- +```ts +getMultipleOf(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getPrefixItems.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getPrefixItems.md new file mode 100644 index 0000000000..ea9a32b3d6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getPrefixItems.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getPrefixItems" + +--- +```ts +getPrefixItems(program, target): Tuple | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getUniqueItems.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getUniqueItems.md new file mode 100644 index 0000000000..7a516e1991 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/getUniqueItems.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getUniqueItems" + +--- +```ts +getUniqueItems(program, target): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/isJsonSchemaDeclaration.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/isJsonSchemaDeclaration.md new file mode 100644 index 0000000000..8d6cd648bd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/functions/isJsonSchemaDeclaration.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isJsonSchemaDeclaration" + +--- +```ts +isJsonSchemaDeclaration(program, target): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `target` | [`JsonSchemaDeclaration`](../type-aliases/JsonSchemaDeclaration.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/index.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/index.md new file mode 100644 index 0000000000..4848588ac1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/index.md @@ -0,0 +1,67 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Namespaces + +- [$validatesRawJson](namespaces/$validatesRawJson/index.md) + +### Classes + +- [JsonSchemaEmitter](classes/JsonSchemaEmitter.md) + +### Interfaces + +- [ExtensionRecord](interfaces/ExtensionRecord.md) +- [JSONSchemaEmitterOptions](interfaces/JSONSchemaEmitterOptions.md) + +### Type Aliases + +- [JsonSchemaDeclaration](type-aliases/JsonSchemaDeclaration.md) + +### Variables + +- [$lib](variables/$lib.md) +- [EmitterOptionsSchema](variables/EmitterOptionsSchema.md) +- [namespace](variables/namespace.md) + +### Functions + +- [$baseUri](functions/$baseUri.md) +- [$contains](functions/$contains.md) +- [$contentEncoding](functions/$contentEncoding.md) +- [$contentMediaType](functions/$contentMediaType.md) +- [$contentSchema](functions/$contentSchema.md) +- [$extension](functions/$extension.md) +- [$id](functions/$id.md) +- [$jsonSchema](functions/$jsonSchema.md) +- [$maxContains](functions/$maxContains.md) +- [$maxProperties](functions/$maxProperties.md) +- [$minContains](functions/$minContains.md) +- [$minProperties](functions/$minProperties.md) +- [$multipleOf](functions/$multipleOf.md) +- [$onEmit](functions/$onEmit.md) +- [$prefixItems](functions/$prefixItems.md) +- [$uniqueItems](functions/$uniqueItems.md) +- [$validatesRawJson](functions/$validatesRawJson.md) +- [findBaseUri](functions/findBaseUri.md) +- [getBaseUri](functions/getBaseUri.md) +- [getContains](functions/getContains.md) +- [getContentEncoding](functions/getContentEncoding.md) +- [getContentMediaType](functions/getContentMediaType.md) +- [getContentSchema](functions/getContentSchema.md) +- [getExtensions](functions/getExtensions.md) +- [getId](functions/getId.md) +- [getJsonSchema](functions/getJsonSchema.md) +- [getJsonSchemaTypes](functions/getJsonSchemaTypes.md) +- [getMaxContains](functions/getMaxContains.md) +- [getMaxProperties](functions/getMaxProperties.md) +- [getMinContains](functions/getMinContains.md) +- [getMinProperties](functions/getMinProperties.md) +- [getMultipleOf](functions/getMultipleOf.md) +- [getPrefixItems](functions/getPrefixItems.md) +- [getUniqueItems](functions/getUniqueItems.md) +- [isJsonSchemaDeclaration](functions/isJsonSchemaDeclaration.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/interfaces/ExtensionRecord.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/interfaces/ExtensionRecord.md new file mode 100644 index 0000000000..ab1f993a6e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/interfaces/ExtensionRecord.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ExtensionRecord" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `key` | `string` | - | +| `value` | `Type` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/interfaces/JSONSchemaEmitterOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/interfaces/JSONSchemaEmitterOptions.md new file mode 100644 index 0000000000..2c8423baa5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/interfaces/JSONSchemaEmitterOptions.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] JSONSchemaEmitterOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `bundleId?` | `string` | When provided, bundle all the schemas into a single json schema document
with schemas under $defs. The provided id is the id of the root document
and is also used for the file name. | +| `emitAllModels?` | `boolean` | When true, emit all model declarations to JSON Schema without requiring
the

**Json Schema**

decorator. | +| `emitAllRefs?` | `boolean` | When true, emit all references as json schema files, even if the referenced
type does not have the `@jsonSchema` decorator or is not within a namespace
with the `@jsonSchema` decorator. | +| `file-type?` | `FileType` | Serialize the schema as either yaml or json.

**Default**

yaml, it not specified infer from the `output-file` extension | +| `int64-strategy?` | `Int64Strategy` | How to handle 64 bit integers on the wire. Options are:

* string: serialize as a string (widely interoperable)
* number: serialize as a number (not widely interoperable) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/index.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/index.md new file mode 100644 index 0000000000..9f710c9c49 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/index.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[N] $validatesRawJson" + +--- +## Index + +### Variables + +- [namespace](variables/namespace.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/variables/namespace.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/variables/namespace.md new file mode 100644 index 0000000000..ef9b0531d5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/namespaces/$validatesRawJson/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +namespace: string; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/type-aliases/JsonSchemaDeclaration.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/type-aliases/JsonSchemaDeclaration.md new file mode 100644 index 0000000000..7d5536527f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/type-aliases/JsonSchemaDeclaration.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] JsonSchemaDeclaration" + +--- +```ts +type JsonSchemaDeclaration: Model | Union | Enum | Scalar; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/variables/$lib.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/variables/$lib.md new file mode 100644 index 0000000000..5743d59edd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/variables/$lib.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] $lib" + +--- +```ts +const $lib: TypeSpecLibrary; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/variables/EmitterOptionsSchema.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/variables/EmitterOptionsSchema.md new file mode 100644 index 0000000000..7a97c4e8cb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/variables/EmitterOptionsSchema.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] EmitterOptionsSchema" + +--- +```ts +const EmitterOptionsSchema: JSONSchemaType; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..1787cce0cc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/json-schema/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.JsonSchema" = "TypeSpec.JsonSchema"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/data-types.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/data-types.md new file mode 100644 index 0000000000..0a0fd0d0b5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/data-types.md @@ -0,0 +1,33 @@ +--- +title: "Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Data types + +## TypeSpec.OpenAPI + +### `AdditionalInfo` {#TypeSpec.OpenAPI.AdditionalInfo} + +Additional information for the OpenAPI document. + +```typespec +model TypeSpec.OpenAPI.AdditionalInfo +``` + +### `Contact` {#TypeSpec.OpenAPI.Contact} + +Contact information for the exposed API. + +```typespec +model TypeSpec.OpenAPI.Contact +``` + +### `License` {#TypeSpec.OpenAPI.License} + +License information for the exposed API. + +```typespec +model TypeSpec.OpenAPI.License +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/decorators.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/decorators.md new file mode 100644 index 0000000000..44ae2d91da --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/decorators.md @@ -0,0 +1,140 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.OpenAPI + +### `@defaultResponse` {#@TypeSpec.OpenAPI.defaultResponse} + +Specify that this model is to be treated as the OpenAPI `default` response. +This differs from the compiler built-in `@error` decorator as this does not necessarily represent an error. + +```typespec +@TypeSpec.OpenAPI.defaultResponse +``` + +#### Target + +`Model` + +#### Parameters + +None + +#### Examples + +```typespec +@defaultResponse +model PetStoreResponse is object; + +op listPets(): Pet[] | PetStoreResponse; +``` + +### `@extension` {#@TypeSpec.OpenAPI.extension} + +Attach some custom data to the OpenAPI element generated from this type. + +```typespec +@TypeSpec.OpenAPI.extension(key: valueof string, value: unknown) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------------- | ----------------------------------- | +| key | `valueof scalar string` | Extension key. Must start with `x-` | +| value | `(intrinsic) unknown` | Extension value. | + +#### Examples + +```typespec +@extension("x-custom", "My value") +@extension( + "x-pageable", + { + nextLink: "x-next-link", + } +) +op read(): string; +``` + +### `@externalDocs` {#@TypeSpec.OpenAPI.externalDocs} + +Specify the OpenAPI `externalDocs` property for this type. + +```typespec +@TypeSpec.OpenAPI.externalDocs(url: valueof string, description?: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ----------- | ----------------------- | ----------------------- | +| url | `valueof scalar string` | Url to the docs | +| description | `valueof scalar string` | Description of the docs | + +#### Examples + +```typespec +@externalDocs( + "https://example.com/detailed.md", + "Detailed information on how to use this operation" +) +op listPets(): Pet[]; +``` + +### `@info` {#@TypeSpec.OpenAPI.info} + +Specify OpenAPI additional information. +The service `title` and `version` are already specified using `@service`. + +```typespec +@TypeSpec.OpenAPI.info(additionalInfo: TypeSpec.OpenAPI.AdditionalInfo) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| -------------- | --------------------------------------- | ---------------------- | +| additionalInfo | `model TypeSpec.OpenAPI.AdditionalInfo` | Additional information | + +### `@operationId` {#@TypeSpec.OpenAPI.operationId} + +Specify the OpenAPI `operationId` property for this operation. + +```typespec +@TypeSpec.OpenAPI.operationId(operationId: valueof string) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ----------- | ----------------------- | ------------------- | +| operationId | `valueof scalar string` | Operation id value. | + +#### Examples + +```typespec +@operationId("download") +op read(): string; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/index.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/index.md new file mode 100644 index 0000000000..7626cf0bda --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/index.md @@ -0,0 +1,48 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec library providing OpenAPI concepts + +## Install + + + + +```bash +npm install @typespec/openapi +``` + + + + +```bash +npm install --save-peer @typespec/openapi +``` + + + + +## TypeSpec.OpenAPI + +### Decorators + +- [`@defaultResponse`](./decorators.md#@TypeSpec.OpenAPI.defaultResponse) +- [`@extension`](./decorators.md#@TypeSpec.OpenAPI.extension) +- [`@externalDocs`](./decorators.md#@TypeSpec.OpenAPI.externalDocs) +- [`@info`](./decorators.md#@TypeSpec.OpenAPI.info) +- [`@operationId`](./decorators.md#@TypeSpec.OpenAPI.operationId) + +### Models + +- [`AdditionalInfo`](./data-types.md#TypeSpec.OpenAPI.AdditionalInfo) +- [`Contact`](./data-types.md#TypeSpec.OpenAPI.Contact) +- [`License`](./data-types.md#TypeSpec.OpenAPI.License) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$defaultResponse.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$defaultResponse.md new file mode 100644 index 0000000000..f8a37538b8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$defaultResponse.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $defaultResponse" + +--- +```ts +$defaultResponse(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$extension.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$extension.md new file mode 100644 index 0000000000..8dcc3b8258 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$extension.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $extension" + +--- +```ts +$extension( + context, + entity, + extensionName, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Type` | +| `extensionName` | `string` | +| `value` | `TypeSpecValue` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$externalDocs.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$externalDocs.md new file mode 100644 index 0000000000..68ad6f4ee0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$externalDocs.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] $externalDocs" + +--- +```ts +$externalDocs( + context, + target, + url, + description?): void +``` + +Allows referencing an external resource for extended documentation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | `DecoratorContext` | - | +| `target` | `Type` | - | +| `url` | `string` | The URL for the target documentation. Value MUST be in the format of a URL. | +| `description`? | `string` | - | + +## Returns + +## Optional + +description A short description of the target documentation. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$info.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$info.md new file mode 100644 index 0000000000..0141b98e84 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$info.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $info" + +--- +```ts +$info( + context, + entity, + model): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Namespace` | +| `model` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$operationId.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$operationId.md new file mode 100644 index 0000000000..30665d8f6b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/$operationId.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $operationId" + +--- +```ts +$operationId( + context, + entity, + opId): void +``` + +Set a specific operation ID. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | `DecoratorContext` | Decorator Context | +| `entity` | `Operation` | Decorator target | +| `opId` | `string` | Operation ID. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/checkDuplicateTypeName.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/checkDuplicateTypeName.md new file mode 100644 index 0000000000..94f42f3be8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/checkDuplicateTypeName.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] checkDuplicateTypeName" + +--- +```ts +checkDuplicateTypeName( + program, + type, + name, + existing): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | +| `name` | `string` | +| `existing` | `undefined` \| `Record`<`string`, `unknown`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getExtensions.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getExtensions.md new file mode 100644 index 0000000000..ea291e3d14 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getExtensions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getExtensions" + +--- +```ts +getExtensions(program, entity): ReadonlyMap +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getExternalDocs.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getExternalDocs.md new file mode 100644 index 0000000000..cbe57a38f1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getExternalDocs.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getExternalDocs" + +--- +```ts +getExternalDocs(program, entity): ExternalDocs | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getInfo.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getInfo.md new file mode 100644 index 0000000000..11cb22187d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getInfo.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getInfo" + +--- +```ts +getInfo(program, entity): AdditionalInfo | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getOpenAPITypeName.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getOpenAPITypeName.md new file mode 100644 index 0000000000..0cd33dcdf5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getOpenAPITypeName.md @@ -0,0 +1,30 @@ +--- +jsApi: true +title: "[F] getOpenAPITypeName" + +--- +```ts +getOpenAPITypeName( + program, + type, + options, + existing?): string +``` + +Gets the name of a type to be used in OpenAPI. + +For inlined types: this is the TypeSpec-native name written to `x-typespec-name`. + +For non-inlined types: this is either the friendly name or the TypeSpec-native name. + +TypeSpec-native names are shortened to exclude root `TypeSpec` namespace and service +namespace using the provided `TypeNameOptions`. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | +| `options` | `TypeNameOptions` | +| `existing`? | `Record`<`string`, `any`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getOperationId.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getOperationId.md new file mode 100644 index 0000000000..296f2bba76 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getOperationId.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getOperationId" + +--- +```ts +getOperationId(program, entity): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Operation` | + +## Returns + +operationId set via the + +## Operation Id + +decorator or `undefined` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getParameterKey.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getParameterKey.md new file mode 100644 index 0000000000..67521629ca --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/getParameterKey.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] getParameterKey" + +--- +```ts +getParameterKey( + program, + property, + newParam, + existingParams, + options): string +``` + +Gets the key that is used to define a parameter in OpenAPI. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `property` | `ModelProperty` | +| `newParam` | `unknown` | +| `existingParams` | `Record`<`string`, `unknown`\> | +| `options` | `TypeNameOptions` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/isDefaultResponse.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/isDefaultResponse.md new file mode 100644 index 0000000000..0c5f649df4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/isDefaultResponse.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isDefaultResponse" + +--- +```ts +isDefaultResponse(program, entity): boolean +``` + +Check if the given model has been mark as a default response. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | TypeSpec Program | +| `entity` | `Type` | Model to check. | + +## Returns + +boolean. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/isReadonlyProperty.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/isReadonlyProperty.md new file mode 100644 index 0000000000..64ca698c3d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/isReadonlyProperty.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[F] isReadonlyProperty" + +--- +```ts +isReadonlyProperty(program, property): boolean +``` + +Determines if a property is read-only, which is defined as being +decorated `@visibility("read")`. + +If there is more than 1 `@visibility` argument, then the property is not +read-only. For example, `@visibility("read", "update")` does not +designate a read-only property. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `property` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/resolveOperationId.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/resolveOperationId.md new file mode 100644 index 0000000000..eb42f6d1b2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/resolveOperationId.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[F] resolveOperationId" + +--- +```ts +resolveOperationId(program, operation): string +``` + +Resolve the OpenAPI operation ID for the given operation using the following logic: +- If + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | TypeSpec Program | +| `operation` | `Operation` | Operation | + +## Returns + +Operation ID in this format `` or `_` + +## Operation Id + +was specified use that value +- If operation is defined at the root or under the service namespace return `` +- Otherwise(operation is under another namespace or interface) return `_` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/setExtension.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/setExtension.md new file mode 100644 index 0000000000..71e5b0c5ea --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/setExtension.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] setExtension" + +--- +```ts +setExtension( + program, + entity, + extensionName, + data): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | +| `extensionName` | \`x-${string}\` | +| `data` | `unknown` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/shouldInline.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/shouldInline.md new file mode 100644 index 0000000000..295054eeb8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/functions/shouldInline.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] shouldInline" + +--- +```ts +shouldInline(program, type): boolean +``` + +Determines whether a type will be inlined in OpenAPI rather than defined +as a schema and referenced. + +All anonymous types (anonymous models, arrays, tuples, etc.) are inlined. + +Template instantiations are inlined unless they have a friendly name. + +A friendly name can be provided by the user using `@friendlyName` +decorator, or chosen by default in simple cases. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/index.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/index.md new file mode 100644 index 0000000000..a3de3658a4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/index.md @@ -0,0 +1,41 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Interfaces + +- [AdditionalInfo](interfaces/AdditionalInfo.md) +- [Contact](interfaces/Contact.md) +- [ExternalDocs](interfaces/ExternalDocs.md) +- [License](interfaces/License.md) + +### Type Aliases + +- [ExtensionKey](type-aliases/ExtensionKey.md) + +### Variables + +- [namespace](variables/namespace.md) + +### Functions + +- [$defaultResponse](functions/$defaultResponse.md) +- [$extension](functions/$extension.md) +- [$externalDocs](functions/$externalDocs.md) +- [$info](functions/$info.md) +- [$operationId](functions/$operationId.md) +- [checkDuplicateTypeName](functions/checkDuplicateTypeName.md) +- [getExtensions](functions/getExtensions.md) +- [getExternalDocs](functions/getExternalDocs.md) +- [getInfo](functions/getInfo.md) +- [getOpenAPITypeName](functions/getOpenAPITypeName.md) +- [getOperationId](functions/getOperationId.md) +- [getParameterKey](functions/getParameterKey.md) +- [isDefaultResponse](functions/isDefaultResponse.md) +- [isReadonlyProperty](functions/isReadonlyProperty.md) +- [resolveOperationId](functions/resolveOperationId.md) +- [setExtension](functions/setExtension.md) +- [shouldInline](functions/shouldInline.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/AdditionalInfo.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/AdditionalInfo.md new file mode 100644 index 0000000000..ecaf31b41b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/AdditionalInfo.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] AdditionalInfo" + +--- +OpenAPI additional information + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `contact?` | [`Contact`](Contact.md) | The contact information for the exposed API. | +| `license?` | [`License`](License.md) | The license information for the exposed API. | +| `termsOfService?` | `string` | A URL to the Terms of Service for the API. MUST be in the format of a URL. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/Contact.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/Contact.md new file mode 100644 index 0000000000..c50d5c3dee --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/Contact.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] Contact" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `email?` | `string` | The email address of the contact person/organization. MUST be in the format of an email address. | +| `name?` | `string` | The identifying name of the contact person/organization. | +| `url?` | `string` | The URL pointing to the contact information. MUST be in the format of a URL. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/ExternalDocs.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/ExternalDocs.md new file mode 100644 index 0000000000..debe31f244 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/ExternalDocs.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ExternalDocs" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description?` | `string` | - | +| `url` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/License.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/License.md new file mode 100644 index 0000000000..785a5aa31c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/interfaces/License.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] License" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | The license name used for the API. | +| `url?` | `string` | A URL to the license used for the API. MUST be in the format of a URL. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/type-aliases/ExtensionKey.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/type-aliases/ExtensionKey.md new file mode 100644 index 0000000000..e5249ff81c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/type-aliases/ExtensionKey.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] ExtensionKey" + +--- +```ts +type ExtensionKey: \x-${string}\; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..b13059d83c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.OpenAPI" = "TypeSpec.OpenAPI"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/diagnostics.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/diagnostics.md new file mode 100644 index 0000000000..a35f352f0f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/diagnostics.md @@ -0,0 +1,68 @@ +--- +title: Diagnostics +--- + +# Diagnostics + +The OpenAPI emitter may produce any of the following diagnostic messages. + + + +## duplicate-header + +This diagnostic is issued when a response header is defined more than once for a response of a specific status code. + +How to fix ??? + +## duplicate-type-name + +This diagnostic is issued when a schema or parameter name is a duplicate of another schema or parameter. +This generally happens when a model or parameter is renamed with the `@friendlyName` decorator. + +To fix this issue, change the name or friendly-name of one of the models or parameters. + +## inline-cycle + +??? + +## invalid-default + +??? + +## invalid-extension-key + +This diagnostic is issued by the `@extension` decorator when the extension key does not start with "x-" as +required by the OpenAPI v3 specification. + +To fix this issue, change the extension name to start with "x-". + +## invalid-schema + +??? + +## invalid-server-variable + +This diagnostic is issued when the a variable in the `@server` decorator is not defined as a string type. +Since server variables are substituted into the server URL which is a string, all variables must have string values. + +To fix this issue, make sure all server variables are string type. + +## path-query + +This diagnostic is issued when the OpenAPI emitter finds an `@route` decorator that specifies a path that contains a query parameter. +This is not permitted by the OpenAPI v3 specification. + +To fix this issue, redesign the API to only use paths without query parameters. + +## union-null + +This diagnostic is issued when the result of model composition is effectively a `null` schema which cannot be +represented in OpenAPI. + +To fix this issue, correct the composition to produce a valid schema or remove it altogether. + +## union-unsupported + +This diagnostic is issued when the OpenAPI emitter finds a union of two incompatible types. + +To fix this issue, correct the composition to produce a valid schema or remove it altogether. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/openapi.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/openapi.md new file mode 100644 index 0000000000..b7d9f23ae1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/openapi.md @@ -0,0 +1,312 @@ +--- +title: Emitter operation +--- + +# How the OpenAPI emitter works + +The OpenAPI emitter converts TypeSpec language elements into their natural OpenAPI expression as described below. + +## Servers + +If the TypeSpec file contains an [(Http) `@server` decorator](../rest/reference/decorators.md#@TypeSpec.Http.server) +the OpenAPI emitter will generate a `servers` object with the server URL, description, and variables specified in the decorator. + +You can specify multiple `@server` decorators to obtain multiple entries in the `servers` object. + +## Operations + +Each TypeSpec operation becomes an OpenAPI operation. + +The HTTP method for the operation is either explicitly specified with an [(Http) `@get`, `@post`, `@put`, `@patch`, or `@delete` decorator][http-verb-decorators] on the operation or it is inferred from the operation name and signature. + +The path for the operation comes from the [(Http) `@route` decorator][http-route-decorator] on the operation. +The `@route` decorator can also be specified on a namespace and/or an interface (group of operations). +When specified, the route for the enclosing namespace(s) and interface are prefixed to the operation route. + +[http-verb-decorators]: ../rest/reference/decorators.md +[http-route-decorator]: ../rest/reference/decorators.md#@TypeSpec.Http.route + +The fields of the [OpenAPI Operation object][] are set as described below. + +[openapi operation object]: https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#operationObject + +### description + +The description field is set from the [(built-in) `@doc` decorator][doc-decorator] on the TypeSpec operation, and omitted when `@doc` is not present. + +[doc-decorator]: ../built-in-decorators.md#doc + +### summary + +The summary field is set from the [(built-in) `@summary` decorator][summary-decorator] on the TypeSpec operation, and omitted when `@summary` is not present. + +[summary-decorator]: ../built-in-decorators.md#summary + +### operationId + +The operationId can be explicitly specified with the [(OpenAPI) `@operationId` decorator][openapi-operationid-decorator], +and otherwise is simple the operation name, prefixed with "*" when the operation is within an interface. + +[openapi-operationid-decorator]: ../built-in-decorators.md#operationId + +### parameters and requestBody + +The parameters of the TypeSpec operation are translated into the parameter list and requestBody for the OpenAPI operation. + +The `in` field of a parameter is specified with an [(Http) `@query`, `@header`, or `@path` decorator][http-parameter-decorators]. +A parameter without one of these decorators is assumed to be passed in the request body. + +The request body parameter can also be explicitly decorated with an [(Http) `@body` decorator][http-body-decorator]. +In the absence of explicit `@body`, the set of parameters that are not marked `@header`, `@query`, or `@path` form the request body +and this request body is defined as required. If the request body should be optional, the body must be declared as +optional property with the `@body` decorator. + +[http-parameter-decorators]: ../rest/reference/decorators.md#data-types +[http-body-decorator]: ../rest/reference/decorators.md#@TypeSpec.Http.body + +The content of a (built-in) `@doc` decorator on a parameter will be set in the description. + +The TypeSpec parameter type will be translated into an appropriate OpenAPI schema for the parameter. + +Likewise, the type of the body parameter(s) will be translated into an appropriate OpenAPI schema for the requestBody. +The request body will use the "application/json" media type unless the body model includes an explicit `content-type` +header. + +See also [metadata](../http/operations.md#metadata) for more advanced details. + +### responses + +The return type(s) of the TypeSpec operation are translated into responses for the OpenAPI operation. +The status code for a response can be specified as a property in the return type model with the [(Http) `@statusCode` decorator][http-statuscode-decorator] (the property name is ignored). +If the [(built-in) `@error` decorator][error-decorator] is specified on a return type, this return type becomes the "default" response for the operation. +The media type for a response will be "application/json" unless the return type model includes an explicit `content-type` +header. +Models with different status codes and/or media types can be unioned together to describe complex response designs. + +When a return type model has a property explicitly decorated with an [(Http) `@body` decorator][http-body-decorator], this +is taken as the response body. +In the absence of explicit `@body`, the properties that are not marked `@statusCode` or `@header` form the response body. + +[http-statuscode-decorator]: ../rest/reference/decorators.md#@TypeSpec.Http.statuscode +[error-decorator]: ../built-in-decorators.md#error + +See also [metadata](../http/operations.md#metadata) for more advanced details. + +### tags + +Any tags specified with the [(built-in) `@tag` decorator][tag-decorator] on the operation, interface, or +enclosing namespace(s) are included in the OpenAPI operation's tags array. + +[tag-decorator]: ../built-in-decorators.md#tag + +### deprecated + +If the [(built-in) `#deprecated` directive][deprecated-decorator] is specified on the operation, then the operation's +deprecated field is set to true. + +[deprecated-decorator]: ../built-in-decorators.md#deprecated + +### externalDocs + +If the TypeSpec operation has an [(OpenAPI) `@externalDocs` decorator](../openapi/reference/decorators.md#@OpenAPI.externaldocs) this will produce +an externalDocs field in the OpenAPI operation. + +### Specification extensions + +Any extensions specified on the TypeSpec operation with the [(OpenAPI) `@extension` decorator](../openapi/reference/decorators.md#OpenAPI.extension) +are included in the emitted OpenAPI operation. + +## Models and enums + +Models and enums are converted into schemas in the generated OpenAPI definition. Intrinsic types in TypeSpec are represented +with a JSON Schema type that most closely matches the semantics of the TypeSpec type. + +Models defined inline will result in an inline schema. Explicitly declared models will be defined in the `components/schemas` +section with the TypeSpec name qualified by any enclosing namespaces. + +A special case is an instantiation of a model template, it is treated as an inline model unless the model template has +a [(built-in) `@friendlyName` decorator][friendlyname], in which case the schema is defined in `components/schemas` with the friendly-name. + +[friendlyname]: ../built-in-decorators.md#friendlyname + +The following table shows how TypeSpec types are translated to JSON Schema types: + +| TypeSpec type | OpenAPI `type`/`format` | Notes | +| ---------------- | --------------------------------- | ------------------------------------------------------------------------- | +| `int32` | `type: integer, format: int32` | | +| `int64` | `type: integer, format: int64` | | +| `float32` | `type: number, format: float` | | +| `float64` | `type: number, format: double` | | +| `string` | `type: string` | | +| `bytes` | `type: string, format: byte` | for content-type == 'application/json' or 'text/plain' | +| `bytes` | `type: string, format: binary` | for "binary" content types, e.g. 'application/octet-stream', 'image/jpeg' | +| `boolean` | `type: boolean` | | +| `plainDate` | `type: string, format: date` | | +| `utcDateTime` | `type: string, format: date-time` | RFC 3339 date in coordinated universal time (UTC) | +| `offsetDateTime` | `type: string, format: date-time` | RFC 3339 date with timezone offset | + +[See encoding and format](#encoding-and-formats) for other way to encode those types. + +There are a variety of decorators that can modify or add metadata to the definitions produced in the generated OpenAPI. + +For a numeric element (integer or float): + +| Decorator | Library | OpenAPI/JSON Schema keyword | Notes | +| ------------------ | -------- | --------------------------- | ----- | +| `@minValue(value)` | built-in | `minimum: value` | | +| `@maxValue(value)` | built-in | `maximum: value` | | + +For any element defined as a `string` or a type that extends from `string`: + +| Decorator | Library | OpenAPI/JSON Schema keyword | Notes | +| ------------------- | -------- | --------------------------- | ---------------------------------------------------------- | +| `@format(name)` | built-in | `format: name` | When format is not determined by type or another decorator | +| `@minLength(value)` | built-in | `minLength: value` | | +| `@maxLength(value)` | built-in | `maxLength: value` | | +| `@pattern(regex)` | built-in | `pattern: regex` | | +| `@secret` | built-in | `format: password` | | + +For an array type: + +| Decorator | Library | OpenAPI/JSON Schema keyword | Notes | +| ------------------ | -------- | --------------------------- | ----- | +| `@minItems(value)` | built-in | `minItems: value` | | +| `@maxItems(value)` | built-in | `maxItems: value` | | + +The OpenAPI emitter provides an [`@useRef` decorator](../openapi/reference/decorators.md#@OpenAPI.useref) which will replace the TypeSpec model type in emitter output +with a reference to a pre-existing named OpenAPI schema. This can be useful for "common" schemas. + +Example: + +```typespec +@useRef("common.json#/components/schemas/Sku") +model Sku { +... +} +``` + +Enums can be defined in TypeSpec with the [`enum` statement](../../language-basics/enums.md), e.g.: + +```typespec +enum Color { + Red: "red", + Blue: "blue", + Green: "green", +} +``` + +The union operator can also be used to define the enum values inline, e.g.: + +```typespec +status: "Running" | "Stopped" | "Failed" +``` + +The OpenAPI emitter converts both of these into a schema definition containing an "enum" with the list of defined values. + +### Model composition + +TypeSpec has several mechanisms for model composition and extension. The following describes how these are handled in the OpenAPI emitter. + +#### Spread + +The spread operator does not convey any semantic relationship between the source and target models so the OpenAPI emitter +treats this as if the properties of the source model were explicitly included in the target model at the position where the +spread appears. + +#### Extends + +When one model extends another model, this is intended to convey and inheritance relationship. While OpenAPI has no formal +construct for inheritance, the OpenAPI emitter represents this form of composition with an `allOf` in the schema of the child model +that references the schema for the parent model. + +##### Extends with discriminator + +The OpenAPI emitter supports the `@discriminator(propertyName)` decorator on a `model`. This will produce a `discriminator` object +with the named property in the schema for this model. + +Models that extend this model must define this property with a literal string value, and these values must be distinct across all the +models that extend this model. These values are used to construct a `mapping` for the discriminator. + +The `@discriminator` decorator can be used to create multi-level discriminated inheritance but must use a different discriminated property at each level. + +#### Is + +The `is` keyword provides a form of composition similar to the spread operator, where no semantic relationship is conveyed between +the source and target models. The OpenAPI emitter represents this form of composition with an independent schema that contains +all the same properties as the model named by the `is` keyword, plus any properties defined directly on the model. + +#### Union + +Unions are another form of model composition. + +Unions can be defined in two different ways in TypeSpec. One way is with +[the union type operator](../../language-basics/unions.md#union-expressions), `|`: + +```typespec +alias GoodBreed = Beagle | GermanShepherd | GoldenRetriever; +``` + +The second way is with [the `union` statement](../../language-basics/unions.md#named-unions) +which not only declares the variant models but also assigns a name for each. + +```typespec +union GoodBreed { + beagle: Beagle, + shepherd: GermanShepherd, + retriever: GoldenRetriever, +} +``` + +The OpenAPI emitter represents either form of union with an `anyOf` with an element for each option of the union. +The OpenAPI emitter ignores the "names" for variants in named unions. + +The OpenAPI emitter also defines the[`@oneOf` decorator](../openapi/reference/decorators.md#OpenAPI.oneof) which can be specified on a `union` statement to indicate +that a union should be emitted as a `oneOf` rather than `anyOf`. + +## Encoding and formats + +When working with the `@encode` decorator the rule is as follow. Given the 3 values `encoding`, `encodeAs` and `realType` where `@encode(encoding, encodeAs) _: realType`: + +1. If `realType` is `utcDateTime` or `offsetDateTime`: + - `encoding` of `rfc3339` will produce `type: string, format: date-time` + - `encoding` of `rfc7231` will produce `type: string, format: http-date` +1. If `realType` is `utcDateTime` and `encoding` is `unixTimestamp`: + - `encodeAs` of any integer type will produce `type: integer, format: unixtime` +1. If the schema of encodeAs produces a `format` use it (e.g. encoding as `int32` will produce an `type: integer, format: integer` ) +1. Otherwise use the `encoding` as the format + +**Summary table** + +| encoding | Openapi3 | Swagger 2.0 (autorest) | +| ------------------------------------------------ | --------------------------------- | --------------------------------- | +| `@encode("seconds", int32) _: duration` | `type: integer, format: int32` | `type: integer, format: int32` | +| `@encode("seconds", float32) _: duration` | `type: number, format: float32` | `type: number, format: float32` | +| `@encode("ISO8601") _: duration` | `type: number, format: duration` | `type: number, format: duration` | +| `@encode("unixTimestamp", int32) _: utcDateTime` | `type: integer, format: unixtime` | `type: integer, format: unixtime` | +| `@encode("unixTimestamp", int64) _: utcDateTime` | `type: integer, format: unixtime` | `type: integer, format: unixtime` | +| `@encode("rfc3339") _: utcDateTime` | `type: string, format: date-time` | `type: string, format: date-time` | +| `@encode("rfc7231") _: utcDateTime` | `type: string, format: http-date` | `type: string, format: http-date` | +| `@encode("http-date") _: utcDateTime` | `type: string, format: http-date` | `type: string, format: http-date` | + +## Security Definitions + +The OpenAPI emitter takes the [(http) `@useAuth` decorator](../rest/reference/decorators.md#@TypeSpec.Http.useauth) + +### Examples + +The following example shows how to define a security scheme for Azure Active Directory authentication: + +```typespec +@useAuth(AADToken) +namespace Contoso.WidgetManager; +@doc("The Azure Active Directory OAuth2 Flow") +model AADToken + is OAuth2Auth<[ + { + type: OAuth2FlowType.authorizationCode; + authorizationUrl: "https://api.example.com/oauth2/authorize"; + tokenUrl: "https://api.example.com/oauth2/token"; + scopes: ["https://management.azure.com/read", "https://management.azure.com/write"]; + } + ]>; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/decorators.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/decorators.md new file mode 100644 index 0000000000..eefd6469cc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/decorators.md @@ -0,0 +1,43 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.OpenAPI + +### `@oneOf` {#@TypeSpec.OpenAPI.oneOf} + +Specify that `oneOf` should be used instead of `anyOf` for that union. + +```typespec +@TypeSpec.OpenAPI.oneOf +``` + +#### Target + +`union Union | ModelProperty` + +#### Parameters + +None + +### `@useRef` {#@TypeSpec.OpenAPI.useRef} + +Specify an external reference that should be used inside of emitting this type. + +```typespec +@TypeSpec.OpenAPI.useRef(ref: valueof string) +``` + +#### Target + +`union Model | ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ---- | ----------------------- | -------------------------------------------------------------------- | +| ref | `valueof scalar string` | External reference(e.g. "../../common.json#/components/schemas/Foo") | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/emitter.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/emitter.md new file mode 100644 index 0000000000..bd89797990 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/emitter.md @@ -0,0 +1,83 @@ +--- +title: "Emitter usage" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Emitter + +## Usage + +1. Via the command line + +```bash +tsp compile . --emit=@typespec/openapi3 +``` + +2. Via the config + +```yaml +emit: + - "@typespec/openapi3" +``` + +## Emitter options + +### `file-type` + +**Type:** `"yaml" | "json"` + +If the content should be serialized as YAML or JSON. Default 'yaml', it not specified infer from the `output-file` extension + +### `output-file` + +**Type:** `string` + +Name of the output file. +Output file will interpolate the following values: + +- service-name: Name of the service if multiple +- version: Version of the service if multiple + +Default: `{service-name}.{version}.openapi.yaml` or `.json` if `file-type` is `"json"` + +Example Single service no versioning + +- `openapi.yaml` + +Example Multiple services no versioning + +- `openapi.Org1.Service1.yaml` +- `openapi.Org1.Service2.yaml` + +Example Single service with versioning + +- `openapi.v1.yaml` +- `openapi.v2.yaml` + +Example Multiple service with versioning + +- `openapi.Org1.Service1.v1.yaml` +- `openapi.Org1.Service1.v2.yaml` +- `openapi.Org1.Service2.v1.0.yaml` +- `openapi.Org1.Service2.v1.1.yaml` + +### `new-line` + +**Type:** `"crlf" | "lf"` + +Set the newline character for emitting files. + +### `omit-unreachable-types` + +**Type:** `boolean` + +Omit unreachable types. +By default all types declared under the service namespace will be included. With this flag on only types references in an operation will be emitted. + +### `include-x-typespec-name` + +**Type:** `"inline-only" | "never"` + +If the generated openapi types should have the `x-typespec-name` extension set with the name of the TypeSpec type that created it. +This extension is meant for debugging and should not be depended on. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/index.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/index.md new file mode 100644 index 0000000000..712b79d863 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/index.md @@ -0,0 +1,43 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec library for emitting OpenAPI 3.0 from the TypeSpec REST protocol binding + +## Install + + + + +```bash +npm install @typespec/openapi3 +``` + + + + +```bash +npm install --save-peer @typespec/openapi3 +``` + + + + +## Emitter usage + +[See documentation](./emitter.md) + +## TypeSpec.OpenAPI + +### Decorators + +- [`@oneOf`](./decorators.md#@TypeSpec.OpenAPI.oneOf) +- [`@useRef`](./decorators.md#@TypeSpec.OpenAPI.useRef) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/$onEmit.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/$onEmit.md new file mode 100644 index 0000000000..50fae6e43c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/$onEmit.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] $onEmit" + +--- +```ts +$onEmit(context): Promise +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `EmitContext`<`OpenAPI3EmitterOptions`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/$oneOf.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/$oneOf.md new file mode 100644 index 0000000000..459a442ef7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/$oneOf.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $oneOf" + +--- +```ts +$oneOf(context, entity): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `ModelProperty` \| `Union` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/$useRef.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/$useRef.md new file mode 100644 index 0000000000..7529f0ea27 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/$useRef.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $useRef" + +--- +```ts +$useRef( + context, + entity, + refUrl): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` \| `ModelProperty` | +| `refUrl` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/getOneOf.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/getOneOf.md new file mode 100644 index 0000000000..81127ca863 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/getOneOf.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getOneOf" + +--- +```ts +getOneOf(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/getRef.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/getRef.md new file mode 100644 index 0000000000..9a9b91c704 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/getRef.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getRef" + +--- +```ts +getRef(program, entity): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/resolveOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/resolveOptions.md new file mode 100644 index 0000000000..9f16f99c4d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/functions/resolveOptions.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] resolveOptions" + +--- +```ts +resolveOptions(context): ResolvedOpenAPI3EmitterOptions +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `EmitContext`<`OpenAPI3EmitterOptions`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/index.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/index.md new file mode 100644 index 0000000000..19aca6efba --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/index.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Interfaces + +- [ResolvedOpenAPI3EmitterOptions](interfaces/ResolvedOpenAPI3EmitterOptions.md) + +### Variables + +- [$lib](variables/$lib.md) +- [namespace](variables/namespace.md) + +### Functions + +- [$onEmit](functions/$onEmit.md) +- [$oneOf](functions/$oneOf.md) +- [$useRef](functions/$useRef.md) +- [getOneOf](functions/getOneOf.md) +- [getRef](functions/getRef.md) +- [resolveOptions](functions/resolveOptions.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/interfaces/ResolvedOpenAPI3EmitterOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/interfaces/ResolvedOpenAPI3EmitterOptions.md new file mode 100644 index 0000000000..7f745c8b1d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/interfaces/ResolvedOpenAPI3EmitterOptions.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] ResolvedOpenAPI3EmitterOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `fileType` | `FileType` | - | +| `includeXTypeSpecName` | `"never"` \| `"inline-only"` | - | +| `newLine` | `NewLine` | - | +| `omitUnreachableTypes` | `boolean` | - | +| `outputFile` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/variables/$lib.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/variables/$lib.md new file mode 100644 index 0000000000..85fb7e0518 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/variables/$lib.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] $lib" + +--- +```ts +const $lib: TypeSpecLibrary; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..b13059d83c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/openapi3/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.OpenAPI" = "TypeSpec.OpenAPI"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/projected-names.md b/packages/website-astro/src/content/docs/latest/standard-library/projected-names.md new file mode 100644 index 0000000000..a97d31a3a4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/projected-names.md @@ -0,0 +1,142 @@ +--- +id: projected-names +title: Projected names +--- + +# Projected Names + +There is some cases where the name you have in TypeSpec might differ from the name over the wire or for a certain language. + +## Known targets + +List of known targets. + +- Wire: + - `json`: Configure JSON representation of data + - `xml`: Configure XML representation of data +- Language: + - `csharp`: Configure C# generated code + - `java`: Configure Java generated code + - `python`: Configure python generated code + - `javascript`: Configure javascript generated code + - `swift` : Configure swift generated code + - `c` : Configure C generated code +- Type: + - `client`: Configure output for the client + - `server`: Configure output for the server + +## Update name for a given target + +### With decorator + +To update the name of a TypeSpec entity you can use the `@projectedName` decorator. This decorator takes 2 parameters: + +- `string` target name. See [known targets](#known-targets) +- `string` projected name. Whatever the name should be in the given target. + +Example: + +```typespec +model Foo { + // Specify that when serializing to JSON `expireAt` property should be named `exp` + @projectedName("json", "exp") + expireAt: string; +} +``` + +### With projection + +The decorator is just a syntax sugar for the `target` projection behind the scenes. In more complex cases you might want to just implement the projection manually. + +```typespec +model Foo { + expireAt: string; +} + +projection Foo#target { + to(targetName) { + if targetName == "json" { + self::rename("exp"); + }; + } +} +``` + +## Example + +```typespec +model CertificateAttributes { + @projectedName("json", "nbf") + @projectedName("csharp", "ValidAfter") + notBefore: int32; + + @projectedName("json", "exp") + expires: int32; + + @projectedName("client", "createdAt") + created: int32; + + updated: int32; +} +``` + + + + + + + + + + + + + + + + + + + + +
JsonTypescriptCSharp
When serialized to Json property use the json projected nameTypescript didn't provide any projected name so it keep the model as it is.Model uses the `csharp` projected names and keeps the reference to the JSON name in JsonProperty
+ +```json +{ + "nbf": 1430344421, + "exp": 2208988799, + "created": 1493938289, + "updated": 1493938291 +} +``` + + + +```ts +interface Attributes { + notBefore: number; + expires: number; + createdAt: number; + updated: number; +} +``` + + + +```cs +class CertificateAttributes +{ + [JsonProperty("nbf")] + public int ValidAfter {get; set;} + + [JsonProperty("exp")] + public int Expires {get; set;} + + [JsonProperty("created")] + public int CreatedAt {get; set;} + + public int Updated {get; set;} +} +``` + +
diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/guide.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/guide.md new file mode 100644 index 0000000000..daf6e4eda7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/guide.md @@ -0,0 +1,176 @@ +--- +title: Guide +--- + +# The Protobuf Emitter guide + +TypeSpec provides an emitter (`@typespec/protobuf`) that generates Protocol Buffers specifications from TypeSpec sources as part of its standard library. The resulting Protobuf files may be used as inputs for creating gRPC services or any other tools compatible with Protocol Buffers. + +**Note**: The Protobuf emitter uses Protocol Buffers 3 (proto3) syntax. Your workflow (`protoc` version, etc.) must support proto3 to utilize this emitter. + +## Core concepts + +The Protobuf emitter enables you to write TypeSpec and convert it into equivalent Protocol Buffers for use with Protobuf-enabled systems (such as gRPC). Your TypeSpec models and interfaces must adhere to certain requirements and restrictions in order for the emitter to convert them to Protobuf. + +### Packages + +A protobuf package is defined by the [`TypeSpec.Protobuf.package` decorator][protobuf-package], which applies to a TypeSpec namespace. A package essentially defines a `.proto` file, and everything within the decorated namespace will be emitted to a single file. + +The following TypeSpec namespace results in a Protobuf file named `main.proto` that contains the contents of the `Test` namespace converted into Protobuf. + +```typespec +@package +namespace Test { +// ... + +} +``` + +Package names may be provided using the optional `PackageDetails` argument to the `@package` decorator. The following TypeSpec namespace will result in a file `com/example/test.proto` that has the line `package com.example.test;` within it: + +```typespec +@package({ + name: "com.example.test", +}) +namespace Test { +// ... + +} +``` + +TypeSpec objects (models, enums, etc.) are converted to Protobuf declarations within their nearest ancestor that has a package annotation. As a result, unlike in Protobuf, TypeSpec declarations of packages may be nested arbitrarily.p + +### Messages + +TypeSpec models are converted into Protobuf messages. The following TypeSpec model: + +```typespec +model TestMessage { + @field(1) n: int32; +} +``` + +will be converted into the following Protobuf message: + +```proto3 +message TestMessage { + int32 n = 1; +} +``` + +Models are converted into messages and included in the Protobuf file if any of the following conditions are met: + +- The model is explicitly annotated with the [`TypeSpec.Protobuf.message` decorator][protobuf-message]. +- The model is referenced by any service operation (see [Services](#services) below). +- The model is a direct child of a [package namespace](#packages) and has _every_ field annotated with the [`TypeSpec.Protobuf.field` decorator][protobuf-field]. + +#### Field indices + +Protobuf requires that the offset of each field within a Protobuf message be manually specified. In TypeSpec, the field indices are specified using the [`TypeSpec.Protobuf.field` decorator][protobuf-field]. All fields within a model must have an attached `@field` decorator to be converted into a Protobuf message. + +The following TypeSpec model: + +```typespec +model TestMessage { + @field(1) n: int32; +} +``` + +will be converted into the following Protobuf message: + +```proto3 +message TestMessage { + int32 n = 1; +} +``` + +### Services + +TypeSpec has a concept of a "service" defined by the [`TypeSpec.service` decorator][native-service], but the Protobuf concept of a "service" is different and is indicated by the [`TypeSpec.Protobuf.service` decorator][protobuf-service]. + +When using the Protobuf emitter, a Protobuf service designation is applied to an _interface_ within a package. For example, the following TypeSpec: + +```typespec +@package +namespace Example { + @Protobuf.service + interface Test { + // ... + } +} +``` + +will yield the following Protobuf file (named `example.proto`): + +```proto3 +syntax = "proto3"; + +package example; + +service Test { + // ... +} +``` + +#### Operations + +Within a [service interface](#services), TypeSpec operations represent Protobuf service methods. Each operation in the service interface is converted into an equivalent Protobuf method declaration. For example, the following specification: + +```typespec +model Input { + @field(1) exampleField: string; +} + +model Output { + @field(1) parsed: uint32; +} + +@Protobuf.service +interface Example { + testOperation(...Input): Output; +} +``` + +Results in the following `.proto` file: + +```proto3 +message Input { + string exampleField = 1; +} + +message Output { + uint32 parsed = 1; +} + +service Example { + rpc TestOperation(Input) returns (Output); +} +``` + +#### Streams + +The Protobuf emitter supports declaring the streaming mode of an operation using the [`TypeSpec.Protobuf.stream` decorator][protobuf-stream]. The streaming mode is specified using the [`StreamMode`][protobuf-stream-mode] enum. An operation can have one of four streaming modes: + +- `None`: this is the default mode and indicates that neither the request nor response are streamed. + + Example: `rpc Example(In) returns (Out);` + +- `In`: indicates that the request is streamed, but the response is received synchronously. + + Example: `rpc Example(stream In) returns (Out);` + +- `Out`: indicates that the request is sent synchronously, but the response is streamed. + + Example: `rpc Example(In) returns (stream Out);` + +- `Duplex`: indicates that both the request and response are streamed. + + Example: `rpc Example(stream In) returns (stream Out);` + +[native-service]: ../built-in-decorators#service +[protobuf-service]: reference/decorators#@TypeSpec.Protobuf.service +[protobuf-package]: reference/decorators#@TypeSpec.Protobuf.package +[protobuf-field]: reference/decorators#@TypeSpec.Protobuf.field +[protobuf-stream]: reference/decorators#@TypeSpec.Protobuf.stream +[protobuf-stream-mode]: reference/data-types#TypeSpec.Protobuf.StreamMode +[protobuf-message]: reference/decorators#@TypeSpec.Protobuf.message diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/data-types.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/data-types.md new file mode 100644 index 0000000000..a354895162 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/data-types.md @@ -0,0 +1,197 @@ +--- +title: "Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Data types + +## TypeSpec.Protobuf + +### `Extern` {#TypeSpec.Protobuf.Extern} + +A model that represents an external Protobuf reference. This type can be used to import and utilize Protobuf +declarations that are not declared in TypeSpec within TypeSpec sources. When the emitter encounters an `Extern`, it +will insert an `import` statement for the corresponding `Path` and refer to the type by `Name`. + +#### Usage + +If you have a file called `test.proto` that declares a package named `test` and a message named `Widget`, you can +use the `Extern` type to declare a model in TypeSpec that refers to your external definition of `test.Widget`. See +the example below. + +When the TypeSpec definition of `Widget` is encountered, the Protobuf emitter will represent it as a reference to +`test.Widget` and insert an import for it, rather than attempt to convert the model to an equivalent message. + +```typespec +model TypeSpec.Protobuf.Extern +``` + +#### Template Parameters + +| Name | Description | +| ---- | ---------------------------------------------------------------------------------------- | +| Path | the relative path to a `.proto` file to import | +| Name | the fully-qualified reference to the type this model represents within the `.proto` file | + +#### Examples + +```typespec +model Widget is Extern<"path/to/test.proto", "test.Widget">; +``` + +### `Map` {#TypeSpec.Protobuf.Map} + +A type representing a Protobuf `map`. Instances of this type in models will be converted to the built-in `map` type +in Protobuf. + +The key type of a Protobuf `map` must be any integral type or `string`. The value type can be any type other than +another `Map`. + +```typespec +model TypeSpec.Protobuf.Map +``` + +#### Template Parameters + +| Name | Description | +| ---- | ------------------------------------------------ | +| K | the key type (any integral type or string) | +| V | the value type (any type other than another map) | + +### `PackageDetails` {#TypeSpec.Protobuf.PackageDetails} + +Details applied to a package definition by the [`@package`](./decorators# + +```typespec +model TypeSpec.Protobuf.PackageDetails +``` + +### `StreamMode` {#TypeSpec.Protobuf.StreamMode} + +The streaming mode of an operation. One of: + +- `Duplex`: both the input and output of the operation are streaming. +- `In`: the input of the operation is streaming. +- `Out`: the output of the operation is streaming. +- `None`: neither the input nor the output are streaming. + +See the [`@stream`](./decorators# + +```typespec +enum TypeSpec.Protobuf.StreamMode +``` + +### `fixed32` {#TypeSpec.Protobuf.fixed32} + +An unsigned 32-bit integer that will use the `fixed32` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Always four bytes. More efficient than `uint32` if values are often greater than 228. + +```typespec +scalar TypeSpec.Protobuf.fixed32 +``` + +### `fixed64` {#TypeSpec.Protobuf.fixed64} + +An unsigned 64-bit integer that will use the `fixed64` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Always eight bytes. More efficient than `uint64` if values are often greater than 256. + +```typespec +scalar TypeSpec.Protobuf.fixed64 +``` + +### `sfixed32` {#TypeSpec.Protobuf.sfixed32} + +A signed 32-bit integer that will use the `sfixed32` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Always four bytes. + +```typespec +scalar TypeSpec.Protobuf.sfixed32 +``` + +### `sfixed64` {#TypeSpec.Protobuf.sfixed64} + +A signed 64-bit integer that will use the `sfixed64` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Always eight bytes. + +```typespec +scalar TypeSpec.Protobuf.sfixed64 +``` + +### `sint32` {#TypeSpec.Protobuf.sint32} + +A signed 32-bit integer that will use the `sint32` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Uses variable-length encoding. These more efficiently encode negative numbers than regular int32s. + +```typespec +scalar TypeSpec.Protobuf.sint32 +``` + +### `sint64` {#TypeSpec.Protobuf.sint64} + +A signed 64-bit integer that will use the `sint64` encoding when used in a Protobuf message. + +#### Protobuf binary format + +Uses variable-length encoding. These more efficiently encode negative numbers than regular `int64s`. + +```typespec +scalar TypeSpec.Protobuf.sint64 +``` + +## TypeSpec.Protobuf.WellKnown + +### `Any` {#TypeSpec.Protobuf.WellKnown.Any} + +Any value. + +This model references `google.protobuf.Any` from `google/protobuf/any.proto`. + +```typespec +model TypeSpec.Protobuf.WellKnown.Any +``` + +### `Empty` {#TypeSpec.Protobuf.WellKnown.Empty} + +An empty message. + +This model references `google.protobuf.Empty` from `google/protobuf/empty.proto`. + +```typespec +model TypeSpec.Protobuf.WellKnown.Empty +``` + +### `LatLng` {#TypeSpec.Protobuf.WellKnown.LatLng} + +A latitude and longitude. + +This model references `google.type.LatLng` from `google/type/latlng.proto`. + +```typespec +model TypeSpec.Protobuf.WellKnown.LatLng +``` + +### `Timestamp` {#TypeSpec.Protobuf.WellKnown.Timestamp} + +A timestamp. + +This model references `google.protobuf.Timestamp` from `google/protobuf/timestamp.proto`. + +```typespec +model TypeSpec.Protobuf.WellKnown.Timestamp +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/decorators.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/decorators.md new file mode 100644 index 0000000000..7ec642c0fe --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/decorators.md @@ -0,0 +1,179 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.Protobuf + +### `@field` {#@TypeSpec.Protobuf.field} + +Defines the field index of a model property for conversion to a Protobuf +message. + +The field index of a Protobuf message must: + +- fall between 1 and 229 - 1, inclusive. +- not fall within the implementation reserved range of 19000 to 19999, inclusive. +- not fall within any range that was [marked reserved](# + +```typespec +@TypeSpec.Protobuf.field(index: valueof uint32) +``` + +#### Target + +`ModelProperty` + +#### Parameters + +| Name | Type | Description | +| ----- | ----------------------- | ------------------------------------ | +| index | `valueof scalar uint32` | The whole-number index of the field. | + +#### Examples + +```typespec +model ExampleMessage { + @field(1) + test: string; +} +``` + +### `@message` {#@TypeSpec.Protobuf.message} + +Declares that a model is a Protobuf message. + +Messages can be detected automatically if either of the following two conditions are met: + +- The model has a `@field` annotation on all of its properties. +- The model is referenced by any service operation. + +This decorator will force the emitter to check and emit a model. + +```typespec +@TypeSpec.Protobuf.message +``` + +#### Target + +`model {}` + +#### Parameters + +None + +### `@package` {#@TypeSpec.Protobuf.package} + +Declares that a TypeSpec namespace constitutes a Protobuf package. The contents of the namespace will be emitted to a +single Protobuf file. + +```typespec +@TypeSpec.Protobuf.package(details?: TypeSpec.Protobuf.PackageDetails) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| ------- | ---------------------------------------- | ----------------------------------- | +| details | `model TypeSpec.Protobuf.PackageDetails` | the optional details of the package | + +### `@reserve` {#@TypeSpec.Protobuf.reserve} + +Reserve a field index, range, or name. If a field definition collides with a reservation, the emitter will produce +an error. + +This decorator accepts multiple reservations. Each reservation is one of the following: + +- a `string`, in which case the reservation refers to a field name. +- a `uint32`, in which case the reservation refers to a field index. +- a tuple `[uint32, uint32]`, in which case the reservation refers to a field range that is _inclusive_ of both ends. + +Unlike in Protobuf, where field name and index reservations must be separated, you can mix string and numeric field +reservations in a single `@reserve` call in TypeSpec. + +#### API Compatibility Note + +Field reservations prevent users of your Protobuf specification from using the given field names or indices. This can +be useful if a field is removed, as it will further prevent adding a new, incompatible field and will prevent users +from utilizing the field index at runtime in a way that may break compatibility with users of older specifications. + +See _[Protobuf Language Guide - Reserved Fields](https://protobuf.dev/programming-guides/proto3/#reserved)_ for more +information. + +```typespec +@TypeSpec.Protobuf.reserve(...reservations: valueof string | [uint32, uint32] | uint32[]) +``` + +#### Target + +`model {}` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------------------------------------------------------ | ---------------------------- | +| reservations | `valueof model string \| [uint32, uint32] \| uint32[]` | a list of field reservations | + +#### Examples + +```typespec +// Reserve the fields 8-15 inclusive, 100, and the field name "test" within a model. +@reserve([8, 15], 100, "test") +model Example { + // ... +} +``` + +### `@service` {#@TypeSpec.Protobuf.service} + +Declares that a TypeSpec interface constitutes a Protobuf service. The contents of the interface will be converted to +a `service` declaration in the resulting Protobuf file. + +```typespec +@TypeSpec.Protobuf.service +``` + +#### Target + +`Interface` + +#### Parameters + +None + +### `@stream` {#@TypeSpec.Protobuf.stream} + +Set the streaming mode of an operation. See [StreamMode](./data-types#TypeSpec.Protobuf.StreamMode) for more information. + +```typespec +@TypeSpec.Protobuf.stream(mode: TypeSpec.Protobuf.StreamMode) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ---- | ----------------------------------- | ---------------------------------------------- | +| mode | `enum TypeSpec.Protobuf.StreamMode` | The streaming mode to apply to this operation. | + +#### Examples + +```typespec +@stream(StreamMode.Out) +op logs(...LogsRequest): LogEvent; +``` + +```typespec +@stream(StreamMode.Duplex) +op connectToMessageService(...Message): Message; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/emitter.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/emitter.md new file mode 100644 index 0000000000..22e256a81b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/emitter.md @@ -0,0 +1,36 @@ +--- +title: "Emitter usage" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Emitter + +## Usage + +1. Via the command line + +```bash +tsp compile . --emit=@typespec/protobuf +``` + +2. Via the config + +```yaml +emit: + - "@typespec/protobuf" +``` + +## Emitter options + +### `noEmit` + +**Type:** `boolean` + +If set to `true`, this emitter will not write any files. It will still validate the TypeSpec sources to ensure they are compatible with Protobuf, but the files will simply not be written to the output directory. + +### `omit-unreachable-types` + +**Type:** `boolean` + +By default, the emitter will create `message` declarations for any models in a namespace decorated with `@package` that have an `@field` decorator on every property. If this option is set to true, this behavior will be disabled, and only messages that are explicitly decorated with `@message` or that are reachable from a service operation will be emitted. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/index.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/index.md new file mode 100644 index 0000000000..3914200c66 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/index.md @@ -0,0 +1,62 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec library and emitter for Protobuf (gRPC) + +## Install + + + + +```bash +npm install @typespec/protobuf +``` + + + + +```bash +npm install --save-peer @typespec/protobuf +``` + + + + +## Emitter usage + +[See documentation](./emitter.md) + +## TypeSpec.Protobuf + +### Decorators + +- [`@field`](./decorators.md#@TypeSpec.Protobuf.field) +- [`@message`](./decorators.md#@TypeSpec.Protobuf.message) +- [`@package`](./decorators.md#@TypeSpec.Protobuf.package) +- [`@reserve`](./decorators.md#@TypeSpec.Protobuf.reserve) +- [`@service`](./decorators.md#@TypeSpec.Protobuf.service) +- [`@stream`](./decorators.md#@TypeSpec.Protobuf.stream) + +### Models + +- [`Extern`](./data-types.md#TypeSpec.Protobuf.Extern) +- [`Map`](./data-types.md#TypeSpec.Protobuf.Map) +- [`PackageDetails`](./data-types.md#TypeSpec.Protobuf.PackageDetails) + +## TypeSpec.Protobuf.WellKnown + +### Models + +- [`Any`](./data-types.md#TypeSpec.Protobuf.WellKnown.Any) +- [`Empty`](./data-types.md#TypeSpec.Protobuf.WellKnown.Empty) +- [`LatLng`](./data-types.md#TypeSpec.Protobuf.WellKnown.LatLng) +- [`Timestamp`](./data-types.md#TypeSpec.Protobuf.WellKnown.Timestamp) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$externRef.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$externRef.md new file mode 100644 index 0000000000..fa39273374 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$externRef.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $externRef" + +--- +```ts +$externRef( + ctx, + target, + path, + name): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `ctx` | `DecoratorContext` | +| `target` | `Model` | +| `path` | `StringLiteral` | +| `name` | `StringLiteral` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$field.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$field.md new file mode 100644 index 0000000000..bc746fcc8c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$field.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] $field" + +--- +```ts +$field( + ctx, + target, + fieldIndex): void +``` + +Decorate a model property with a field index. Field indices are required for all fields of emitted messages. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `ctx` | `DecoratorContext` | - | +| `target` | `ModelProperty` | | +| `fieldIndex` | `number` | | + +## Returns diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$message.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$message.md new file mode 100644 index 0000000000..e5c6e41724 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$message.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $message" + +--- +```ts +$message(ctx, target): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `ctx` | `DecoratorContext` | +| `target` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$onEmit.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$onEmit.md new file mode 100644 index 0000000000..01e6dc7191 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$onEmit.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] $onEmit" + +--- +```ts +$onEmit(ctx): Promise +``` + +Emitter main function. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `ctx` | `EmitContext`<`ProtobufEmitterOptions`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$onValidate.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$onValidate.md new file mode 100644 index 0000000000..cc74dab946 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$onValidate.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] $onValidate" + +--- +```ts +$onValidate(program): Promise +``` + +Validation function + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$package.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$package.md new file mode 100644 index 0000000000..d9f5e7864f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$package.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $package" + +--- +```ts +$package( + ctx, + target, + details?): void +``` + +Declare a Protobuf package. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `ctx` | `DecoratorContext` | decorator context | +| `target` | `Namespace` | target decorator namespace | +| `details`? | `Model` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$reserve.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$reserve.md new file mode 100644 index 0000000000..0a12d36415 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$reserve.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $reserve" + +--- +```ts +$reserve( + ctx, + target, ... + reservations): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `ctx` | `DecoratorContext` | +| `target` | `Model` | +| ...`reservations` | readonly (`string` \| `number` \| `Type`)[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$service.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$service.md new file mode 100644 index 0000000000..7875c0597a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$service.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] $service" + +--- +```ts +$service(ctx, target): void +``` + +Decorate an interface as a service, indicating that it represents a Protobuf `service` declaration. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `ctx` | `DecoratorContext` | decorator context | +| `target` | `Interface` | the decorated interface | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$stream.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$stream.md new file mode 100644 index 0000000000..8daf2a13d1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/$stream.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $stream" + +--- +```ts +$stream( + ctx, + target, + mode): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `ctx` | `DecoratorContext` | +| `target` | `Operation` | +| `mode` | `EnumMember` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/isMap.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/isMap.md new file mode 100644 index 0000000000..500f6c2fe9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/functions/isMap.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isMap" + +--- +```ts +isMap(program, m): boolean +``` + +Determines whether a type represents a Protobuf map. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | the program context | +| `m` | `Type` | the type to test | + +## Returns + +true if the internal representation of a Protobuf map is bound to this type. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/index.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/index.md new file mode 100644 index 0000000000..2e166c36ae --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/index.md @@ -0,0 +1,33 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Interfaces + +- [PackageDetails](interfaces/PackageDetails.md) + +### Type Aliases + +- [Reservation](type-aliases/Reservation.md) + +### Variables + +- [$lib](variables/$lib.md) +- [PROTO\_FULL\_IDENT](variables/PROTO_FULL_IDENT.md) +- [namespace](variables/namespace.md) + +### Functions + +- [$externRef](functions/$externRef.md) +- [$field](functions/$field.md) +- [$message](functions/$message.md) +- [$onEmit](functions/$onEmit.md) +- [$onValidate](functions/$onValidate.md) +- [$package](functions/$package.md) +- [$reserve](functions/$reserve.md) +- [$service](functions/$service.md) +- [$stream](functions/$stream.md) +- [isMap](functions/isMap.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/interfaces/PackageDetails.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/interfaces/PackageDetails.md new file mode 100644 index 0000000000..1495e8a304 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/interfaces/PackageDetails.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] PackageDetails" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `name?` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/type-aliases/Reservation.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/type-aliases/Reservation.md new file mode 100644 index 0000000000..22298fc322 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/type-aliases/Reservation.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] Reservation" + +--- +```ts +type Reservation: string | number | [number, number] & object; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/variables/$lib.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/variables/$lib.md new file mode 100644 index 0000000000..d0b3766f7d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/variables/$lib.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] $lib" + +--- +```ts +const $lib: TypeSpecLibrary = TypeSpecProtobufLibrary; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/variables/PROTO_FULL_IDENT.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/variables/PROTO_FULL_IDENT.md new file mode 100644 index 0000000000..99c17b6e90 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/variables/PROTO_FULL_IDENT.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[V] PROTO_FULL_IDENT" + +--- +```ts +const PROTO_FULL_IDENT: RegExp; +``` + +Defined in the [ProtoBuf Language Spec](https://developers.google.com/protocol-buffers/docs/reference/proto3-spec#identifiers). + +ident = letter { letter | decimalDigit | "_" } +fullIdent = ident { "." ident } diff --git a/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..767743f38d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/protobuf/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.Protobuf" = "TypeSpec.Protobuf"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/DuplicateTracker.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/DuplicateTracker.md new file mode 100644 index 0000000000..a07892d33b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/DuplicateTracker.md @@ -0,0 +1,54 @@ +--- +jsApi: true +title: "[C] DuplicateTracker" + +--- +Helper class to track duplicate instance + +## Type parameters + +| Parameter | +| :------ | +| `K` | +| `V` | + +## Constructors + +### new DuplicateTracker() + +```ts +new DuplicateTracker(): DuplicateTracker +``` + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `private` | `#entries` | `Map`<`K`, `V`[]\> | - | + +## Methods + +### entries() + +```ts +entries(): Iterable<[K, V[]]> +``` + +Return iterator of all the duplicate entries. + +*** + +### track() + +```ts +track(k, v): void +``` + +Track usage of K. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `k` | `K` | key that is being checked for duplicate. | +| `v` | `V` | value that map to the key | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/EventEmitter.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/EventEmitter.md new file mode 100644 index 0000000000..af2e755c59 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/EventEmitter.md @@ -0,0 +1,66 @@ +--- +jsApi: true +title: "[C] EventEmitter" + +--- +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | + +## Constructors + +### new EventEmitter() + +```ts +new EventEmitter(): EventEmitter +``` + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `private` | `listeners` | `Map` `any`[]\> | - | + +## Methods + +### emit() + +```ts +emit(name, ...args): void +``` + +#### Type parameters + +| Parameter | +| :------ | +| `K` extends `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `K` | +| ...`args` | `Parameters`<`T`[`K`]\> | + +*** + +### on() + +```ts +on(name, listener): void +``` + +#### Type parameters + +| Parameter | +| :------ | +| `K` extends `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `K` | +| `listener` | (...`args`) => `any` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/InvalidEncodingError.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/InvalidEncodingError.md new file mode 100644 index 0000000000..6afd92b983 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/InvalidEncodingError.md @@ -0,0 +1,57 @@ +--- +jsApi: true +title: "[C] InvalidEncodingError" + +--- +## Extends + +- `Error` + +## Constructors + +### new InvalidEncodingError(encoding) + +```ts +new InvalidEncodingError(encoding): InvalidEncodingError +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `encoding` | `string` | + +#### Overrides + +Error.constructor + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `public` | `message` | `string` | - | Error.message | +| `public` | `name` | `string` | - | Error.name | +| `public` | `stack?` | `string` | - | Error.stack | +| `static` | `prepareStackTrace?` | (`err`, `stackTraces`) => `any` | - | Error.prepareStackTrace | +| `static` | `stackTraceLimit` | `number` | - | Error.stackTraceLimit | + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void +``` + +Create .stack property on a target object + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `targetObject` | `object` | +| `constructorOpt`? | `Function` | + +#### Inherited from + +Error.captureStackTrace diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/ProjectionError.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/ProjectionError.md new file mode 100644 index 0000000000..d2cb316c72 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/ProjectionError.md @@ -0,0 +1,59 @@ +--- +jsApi: true +title: "[C] ProjectionError" + +--- +Represents a failure while interpreting a projection. + +## Extends + +- `Error` + +## Constructors + +### new ProjectionError(message) + +```ts +new ProjectionError(message): ProjectionError +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | + +#### Overrides + +Error.constructor + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `public` | `message` | `string` | - | Error.message | +| `public` | `name` | `string` | - | Error.name | +| `public` | `stack?` | `string` | - | Error.stack | +| `static` | `prepareStackTrace?` | (`err`, `stackTraces`) => `any` | - | Error.prepareStackTrace | +| `static` | `stackTraceLimit` | `number` | - | Error.stackTraceLimit | + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void +``` + +Create .stack property on a target object + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `targetObject` | `object` | +| `constructorOpt`? | `Function` | + +#### Inherited from + +Error.captureStackTrace diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/Queue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/Queue.md new file mode 100644 index 0000000000..30d0da9ac1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/Queue.md @@ -0,0 +1,61 @@ +--- +jsApi: true +title: "[C] Queue" + +--- +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Constructors + +### new Queue(elements) + +```ts +new Queue(elements?): Queue +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `elements`? | `T`[] | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `private` | `#elements` | `T`[] | - | +| `private` | `#headIndex` | `number` | - | + +## Methods + +### dequeue() + +```ts +dequeue(): T +``` + +*** + +### enqueue() + +```ts +enqueue(...items): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| ...`items` | `T`[] | + +*** + +### isEmpty() + +```ts +isEmpty(): boolean +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/ResolveModuleError.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/ResolveModuleError.md new file mode 100644 index 0000000000..414168ec57 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/classes/ResolveModuleError.md @@ -0,0 +1,59 @@ +--- +jsApi: true +title: "[C] ResolveModuleError" + +--- +## Extends + +- `Error` + +## Constructors + +### new ResolveModuleError(code, message) + +```ts +new ResolveModuleError(code, message): ResolveModuleError +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `ResolveModuleErrorCode` | +| `message` | `string` | + +#### Overrides + +Error.constructor + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `public` | `code` | `ResolveModuleErrorCode` | - | - | +| `public` | `message` | `string` | - | Error.message | +| `public` | `name` | `string` | - | Error.name | +| `public` | `stack?` | `string` | - | Error.stack | +| `static` | `prepareStackTrace?` | (`err`, `stackTraces`) => `any` | - | Error.prepareStackTrace | +| `static` | `stackTraceLimit` | `number` | - | Error.stackTraceLimit | + +## Methods + +### captureStackTrace() + +```ts +static captureStackTrace(targetObject, constructorOpt?): void +``` + +Create .stack property on a target object + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `targetObject` | `object` | +| `constructorOpt`? | `Function` | + +#### Inherited from + +Error.captureStackTrace diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/IdentifierKind.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/IdentifierKind.md new file mode 100644 index 0000000000..5c9ab67b62 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/IdentifierKind.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[E] IdentifierKind" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Declaration` | `4` | +| `Decorator` | `1` | +| `Function` | `2` | +| `Other` | `5` | +| `TypeReference` | `0` | +| `Using` | `3` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/ListenerFlow.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/ListenerFlow.md new file mode 100644 index 0000000000..62fdcb1826 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/ListenerFlow.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[E] ListenerFlow" + +--- +## Enumeration Members + +| Member | Value | Description | +| :------ | :------ | :------ | +| `NoRecursion` | `1` | Do not navigate any containing or referenced type. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/ModifierFlags.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/ModifierFlags.md new file mode 100644 index 0000000000..03ebdab22c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/ModifierFlags.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[E] ModifierFlags" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Extern` | `2` | +| `None` | `0` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/NodeFlags.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/NodeFlags.md new file mode 100644 index 0000000000..614d83eafd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/NodeFlags.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[E] NodeFlags" + +--- +## Enumeration Members + +| Member | Value | Description | +| :------ | :------ | :------ | +| `DescendantErrorsExamined` | `1` | If this is set, the DescendantHasError bit can be trusted. If this not set,
children need to be visited still to see if DescendantHasError should be
set.

Use the parser's `hasParseError` API instead of using this flag directly. | +| `DescendantHasError` | `4` | Indicates that a child of this node (or one of its children,
transitively) has a parse error.

Use the parser's `hasParseError` API instead of using this flag directly. | +| `None` | `0` | - | +| `Synthetic` | `8` | Indicates that a node was created synthetically and therefore may not be parented. | +| `ThisNodeHasError` | `2` | Indicates that a parse error was associated with this specific node.

Use the parser's `hasParseError` API instead of using this flag directly. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/SemanticTokenKind.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/SemanticTokenKind.md new file mode 100644 index 0000000000..16fea7ea07 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/SemanticTokenKind.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[E] SemanticTokenKind" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Class` | `2` | +| `Comment` | `16` | +| `DocCommentTag` | `21` | +| `Enum` | `3` | +| `EnumMember` | `10` | +| `Event` | `11` | +| `Function` | `12` | +| `Interface` | `4` | +| `Keyword` | `15` | +| `Macro` | `14` | +| `Method` | `13` | +| `Namespace` | `0` | +| `Number` | `18` | +| `Operator` | `20` | +| `Parameter` | `7` | +| `Property` | `9` | +| `Regexp` | `19` | +| `String` | `17` | +| `Struct` | `5` | +| `Type` | `1` | +| `TypeParameter` | `6` | +| `Variable` | `8` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/SymbolFlags.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/SymbolFlags.md new file mode 100644 index 0000000000..841114500d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/SymbolFlags.md @@ -0,0 +1,37 @@ +--- +jsApi: true +title: "[E] SymbolFlags" + +--- +## Enumeration Members + +| Member | Value | Description | +| :------ | :------ | :------ | +| `Alias` | `2048` | - | +| `Declaration` | `4194304` | - | +| `Decorator` | `16384` | - | +| `DuplicateUsing` | `1048576` | - | +| `Enum` | `32` | - | +| `EnumMember` | `64` | - | +| `ExportContainer` | `2101248` | - | +| `Function` | `131072` | - | +| `FunctionParameter` | `262144` | - | +| `Implementation` | `8388608` | - | +| `Interface` | `128` | - | +| `InterfaceMember` | `256` | - | +| `LateBound` | `16777216` | A symbol which was late-bound, in which case, the type referred to
by this symbol is stored directly in the symbol. | +| `Member` | `1348` | - | +| `MemberContainer` | `674` | Symbols whose members will be late bound (and stored on the type) | +| `Model` | `2` | - | +| `ModelProperty` | `4` | - | +| `Namespace` | `4096` | - | +| `None` | `0` | - | +| `Operation` | `16` | - | +| `Projection` | `8192` | - | +| `ProjectionParameter` | `65536` | - | +| `Scalar` | `8` | - | +| `SourceFile` | `2097152` | - | +| `TemplateParameter` | `32768` | - | +| `Union` | `512` | - | +| `UnionVariant` | `1024` | - | +| `Using` | `524288` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/SyntaxKind.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/SyntaxKind.md new file mode 100644 index 0000000000..1eb331c93e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/SyntaxKind.md @@ -0,0 +1,97 @@ +--- +jsApi: true +title: "[E] SyntaxKind" + +--- +AST types + +## Enumeration Members + +| Member | Value | Description | +| :------ | :------ | :------ | +| `AliasStatement` | `24` | - | +| `ArrayExpression` | `31` | - | +| `AugmentDecoratorStatement` | `4` | - | +| `BlockComment` | `46` | - | +| `BooleanLiteral` | `34` | - | +| `CadlScript` | `0` | **Deprecated**

Use TypeSpecScript | +| `DecoratorDeclarationStatement` | `25` | - | +| `DecoratorExpression` | `5` | - | +| `DirectiveExpression` | `6` | - | +| `Doc` | `47` | - | +| `DocErrorsTag` | `51` | - | +| `DocParamTag` | `49` | - | +| `DocReturnsTag` | `50` | - | +| `DocTemplateTag` | `52` | - | +| `DocText` | `48` | - | +| `DocUnknownTag` | `53` | - | +| `EmptyStatement` | `43` | - | +| `EnumMember` | `22` | - | +| `EnumSpreadMember` | `23` | - | +| `EnumStatement` | `21` | - | +| `ExternKeyword` | `35` | - | +| `FunctionDeclarationStatement` | `26` | - | +| `FunctionParameter` | `27` | - | +| `Identifier` | `3` | - | +| `ImportStatement` | `2` | - | +| `InterfaceStatement` | `18` | - | +| `IntersectionExpression` | `29` | - | +| `InvalidStatement` | `44` | - | +| `JsNamespaceDeclaration` | `84` | - | +| `JsSourceFile` | `1` | - | +| `LineComment` | `45` | - | +| `MemberExpression` | `7` | - | +| `ModelExpression` | `14` | - | +| `ModelProperty` | `15` | - | +| `ModelSpreadProperty` | `16` | - | +| `ModelStatement` | `13` | - | +| `NamespaceStatement` | `8` | - | +| `NeverKeyword` | `37` | - | +| `NumericLiteral` | `33` | - | +| `OperationSignatureDeclaration` | `11` | - | +| `OperationSignatureReference` | `12` | - | +| `OperationStatement` | `10` | - | +| `Projection` | `54` | - | +| `ProjectionArithmeticExpression` | `72` | - | +| `ProjectionBlockExpression` | `66` | - | +| `ProjectionCallExpression` | `73` | - | +| `ProjectionDecoratorReferenceExpression` | `82` | - | +| `ProjectionEnumMemberSelector` | `63` | - | +| `ProjectionEnumSelector` | `62` | - | +| `ProjectionEqualityExpression` | `69` | - | +| `ProjectionExpressionStatement` | `64` | - | +| `ProjectionIfExpression` | `65` | - | +| `ProjectionInterfaceSelector` | `61` | - | +| `ProjectionLambdaExpression` | `74` | - | +| `ProjectionLambdaParameterDeclaration` | `75` | - | +| `ProjectionLogicalExpression` | `68` | - | +| `ProjectionMemberExpression` | `67` | - | +| `ProjectionModelExpression` | `76` | - | +| `ProjectionModelProperty` | `77` | - | +| `ProjectionModelPropertySelector` | `57` | - | +| `ProjectionModelSelector` | `56` | - | +| `ProjectionModelSpreadProperty` | `78` | - | +| `ProjectionOperationSelector` | `58` | - | +| `ProjectionParameterDeclaration` | `55` | - | +| `ProjectionReference` | `41` | - | +| `ProjectionRelationalExpression` | `71` | - | +| `ProjectionSpreadProperty` | `79` | - | +| `ProjectionStatement` | `81` | - | +| `ProjectionTupleExpression` | `80` | - | +| `ProjectionUnaryExpression` | `70` | - | +| `ProjectionUnionSelector` | `59` | - | +| `ProjectionUnionVariantSelector` | `60` | - | +| `Return` | `83` | - | +| `ScalarStatement` | `17` | - | +| `StringLiteral` | `32` | - | +| `TemplateParameterDeclaration` | `42` | - | +| `TupleExpression` | `30` | - | +| `TypeReference` | `40` | - | +| `TypeSpecScript` | `0` | - | +| `UnionExpression` | `28` | - | +| `UnionStatement` | `19` | - | +| `UnionVariant` | `20` | - | +| `UnknownKeyword` | `38` | - | +| `UsingStatement` | `9` | - | +| `ValueOfExpression` | `39` | - | +| `VoidKeyword` | `36` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/Token.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/Token.md new file mode 100644 index 0000000000..243ce1b247 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/Token.md @@ -0,0 +1,81 @@ +--- +jsApi: true +title: "[E] Token" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `AliasKeyword` | `54` | +| `Ampersand` | `27` | +| `AmpsersandAmpersand` | `42` | +| `At` | `32` | +| `AtAt` | `33` | +| `Bar` | `28` | +| `BarBar` | `43` | +| `CloseBrace` | `15` | +| `CloseBracket` | `19` | +| `CloseParen` | `17` | +| `Colon` | `30` | +| `ColonColon` | `31` | +| `Comma` | `23` | +| `ConflictMarker` | `10` | +| `DecKeyword` | `61` | +| `DocCodeFenceDelimiter` | `13` | +| `DocCodeSpan` | `12` | +| `DocText` | `11` | +| `Dot` | `20` | +| `Ellipsis` | `21` | +| `ElseKeyword` | `59` | +| `EndOfFile` | `2` | +| `EnumKeyword` | `53` | +| `Equals` | `26` | +| `EqualsEquals` | `44` | +| `EqualsGreaterThan` | `46` | +| `Exclamation` | `39` | +| `ExclamationEquals` | `45` | +| `ExtendsKeyword` | `65` | +| `ExternKeyword` | `64` | +| `FalseKeyword` | `67` | +| `FnKeyword` | `62` | +| `ForwardSlash` | `36` | +| `GreaterThan` | `25` | +| `GreaterThanEquals` | `41` | +| `Hash` | `34` | +| `Hyphen` | `38` | +| `Identifier` | `3` | +| `IfKeyword` | `60` | +| `ImportKeyword` | `47` | +| `InterfaceKeyword` | `56` | +| `Invalid` | `1` | +| `IsKeyword` | `55` | +| `LessThan` | `24` | +| `LessThanEquals` | `40` | +| `ModelKeyword` | `48` | +| `MultiLineComment` | `7` | +| `NamespaceKeyword` | `50` | +| `NeverKeyword` | `70` | +| `NewLine` | `8` | +| `None` | `0` | +| `NumericLiteral` | `4` | +| `OpKeyword` | `52` | +| `OpenBrace` | `14` | +| `OpenBracket` | `18` | +| `OpenParen` | `16` | +| `Plus` | `37` | +| `ProjectionKeyword` | `58` | +| `Question` | `29` | +| `ReturnKeyword` | `68` | +| `ScalarKeyword` | `49` | +| `Semicolon` | `22` | +| `SingleLineComment` | `6` | +| `Star` | `35` | +| `StringLiteral` | `5` | +| `TrueKeyword` | `66` | +| `UnionKeyword` | `57` | +| `UnknownKeyword` | `71` | +| `UsingKeyword` | `51` | +| `ValueOfKeyword` | `63` | +| `VoidKeyword` | `69` | +| `Whitespace` | `9` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/TokenFlags.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/TokenFlags.md new file mode 100644 index 0000000000..8d7271c2f7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/TokenFlags.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[E] TokenFlags" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Backticked` | `32` | +| `DocComment` | `16` | +| `Escaped` | `1` | +| `NonAscii` | `8` | +| `None` | `0` | +| `TripleQuoted` | `2` | +| `Unterminated` | `4` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/UsageFlags.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/UsageFlags.md new file mode 100644 index 0000000000..7d619373bf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/enumerations/UsageFlags.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[E] UsageFlags" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Input` | `2` | +| `None` | `0` | +| `Output` | `4` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$deprecated.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$deprecated.md new file mode 100644 index 0000000000..1f236d3e36 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$deprecated.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] $deprecated" + +--- +```ts +$deprecated( + context, + target, + message): void +``` + +Mark a type as deprecated + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | DecoratorContext | +| `target` | [`Type`](../type-aliases/Type.md) | Decorator target | +| `message` | `string` | Deprecation target. | + +## Returns + +## Example + +``` @deprecated("Foo is deprecated, use Bar instead.") + model Foo {} +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$discriminator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$discriminator.md new file mode 100644 index 0000000000..bdfe685d63 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$discriminator.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $discriminator" + +--- +```ts +$discriminator( + context, + entity, + propertyName): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`Model`](../interfaces/Model.md) \| [`Union`](../interfaces/Union.md) | +| `propertyName` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$doc.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$doc.md new file mode 100644 index 0000000000..475f730cad --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$doc.md @@ -0,0 +1,38 @@ +--- +jsApi: true +title: "[F] $doc" + +--- +```ts +$doc( + context, + target, + text, + sourceObject?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `text` | `string` | +| `sourceObject`? | [`Type`](../type-aliases/Type.md) | + +## Returns + +## Doc + +attaches a documentation string. Works great with multi-line string literals. + +The first argument to + +## Doc + +is a string, which may contain template parameters, enclosed in braces, +which are replaced with an attribute for the type (commonly "name") passed as the second (optional) argument. + +## Doc + +can be specified on any language element -- a model, an operation, a namespace, etc. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$encode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$encode.md new file mode 100644 index 0000000000..d50bdac454 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$encode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $encode" + +--- +```ts +$encode( + context, + target, + encoding, + encodeAs?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `encoding` | `string` \| [`EnumMember`](../interfaces/EnumMember.md) | +| `encodeAs`? | [`Scalar`](../interfaces/Scalar.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$error.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$error.md new file mode 100644 index 0000000000..71c3a59ccc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$error.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $error" + +--- +```ts +$error(context, entity): void +``` + +`@error` decorator marks a model as an error type. + +`@error` can only be specified on a model. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`Model`](../interfaces/Model.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$errorsDoc.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$errorsDoc.md new file mode 100644 index 0000000000..f02027cde4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$errorsDoc.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $errorsDoc" + +--- +```ts +$errorsDoc( + context, + target, + text): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Operation`](../interfaces/Operation.md) | +| `text` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$format.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$format.md new file mode 100644 index 0000000000..aba42f8846 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$format.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[F] $format" + +--- +```ts +$format( + context, + target, + format): void +``` + +`@format` - specify the data format hint for a string type + +The first argument is a string that identifies the format that the string type expects. Any string +can be entered here, but a TypeSpec emitter must know how to interpret + +For TypeSpec specs that will be used with an OpenAPI emitter, the OpenAPI specification describes possible +valid values for a string type's format: + +https://github.com/OAI/OpenAPI-Specification/blob/3.0.3/versions/3.0.3.md#dataTypes + +`@format` can be specified on a type that extends from `string` or a `string`-typed model property. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `format` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$friendlyName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$friendlyName.md new file mode 100644 index 0000000000..6c5bd76f9e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$friendlyName.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $friendlyName" + +--- +```ts +$friendlyName( + context, + target, + friendlyName, + sourceObject): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `friendlyName` | `string` | +| `sourceObject` | `undefined` \| [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$indexer.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$indexer.md new file mode 100644 index 0000000000..2791d63a5c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$indexer.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $indexer" + +--- +```ts +$indexer( + context, + target, + key, + value): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `key` | [`Scalar`](../interfaces/Scalar.md) | +| `value` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$inspectType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$inspectType.md new file mode 100644 index 0000000000..088d923ba7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$inspectType.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $inspectType" + +--- +```ts +$inspectType( + program, + target, + text): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `text` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$inspectTypeName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$inspectTypeName.md new file mode 100644 index 0000000000..77018500f6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$inspectTypeName.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $inspectTypeName" + +--- +```ts +$inspectTypeName( + program, + target, + text): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `text` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$key.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$key.md new file mode 100644 index 0000000000..331d541f71 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$key.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[F] $key" + +--- +```ts +$key( + context, + entity, + altName?): void +``` + +`@key` - mark a model property as the key to identify instances of that type + +The optional first argument accepts an alternate key name which may be used by emitters. +Otherwise, the name of the target property will be used. + +`@key` can only be applied to model properties. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`ModelProperty`](../interfaces/ModelProperty.md) | +| `altName`? | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$knownValues.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$knownValues.md new file mode 100644 index 0000000000..10a657b425 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$knownValues.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[F] $knownValues" + +--- +```ts +$knownValues( + context, + target, + knownValues): void +``` + +`@knownValues` marks a string type with an enum that contains all known values + +The first parameter is a reference to an enum type that describes all possible values that the +type accepts. + +`@knownValues` can only be applied to model types that extend `string`. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | - | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | Decorator target. Must be a string. (model Foo extends string) | +| `knownValues` | [`Enum`](../interfaces/Enum.md) | Must be an enum. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$list.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$list.md new file mode 100644 index 0000000000..108472004d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$list.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] $list" + +--- +```ts +$list( + context, + target, + listedType?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Operation`](../interfaces/Operation.md) | +| `listedType`? | [`Type`](../type-aliases/Type.md) | + +## Returns + +## Deprecated + +Use the `listsResource` decorator in `@typespec/rest` instead. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxItems.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxItems.md new file mode 100644 index 0000000000..0ca3445573 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxItems.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxItems" + +--- +```ts +$maxItems( + context, + target, + maxItems): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) \| [`ModelProperty`](../interfaces/ModelProperty.md) | +| `maxItems` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxLength.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxLength.md new file mode 100644 index 0000000000..5d8ef8b159 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxLength.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxLength" + +--- +```ts +$maxLength( + context, + target, + maxLength): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `maxLength` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxValue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxValue.md new file mode 100644 index 0000000000..82f4133734 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxValue.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxValue" + +--- +```ts +$maxValue( + context, + target, + maxValue): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `maxValue` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxValueExclusive.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxValueExclusive.md new file mode 100644 index 0000000000..ee5bf5cf7c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$maxValueExclusive.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $maxValueExclusive" + +--- +```ts +$maxValueExclusive( + context, + target, + maxValueExclusive): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `maxValueExclusive` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minItems.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minItems.md new file mode 100644 index 0000000000..f7e0b08453 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minItems.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minItems" + +--- +```ts +$minItems( + context, + target, + minItems): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) \| [`ModelProperty`](../interfaces/ModelProperty.md) | +| `minItems` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minLength.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minLength.md new file mode 100644 index 0000000000..830679e218 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minLength.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minLength" + +--- +```ts +$minLength( + context, + target, + minLength): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `minLength` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minValue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minValue.md new file mode 100644 index 0000000000..ec9f11ca69 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minValue.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minValue" + +--- +```ts +$minValue( + context, + target, + minValue): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `minValue` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minValueExclusive.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minValueExclusive.md new file mode 100644 index 0000000000..f1561b20e7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$minValueExclusive.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $minValueExclusive" + +--- +```ts +$minValueExclusive( + context, + target, + minValueExclusive): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `minValueExclusive` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$overload.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$overload.md new file mode 100644 index 0000000000..89b66fb489 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$overload.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $overload" + +--- +```ts +$overload( + context, + target, + overloadBase): void +``` + +`@overload` - Indicate that the target overloads (specializes) the overloads type. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | DecoratorContext | +| `target` | [`Operation`](../interfaces/Operation.md) | The specializing operation declaration | +| `overloadBase` | [`Operation`](../interfaces/Operation.md) | The operation to be overloaded. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$parameterVisibility.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$parameterVisibility.md new file mode 100644 index 0000000000..aba0f8b70e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$parameterVisibility.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $parameterVisibility" + +--- +```ts +$parameterVisibility( + context, + entity, ... + visibilities): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`Operation`](../interfaces/Operation.md) | +| ...`visibilities` | `string`[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$pattern.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$pattern.md new file mode 100644 index 0000000000..c3fb9a3b9f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$pattern.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $pattern" + +--- +```ts +$pattern( + context, + target, + pattern): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `pattern` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$projectedName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$projectedName.md new file mode 100644 index 0000000000..169fb96647 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$projectedName.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] $projectedName" + +--- +```ts +$projectedName( + context, + target, + projectionName, + projectedName): void +``` + +`@projectedName` - Indicate that this entity should be renamed according to the given projection. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | DecoratorContext | +| `target` | [`Type`](../type-aliases/Type.md) | The that should have a different name. | +| `projectionName` | `string` | Name of the projection (e.g. "toJson", "toCSharp") | +| `projectedName` | `string` | Name of the type should have in the scope of the projection specified. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$returnTypeVisibility.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$returnTypeVisibility.md new file mode 100644 index 0000000000..35cc0598dd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$returnTypeVisibility.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $returnTypeVisibility" + +--- +```ts +$returnTypeVisibility( + context, + entity, ... + visibilities): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`Operation`](../interfaces/Operation.md) | +| ...`visibilities` | `string`[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$returnsDoc.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$returnsDoc.md new file mode 100644 index 0000000000..f7ed8de6ee --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$returnsDoc.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $returnsDoc" + +--- +```ts +$returnsDoc( + context, + target, + text): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Operation`](../interfaces/Operation.md) | +| `text` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$secret.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$secret.md new file mode 100644 index 0000000000..cd98d638c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$secret.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] $secret" + +--- +```ts +$secret(context, target): void +``` + +Mark a string as a secret value that should be treated carefully to avoid exposure + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | Decorator context | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | Decorator target, either a string model or a property with type string. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$service.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$service.md new file mode 100644 index 0000000000..52c1dec7dd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$service.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $service" + +--- +```ts +$service( + context, + target, + options?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Namespace`](../interfaces/Namespace.md) | +| `options`? | [`Model`](../interfaces/Model.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$summary.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$summary.md new file mode 100644 index 0000000000..f45349711e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$summary.md @@ -0,0 +1,39 @@ +--- +jsApi: true +title: "[F] $summary" + +--- +```ts +$summary( + context, + target, + text, + sourceObject): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `text` | `string` | +| `sourceObject` | [`Type`](../type-aliases/Type.md) | + +## Returns + +## Summary + +attaches a documentation string. It is typically used to give a short, single-line +description, and can be used in combination with or instead of @doc. + +The first argument to + +## Summary + +is a string, which may contain template parameters, enclosed in braces, +which are replaced with an attribute for the type (commonly "name") passed as the second (optional) argument. + +## Summary + +can be specified on any language element -- a model, an operation, a namespace, etc. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$tag.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$tag.md new file mode 100644 index 0000000000..b83e33b273 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$tag.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $tag" + +--- +```ts +$tag( + context, + target, + tag): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Interface`](../interfaces/Interface.md) \| [`Namespace`](../interfaces/Namespace.md) \| [`Operation`](../interfaces/Operation.md) | +| `tag` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$visibility.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$visibility.md new file mode 100644 index 0000000000..bc3da85509 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$visibility.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $visibility" + +--- +```ts +$visibility( + context, + target, ... + visibilities): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) | +| ...`visibilities` | `string`[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withDefaultKeyVisibility.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withDefaultKeyVisibility.md new file mode 100644 index 0000000000..03da558d06 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withDefaultKeyVisibility.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $withDefaultKeyVisibility" + +--- +```ts +$withDefaultKeyVisibility( + context, + entity, + visibility): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `entity` | [`Model`](../interfaces/Model.md) | +| `visibility` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withOptionalProperties.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withOptionalProperties.md new file mode 100644 index 0000000000..6514fb752d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withOptionalProperties.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $withOptionalProperties" + +--- +```ts +$withOptionalProperties(context, target): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withUpdateableProperties.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withUpdateableProperties.md new file mode 100644 index 0000000000..5e56bf5553 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withUpdateableProperties.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $withUpdateableProperties" + +--- +```ts +$withUpdateableProperties(context, target): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withVisibility.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withVisibility.md new file mode 100644 index 0000000000..ebb9ee34f2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withVisibility.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $withVisibility" + +--- +```ts +$withVisibility( + context, + target, ... + visibilities): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) | +| ...`visibilities` | `string`[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withoutDefaultValues.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withoutDefaultValues.md new file mode 100644 index 0000000000..27aff6f317 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withoutDefaultValues.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] $withoutDefaultValues" + +--- +```ts +$withoutDefaultValues(context, target): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withoutOmittedProperties.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withoutOmittedProperties.md new file mode 100644 index 0000000000..7a56360362 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/$withoutOmittedProperties.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $withoutOmittedProperties" + +--- +```ts +$withoutOmittedProperties( + context, + target, + omitProperties): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`Model`](../interfaces/Model.md) | +| `omitProperties` | [`StringLiteral`](../interfaces/StringLiteral.md) \| [`Union`](../interfaces/Union.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/addService.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/addService.md new file mode 100644 index 0000000000..9cffe02485 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/addService.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] addService" + +--- +```ts +addService( + program, + namespace, + details): void +``` + +Mark the given namespace as a service. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Namespace | +| `details` | [`ServiceDetails`](../interfaces/ServiceDetails.md) | Service details | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/assertType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/assertType.md new file mode 100644 index 0000000000..442c8893d8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/assertType.md @@ -0,0 +1,48 @@ +--- +jsApi: true +title: "[F] assertType" + +--- +```ts +assertType( + typeDescription, + t, ... + kinds): asserts t is Object +``` + +Assert that the input type has one of the kinds provided + +## Type parameters + +| Parameter | +| :------ | +| `TKind` extends ( + \| `"Model"` + \| `"ModelProperty"` + \| `"Scalar"` + \| `"Interface"` + \| `"Enum"` + \| `"EnumMember"` + \| `"TemplateParameter"` + \| `"Namespace"` + \| `"Operation"` + \| `"String"` + \| `"Number"` + \| `"Boolean"` + \| `"Tuple"` + \| `"Union"` + \| `"UnionVariant"` + \| `"Intrinsic"` + \| `"Function"` + \| `"Decorator"` + \| `"FunctionParameter"` + \| `"Object"` + \| `"Projection"`)[] | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `typeDescription` | `string` | +| `t` | [`Type`](../type-aliases/Type.md) | +| ...`kinds` | `TKind` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/cadlTypeToJson.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/cadlTypeToJson.md new file mode 100644 index 0000000000..a60c9bd905 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/cadlTypeToJson.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] cadlTypeToJson" + +--- +```ts +cadlTypeToJson(typespecType, target): [T | undefined, Diagnostic[]] +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `typespecType` | [`TypeSpecValue`](../type-aliases/TypeSpecValue.md) | +| `target` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | + +## Returns + +## Deprecated + +use typespecTypeToJson diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/checkFormatCadl.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/checkFormatCadl.md new file mode 100644 index 0000000000..afb4651df8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/checkFormatCadl.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] checkFormatCadl" + +--- +```ts +checkFormatCadl(code, prettierConfig?): Promise +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `string` | +| `prettierConfig`? | `Options` | + +## Returns + +## Deprecated + +use checkFormatTypeSpec diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/checkFormatTypeSpec.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/checkFormatTypeSpec.md new file mode 100644 index 0000000000..5f196128a0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/checkFormatTypeSpec.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] checkFormatTypeSpec" + +--- +```ts +checkFormatTypeSpec(code, prettierConfig?): Promise +``` + +Check the given is correctly formatted. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `string` | +| `prettierConfig`? | `Options` | + +## Returns + +true if code is formatted correctly. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/compile.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/compile.md new file mode 100644 index 0000000000..a9f1628c04 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/compile.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] compile" + +--- +```ts +compile( + host, + mainFile, + options, +oldProgram?): Promise +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `host` | [`CompilerHost`](../interfaces/CompilerHost.md) | +| `mainFile` | `string` | +| `options` | [`CompilerOptions`](../interfaces/CompilerOptions.md) | +| `oldProgram`? | [`Program`](../interfaces/Program.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/compilerAssert.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/compilerAssert.md new file mode 100644 index 0000000000..8b6ece8ba4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/compilerAssert.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[F] compilerAssert" + +--- +```ts +compilerAssert( + condition, + message, + target?): asserts condition +``` + +Use this to report bugs in the compiler, and not errors in the source code +being compiled. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `condition` | `any` | Throw if this is not true. | +| `message` | `string` | Error message. | +| `target`? | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | Optional location in source code that might give a clue about
what got the compiler off track. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createCadlLibrary.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createCadlLibrary.md new file mode 100644 index 0000000000..17b0bff948 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createCadlLibrary.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] createCadlLibrary" + +--- +```ts +createCadlLibrary(lib): TypeSpecLibrary +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | +| `E` extends `Record`<`string`, `any`\> | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `lib` | `Readonly`<[`TypeSpecLibraryDef`](../interfaces/TypeSpecLibraryDef.md)<`T`, `E`\>\> | + +## Returns + +## Deprecated + +use createTypeSpecLibrary diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createChecker.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createChecker.md new file mode 100644 index 0000000000..144c3dd536 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createChecker.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] createChecker" + +--- +```ts +createChecker(program): Checker +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createDecoratorDefinition.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createDecoratorDefinition.md new file mode 100644 index 0000000000..cddf71aca0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createDecoratorDefinition.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[F] createDecoratorDefinition" + +--- +```ts +createDecoratorDefinition(definition): DecoratorValidator +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends [`TypeKind`](../type-aliases/TypeKind.md) | +| `P` extends readonly [`DecoratorParamDefinition`](../interfaces/DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\>[] | +| `S` extends `undefined` \| [`DecoratorParamDefinition`](../interfaces/DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\> | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `definition` | [`DecoratorDefinition`](../interfaces/DecoratorDefinition.md)<`T`, `P`, `S`\> | + +## Returns + +## Deprecated + +use extern dec definition in typespec instead. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createDiagnosticCollector.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createDiagnosticCollector.md new file mode 100644 index 0000000000..f870b155aa --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createDiagnosticCollector.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] createDiagnosticCollector" + +--- +```ts +createDiagnosticCollector(): DiagnosticCollector +``` + +Create a new instance of the + +## Returns + +## See + +DiagnosticCollector. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createDiagnosticCreator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createDiagnosticCreator.md new file mode 100644 index 0000000000..175c187fb3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createDiagnosticCreator.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[F] createDiagnosticCreator" + +--- +```ts +createDiagnosticCreator(diagnostics, libraryName?): DiagnosticCreator +``` + +Create a new diagnostics creator. + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `diagnostics` | [`DiagnosticMap`](../type-aliases/DiagnosticMap.md)<`T`\> | Map of the potential diagnostics. | +| `libraryName`? | `string` | Optional name of the library if in the scope of a library. | + +## Returns + +## See + +DiagnosticCreator diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createProjectedNameProgram.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createProjectedNameProgram.md new file mode 100644 index 0000000000..ba640225c0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createProjectedNameProgram.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] createProjectedNameProgram" + +--- +```ts +createProjectedNameProgram(program, target): ProjectedNameView +``` + +Create an helper to manager project names. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | `string` | Name of the projected name target(e.g. json, csharp, etc.) | + +## Returns + +ProjectedNameView diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createRekeyableMap.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createRekeyableMap.md new file mode 100644 index 0000000000..14c7931fc2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createRekeyableMap.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] createRekeyableMap" + +--- +```ts +createRekeyableMap(entries?): RekeyableMap +``` + +## Type parameters + +| Parameter | +| :------ | +| `K` | +| `V` | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `entries`? | [`K`, `V`][] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createRule.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createRule.md new file mode 100644 index 0000000000..9b37791fab --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createRule.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] createRule" + +--- +```ts +createRule(definition): LinterRuleDefinition +``` + +Create a new linter rule. + +## Type parameters + +| Parameter | +| :------ | +| `N` extends `string` | +| `T` extends [`DiagnosticMessages`](../interfaces/DiagnosticMessages.md) | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `definition` | [`LinterRuleDefinition`](../interfaces/LinterRuleDefinition.md)<`N`, `T`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createScanner.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createScanner.md new file mode 100644 index 0000000000..dc2fe545df --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createScanner.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] createScanner" + +--- +```ts +createScanner(source, diagnosticHandler): Scanner +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `source` | `string` \| [`SourceFile`](../interfaces/SourceFile.md) | +| `diagnosticHandler` | [`DiagnosticHandler`](../type-aliases/DiagnosticHandler.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createServer.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createServer.md new file mode 100644 index 0000000000..78f5971e55 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createServer.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] createServer" + +--- +```ts +createServer(host): Server +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `host` | [`ServerHost`](../interfaces/ServerHost.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createSourceFile.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createSourceFile.md new file mode 100644 index 0000000000..ca075aa5b0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createSourceFile.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] createSourceFile" + +--- +```ts +createSourceFile(text, path): SourceFile +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `text` | `string` | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createStateAccessors.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createStateAccessors.md new file mode 100644 index 0000000000..15b436490e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createStateAccessors.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] createStateAccessors" + +--- +```ts +createStateAccessors( + stateMaps, + stateSets, + projector?): object +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `stateMaps` | `Map`<`symbol`, `StateMap`\> | +| `stateSets` | `Map`<`symbol`, `StateSet`\> | +| `projector`? | [`Projector`](../interfaces/Projector.md) | + +## Returns + +> | Member | Type | Description | +> | :------ | :------ | :------ | +> | `stateMap` | <`T`\>(`key`) => `StateMapView`<`T`\> | - | +> | `stateSet` | (`key`) => `StateSetView` | - | +> diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createTypeSpecLibrary.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createTypeSpecLibrary.md new file mode 100644 index 0000000000..0a1733d425 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/createTypeSpecLibrary.md @@ -0,0 +1,44 @@ +--- +jsApi: true +title: "[F] createTypeSpecLibrary" + +--- +```ts +createTypeSpecLibrary(lib): TypeSpecLibrary +``` + +Create a new TypeSpec library definition. + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | +| `E` extends `Record`<`string`, `any`\> | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `lib` | `Readonly`<[`TypeSpecLibraryDef`](../interfaces/TypeSpecLibraryDef.md)<`T`, `E`\>\> | Library definition. | + +## Returns + +Library with utility functions. + +## Tutorial + +Create the lib object with `as const` to get the full typing. + +## Example + +```ts +const libDef = { + name: "myLib", + diagnostics: { + "my-code": {serverity: "error", messages: {default: "Foo bar"}} + }, +} as const; + +const lib = createTypeSpecLibrary(libDef); +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/emitFile.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/emitFile.md new file mode 100644 index 0000000000..1d93bf262d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/emitFile.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] emitFile" + +--- +```ts +emitFile(program, options): Promise +``` + +Helper to emit a file. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | TypeSpec Program | +| `options` | [`EmitFileOptions`](../interfaces/EmitFileOptions.md) | File Emitter options | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/ensureTrailingDirectorySeparator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/ensureTrailingDirectorySeparator.md new file mode 100644 index 0000000000..cb8b71253a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/ensureTrailingDirectorySeparator.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] ensureTrailingDirectorySeparator" + +--- +```ts +ensureTrailingDirectorySeparator(path): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/filterModelProperties.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/filterModelProperties.md new file mode 100644 index 0000000000..761b39fffa --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/filterModelProperties.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] filterModelProperties" + +--- +```ts +filterModelProperties( + program, + model, + filter): Model +``` + +Applies a filter to the properties of a given type. If no properties +are filtered out, then return the input unchanged. Otherwise, return +a new anonymous model with only the filtered properties. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) \| [`ProjectedProgram`](../interfaces/ProjectedProgram.md) | - | +| `model` | [`Model`](../interfaces/Model.md) | The input model to filter. | +| `filter` | (`property`) => `boolean` | The filter to apply. Properties are kept when this returns true. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/finishTypeForProgram.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/finishTypeForProgram.md new file mode 100644 index 0000000000..5ad29fb270 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/finishTypeForProgram.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] finishTypeForProgram" + +--- +```ts +finishTypeForProgram(program, typeDef): T +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends [`Type`](../type-aliases/Type.md) | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `typeDef` | `T` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/formatDiagnostic.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/formatDiagnostic.md new file mode 100644 index 0000000000..6547ba8c69 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/formatDiagnostic.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] formatDiagnostic" + +--- +```ts +formatDiagnostic(diagnostic): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostic` | [`Diagnostic`](../interfaces/Diagnostic.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/formatIdentifier.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/formatIdentifier.md new file mode 100644 index 0000000000..5d9b2fb07b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/formatIdentifier.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] formatIdentifier" + +--- +```ts +formatIdentifier(sv): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `sv` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/formatTypeSpec.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/formatTypeSpec.md new file mode 100644 index 0000000000..192a98bad0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/formatTypeSpec.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] formatTypeSpec" + +--- +```ts +formatTypeSpec(code, prettierConfig?): Promise +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `string` | +| `prettierConfig`? | `Options` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getAllTags.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getAllTags.md new file mode 100644 index 0000000000..84842b3203 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getAllTags.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getAllTags" + +--- +```ts +getAllTags(program, target): string[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Interface`](../interfaces/Interface.md) \| [`Namespace`](../interfaces/Namespace.md) \| [`Operation`](../interfaces/Operation.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getAnyExtensionFromPath.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getAnyExtensionFromPath.md new file mode 100644 index 0000000000..926dfc20bb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getAnyExtensionFromPath.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] getAnyExtensionFromPath" + +--- +```ts +getAnyExtensionFromPath(path): string +``` + +Gets the file extension for a path. +Normalizes it to lower case. + +```ts +getAnyExtensionFromPath("/path/to/file.ext") === ".ext" +getAnyExtensionFromPath("/path/to/file.ext/") === ".ext" +getAnyExtensionFromPath("/path/to/file") === "" +getAnyExtensionFromPath("/path/to.ext/file") === "" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getBaseFileName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getBaseFileName.md new file mode 100644 index 0000000000..098a86d805 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getBaseFileName.md @@ -0,0 +1,42 @@ +--- +jsApi: true +title: "[F] getBaseFileName" + +--- +```ts +getBaseFileName(path): string +``` + +Returns the path except for its containing directory name. +Semantics align with NodeJS's `path.basename` except that we support URL's as well. + +```ts +// POSIX +getBaseFileName("/path/to/file.ext") === "file.ext" +getBaseFileName("/path/to/") === "to" +getBaseFileName("/") === "" +// DOS +getBaseFileName("c:/path/to/file.ext") === "file.ext" +getBaseFileName("c:/path/to/") === "to" +getBaseFileName("c:/") === "" +getBaseFileName("c:") === "" +// URL +getBaseFileName("http://typescriptlang.org/path/to/file.ext") === "file.ext" +getBaseFileName("http://typescriptlang.org/path/to/") === "to" +getBaseFileName("http://typescriptlang.org/") === "" +getBaseFileName("http://typescriptlang.org") === "" +getBaseFileName("file://server/path/to/file.ext") === "file.ext" +getBaseFileName("file://server/path/to/") === "to" +getBaseFileName("file://server/") === "" +getBaseFileName("file://server") === "" +getBaseFileName("file:///path/to/file.ext") === "file.ext" +getBaseFileName("file:///path/to/") === "to" +getBaseFileName("file:///") === "" +getBaseFileName("file://") === "" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDeprecated.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDeprecated.md new file mode 100644 index 0000000000..e4892a5c03 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDeprecated.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getDeprecated" + +--- +```ts +getDeprecated(program, type): string | undefined +``` + +Return the deprecated message or undefined if not deprecated + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `type` | [`Type`](../type-aliases/Type.md) | Type | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDeprecationDetails.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDeprecationDetails.md new file mode 100644 index 0000000000..20c3d97981 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDeprecationDetails.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getDeprecationDetails" + +--- +```ts +getDeprecationDetails(program, typeOrNode): DeprecationDetails | undefined +``` + +Returns complete deprecation details for the given type or node + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `typeOrNode` | [`Node`](../type-aliases/Node.md) \| [`Type`](../type-aliases/Type.md) | A Type or Node to check for deprecation | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDirectoryPath.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDirectoryPath.md new file mode 100644 index 0000000000..09e9fb5c6d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDirectoryPath.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] getDirectoryPath" + +--- +```ts +getDirectoryPath(path): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDiscriminatedTypes.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDiscriminatedTypes.md new file mode 100644 index 0000000000..7a83bf4fa8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDiscriminatedTypes.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] getDiscriminatedTypes" + +--- +```ts +getDiscriminatedTypes(program): [Model | Union, Discriminator][] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDiscriminatedUnion.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDiscriminatedUnion.md new file mode 100644 index 0000000000..c36f6f8f93 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDiscriminatedUnion.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getDiscriminatedUnion" + +--- +```ts +getDiscriminatedUnion(type, discriminator): [DiscriminatedUnion, readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Model`](../interfaces/Model.md) \| [`Union`](../interfaces/Union.md) | +| `discriminator` | [`Discriminator`](../interfaces/Discriminator.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDiscriminator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDiscriminator.md new file mode 100644 index 0000000000..1724d156b9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDiscriminator.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getDiscriminator" + +--- +```ts +getDiscriminator(program, entity): Discriminator | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `entity` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDoc.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDoc.md new file mode 100644 index 0000000000..2b08b48af4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDoc.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getDoc" + +--- +```ts +getDoc(program, target): string | undefined +``` + +Get the documentation string for the given type. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Type | + +## Returns + +Documentation value diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDocData.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDocData.md new file mode 100644 index 0000000000..900ff26995 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDocData.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getDocData" + +--- +```ts +getDocData(program, target): DocData | undefined +``` + +Get the documentation information for the given type. In most cases you probably just want to use [getDoc](getDoc.md) + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Type | + +## Returns + +Doc data with source information. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDocDataInternal.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDocDataInternal.md new file mode 100644 index 0000000000..c73a26414a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getDocDataInternal.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] getDocDataInternal" + +--- +```ts +getDocDataInternal( + program, + target, + key): DocData | undefined +``` + +Get the documentation information for the given type. In most cases you probably just want to use [getDoc](getDoc.md) + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Type | +| `key` | `DocTarget` | - | + +## Returns + +Doc data with source information. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getEffectiveModelType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getEffectiveModelType.md new file mode 100644 index 0000000000..2d275dcb46 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getEffectiveModelType.md @@ -0,0 +1,30 @@ +--- +jsApi: true +title: "[F] getEffectiveModelType" + +--- +```ts +getEffectiveModelType( + program, + model, + filter?): Model +``` + +If the input is anonymous (or the provided filter removes properties) +and there exists a named model with the same set of properties +(ignoring filtered properties), then return that named model. +Otherwise, return the input unchanged. + +This can be used by emitters to find a better name for a set of +properties after filtering. For example, given `{ @metadata prop: +string} & SomeName`, and an emitter that wishes to discard properties +marked with `@metadata`, the emitter can use this to recover that the +best name for the remaining properties is `SomeName`. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | - | +| `model` | [`Model`](../interfaces/Model.md) | The input model | +| `filter`? | (`property`) => `boolean` | An optional filter to apply to the input model's
properties. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getEncode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getEncode.md new file mode 100644 index 0000000000..5ecc32b123 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getEncode.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getEncode" + +--- +```ts +getEncode(program, target): EncodeData | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getErrorsDoc.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getErrorsDoc.md new file mode 100644 index 0000000000..b378e4f8a0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getErrorsDoc.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getErrorsDoc" + +--- +```ts +getErrorsDoc(program, target): string | undefined +``` + +Get the documentation string for the return errors types of an operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Operation`](../interfaces/Operation.md) | Type | + +## Returns + +Documentation value diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getErrorsDocData.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getErrorsDocData.md new file mode 100644 index 0000000000..8195cd85be --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getErrorsDocData.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getErrorsDocData" + +--- +```ts +getErrorsDocData(program, target): DocData | undefined +``` + +Get the documentation information for the return errors types of an operation. In most cases you probably just want to use [getErrorsDoc](getErrorsDoc.md) + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Operation`](../interfaces/Operation.md) | Type | + +## Returns + +Doc data with source information. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFirstAncestor.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFirstAncestor.md new file mode 100644 index 0000000000..9693bad1a2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFirstAncestor.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getFirstAncestor" + +--- +```ts +getFirstAncestor(node, test): Node | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | +| `test` | [`NodeCallback`](../type-aliases/NodeCallback.md)<`boolean`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFormat.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFormat.md new file mode 100644 index 0000000000..fa56fe4d5b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFormat.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getFormat" + +--- +```ts +getFormat(program, target): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFriendlyName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFriendlyName.md new file mode 100644 index 0000000000..e4505f13ff --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFriendlyName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getFriendlyName" + +--- +```ts +getFriendlyName(program, target): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFullyQualifiedSymbolName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFullyQualifiedSymbolName.md new file mode 100644 index 0000000000..401e425dc3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getFullyQualifiedSymbolName.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] getFullyQualifiedSymbolName" + +--- +```ts +getFullyQualifiedSymbolName(sym, options?): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `sym` | `undefined` \| [`Sym`](../interfaces/Sym.md) | +| `options`? | `object` | +| `options.useGlobalPrefixAtTopLevel`? | `boolean` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getIdentifierContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getIdentifierContext.md new file mode 100644 index 0000000000..e3ca1cce9e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getIdentifierContext.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] getIdentifierContext" + +--- +```ts +getIdentifierContext(id): IdentifierContext +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `id` | [`IdentifierNode`](../interfaces/IdentifierNode.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getIndexer.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getIndexer.md new file mode 100644 index 0000000000..4863028569 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getIndexer.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getIndexer" + +--- +```ts +getIndexer(program, target): ModelIndexer | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getKeyName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getKeyName.md new file mode 100644 index 0000000000..e2a70b9377 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getKeyName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getKeyName" + +--- +```ts +getKeyName(program, property): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `property` | [`ModelProperty`](../interfaces/ModelProperty.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getKnownValues.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getKnownValues.md new file mode 100644 index 0000000000..cbd810f433 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getKnownValues.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getKnownValues" + +--- +```ts +getKnownValues(program, target): Enum | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getListOperationType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getListOperationType.md new file mode 100644 index 0000000000..1fe0e816cd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getListOperationType.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getListOperationType" + +--- +```ts +getListOperationType(program, target): Model | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | + +## Returns + +## Deprecated + +This function is unused and will be removed in a future release. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getLocationContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getLocationContext.md new file mode 100644 index 0000000000..777afc5f40 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getLocationContext.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getLocationContext" + +--- +```ts +getLocationContext(program, type): LocationContext +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `type` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxItems.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxItems.md new file mode 100644 index 0000000000..7cb3e4d67d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxItems.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxItems" + +--- +```ts +getMaxItems(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxLength.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxLength.md new file mode 100644 index 0000000000..a50ec1b3df --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxLength.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxLength" + +--- +```ts +getMaxLength(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxValue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxValue.md new file mode 100644 index 0000000000..2d479ac26b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxValue.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxValue" + +--- +```ts +getMaxValue(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxValueExclusive.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxValueExclusive.md new file mode 100644 index 0000000000..959c9a34cc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMaxValueExclusive.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMaxValueExclusive" + +--- +```ts +getMaxValueExclusive(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinItems.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinItems.md new file mode 100644 index 0000000000..7870992962 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinItems.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinItems" + +--- +```ts +getMinItems(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinLength.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinLength.md new file mode 100644 index 0000000000..c9744ceb9b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinLength.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinLength" + +--- +```ts +getMinLength(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinValue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinValue.md new file mode 100644 index 0000000000..207797213c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinValue.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinValue" + +--- +```ts +getMinValue(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinValueExclusive.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinValueExclusive.md new file mode 100644 index 0000000000..4757f840bb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getMinValueExclusive.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getMinValueExclusive" + +--- +```ts +getMinValueExclusive(program, target): number | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNamespaceFullName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNamespaceFullName.md new file mode 100644 index 0000000000..082647b9f4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNamespaceFullName.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getNamespaceFullName" + +--- +```ts +getNamespaceFullName(type, options?): string +``` + +Return the full name of the namespace(e.g. "Foo.Bar") + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `type` | [`Namespace`](../interfaces/Namespace.md) | namespace type | +| `options`? | [`TypeNameOptions`](../interfaces/TypeNameOptions.md) | | + +## Returns diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNodeAtPosition.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNodeAtPosition.md new file mode 100644 index 0000000000..1f6ad69ebb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNodeAtPosition.md @@ -0,0 +1,46 @@ +--- +jsApi: true +title: "[F] getNodeAtPosition" + +--- +## getNodeAtPosition(script, position, filter) + +```ts +getNodeAtPosition( + script, + position, + filter?): Node | undefined +``` + +Resolve the node in the syntax tree that that is at the given position. + +### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `script` | [`TypeSpecScriptNode`](../interfaces/TypeSpecScriptNode.md) | TypeSpec Script node | +| `position` | `number` | Position | +| `filter`? | (`node`) => `boolean` | Filter if wanting to return a parent containing node early. | + +## getNodeAtPosition(script, position, filter) + +```ts +getNodeAtPosition( + script, + position, + filter): T | undefined +``` + +### Type parameters + +| Parameter | +| :------ | +| `T` extends [`Node`](../type-aliases/Node.md) | + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `script` | [`TypeSpecScriptNode`](../interfaces/TypeSpecScriptNode.md) | +| `position` | `number` | +| `filter` | (`node`) => `node is T` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNormalizedAbsolutePath.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNormalizedAbsolutePath.md new file mode 100644 index 0000000000..b99530643f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNormalizedAbsolutePath.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getNormalizedAbsolutePath" + +--- +```ts +getNormalizedAbsolutePath(fileName, currentDirectory): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `fileName` | `string` | +| `currentDirectory` | `undefined` \| `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNormalizedAbsolutePathWithoutRoot.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNormalizedAbsolutePathWithoutRoot.md new file mode 100644 index 0000000000..775cb25199 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNormalizedAbsolutePathWithoutRoot.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getNormalizedAbsolutePathWithoutRoot" + +--- +```ts +getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `fileName` | `string` | +| `currentDirectory` | `undefined` \| `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNormalizedPathComponents.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNormalizedPathComponents.md new file mode 100644 index 0000000000..ba4aa440f8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getNormalizedPathComponents.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] getNormalizedPathComponents" + +--- +```ts +getNormalizedPathComponents(path, currentDirectory): string[] +``` + +Parse a path into an array containing a root component (at index 0) and zero or more path +components (at indices > 0). The result is normalized. +If the path is relative, the root component is `""`. +If the path is absolute, the root component includes the first path separator (`/`). + +```ts +getNormalizedPathComponents("to/dir/../file.ext", "/path/") === ["/", "path", "to", "file.ext"] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | +| `currentDirectory` | `undefined` \| `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getOverloadedOperation.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getOverloadedOperation.md new file mode 100644 index 0000000000..44a24c99ba --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getOverloadedOperation.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getOverloadedOperation" + +--- +```ts +getOverloadedOperation(program, operation): Operation | undefined +``` + +If the given operation overloads another operation, return that operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `operation` | [`Operation`](../interfaces/Operation.md) | The operation to check for an overload target. | + +## Returns + +The operation this operation overloads, if any. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getOverloads.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getOverloads.md new file mode 100644 index 0000000000..82cc080bd7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getOverloads.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getOverloads" + +--- +```ts +getOverloads(program, operation): Operation[] | undefined +``` + +Get all operations that are marked as overloads of the given operation + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `operation` | [`Operation`](../interfaces/Operation.md) | Operation | + +## Returns + +An array of operations that overload the given operation. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getOverriddenProperty.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getOverriddenProperty.md new file mode 100644 index 0000000000..cb2984a2aa --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getOverriddenProperty.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getOverriddenProperty" + +--- +```ts +getOverriddenProperty(property): ModelProperty | undefined +``` + +Gets the property from the nearest base type that is overridden by the +given property, if any. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `property` | [`ModelProperty`](../interfaces/ModelProperty.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getParameterVisibility.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getParameterVisibility.md new file mode 100644 index 0000000000..47ea057c94 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getParameterVisibility.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getParameterVisibility" + +--- +```ts +getParameterVisibility(program, entity): string[] | undefined +``` + +Returns the visibilities of the parameters of the given operation, if provided with `@parameterVisibility`. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `entity` | [`Operation`](../interfaces/Operation.md) | + +## Returns + +## See + +[$parameterVisibility]($parameterVisibility.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getParentTemplateNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getParentTemplateNode.md new file mode 100644 index 0000000000..6018d40cec --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getParentTemplateNode.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[F] getParentTemplateNode" + +--- +```ts +getParentTemplateNode(node): Node & TemplateDeclarationNode | undefined +``` + +Lookup and find the node + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | Node | + +## Returns + +Template Parent node if applicable diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPathComponents.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPathComponents.md new file mode 100644 index 0000000000..311769b9f8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPathComponents.md @@ -0,0 +1,45 @@ +--- +jsApi: true +title: "[F] getPathComponents" + +--- +```ts +getPathComponents(path, currentDirectory): string[] +``` + +Parse a path into an array containing a root component (at index 0) and zero or more path +components (at indices > 0). The result is not normalized. +If the path is relative, the root component is `""`. +If the path is absolute, the root component includes the first path separator (`/`). + +```ts +// POSIX +getPathComponents("/path/to/file.ext") === ["/", "path", "to", "file.ext"] +getPathComponents("/path/to/") === ["/", "path", "to"] +getPathComponents("/") === ["/"] +// DOS +getPathComponents("c:/path/to/file.ext") === ["c:/", "path", "to", "file.ext"] +getPathComponents("c:/path/to/") === ["c:/", "path", "to"] +getPathComponents("c:/") === ["c:/"] +getPathComponents("c:") === ["c:"] +// URL +getPathComponents("http://typescriptlang.org/path/to/file.ext") === ["http://typescriptlang.org/", "path", "to", "file.ext"] +getPathComponents("http://typescriptlang.org/path/to/") === ["http://typescriptlang.org/", "path", "to"] +getPathComponents("http://typescriptlang.org/") === ["http://typescriptlang.org/"] +getPathComponents("http://typescriptlang.org") === ["http://typescriptlang.org"] +getPathComponents("file://server/path/to/file.ext") === ["file://server/", "path", "to", "file.ext"] +getPathComponents("file://server/path/to/") === ["file://server/", "path", "to"] +getPathComponents("file://server/") === ["file://server/"] +getPathComponents("file://server") === ["file://server"] +getPathComponents("file:///path/to/file.ext") === ["file:///", "path", "to", "file.ext"] +getPathComponents("file:///path/to/") === ["file:///", "path", "to"] +getPathComponents("file:///") === ["file:///"] +getPathComponents("file://") === ["file://"] +``` + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `path` | `string` | `undefined` | +| `currentDirectory` | `string` | `""` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPathFromPathComponents.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPathFromPathComponents.md new file mode 100644 index 0000000000..5a94cdbcc3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPathFromPathComponents.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getPathFromPathComponents" + +--- +```ts +getPathFromPathComponents(pathComponents): string +``` + +Formats a parsed path consisting of a root component (at index 0) and zero or more path +segments (at indices > 0). + +```ts +getPathFromPathComponents(["/", "path", "to", "file.ext"]) === "/path/to/file.ext" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `pathComponents` | readonly `string`[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPattern.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPattern.md new file mode 100644 index 0000000000..a576476ddc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPattern.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getPattern" + +--- +```ts +getPattern(program, target): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getProjectedName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getProjectedName.md new file mode 100644 index 0000000000..4ec1c9bdd7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getProjectedName.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] getProjectedName" + +--- +```ts +getProjectedName( + program, + target, + projectionName): string | undefined +``` + +Get the projected name of the given entity for the given projection. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Target | +| `projectionName` | `string` | - | + +## Returns + +Projected name for the given projection diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getProjectedNames.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getProjectedNames.md new file mode 100644 index 0000000000..d0148033fb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getProjectedNames.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getProjectedNames" + +--- +```ts +getProjectedNames(program, target): ReadonlyMap | undefined +``` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Target | + +## Returns + +Map of the projected names for the given entity. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getProperty.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getProperty.md new file mode 100644 index 0000000000..4f0e4322e5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getProperty.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getProperty" + +--- +```ts +getProperty(type, propertyName): ModelProperty | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Model`](../interfaces/Model.md) | +| `propertyName` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPropertyType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPropertyType.md new file mode 100644 index 0000000000..07dcdac223 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getPropertyType.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] getPropertyType" + +--- +```ts +getPropertyType(target): Type +``` + +Return the type of the property or the model itself. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getRelativePathFromDirectory.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getRelativePathFromDirectory.md new file mode 100644 index 0000000000..9543c34627 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getRelativePathFromDirectory.md @@ -0,0 +1,42 @@ +--- +jsApi: true +title: "[F] getRelativePathFromDirectory" + +--- +## getRelativePathFromDirectory(from, to, ignoreCase) + +```ts +getRelativePathFromDirectory( + from, + to, + ignoreCase): string +``` + +Gets a relative path that can be used to traverse between `from` and `to`. + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `from` | `string` | +| `to` | `string` | +| `ignoreCase` | `boolean` | + +## getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileName) + +```ts +getRelativePathFromDirectory( + fromDirectory, + to, + getCanonicalFileName): string +``` + +Gets a relative path that can be used to traverse between `from` and `to`. + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `fromDirectory` | `string` | +| `to` | `string` | +| `getCanonicalFileName` | `GetCanonicalFileName` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getReturnTypeVisibility.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getReturnTypeVisibility.md new file mode 100644 index 0000000000..d9b693307b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getReturnTypeVisibility.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getReturnTypeVisibility" + +--- +```ts +getReturnTypeVisibility(program, entity): string[] | undefined +``` + +Returns the visibilities of the return type of the given operation, if provided with `@returnTypeVisibility`. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `entity` | [`Operation`](../interfaces/Operation.md) | + +## Returns + +## See + +[$returnTypeVisibility]($returnTypeVisibility.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getReturnsDoc.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getReturnsDoc.md new file mode 100644 index 0000000000..57cbc718ae --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getReturnsDoc.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getReturnsDoc" + +--- +```ts +getReturnsDoc(program, target): string | undefined +``` + +Get the documentation string for the return success types of an operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Operation`](../interfaces/Operation.md) | Type | + +## Returns + +Documentation value diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getReturnsDocData.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getReturnsDocData.md new file mode 100644 index 0000000000..dfb32ab10d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getReturnsDocData.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getReturnsDocData" + +--- +```ts +getReturnsDocData(program, target): DocData | undefined +``` + +Get the documentation information for the return success types of an operation. In most cases you probably just want to use [getReturnsDoc](getReturnsDoc.md) + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Operation`](../interfaces/Operation.md) | Type | + +## Returns + +Doc data with source information. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getRootLength.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getRootLength.md new file mode 100644 index 0000000000..146e8f71c4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getRootLength.md @@ -0,0 +1,38 @@ +--- +jsApi: true +title: "[F] getRootLength" + +--- +```ts +getRootLength(path): number +``` + +Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files"). + +For example: +```ts +getRootLength("a") === 0 // "" +getRootLength("/") === 1 // "/" +getRootLength("c:") === 2 // "c:" +getRootLength("c:d") === 0 // "" +getRootLength("c:/") === 3 // "c:/" +getRootLength("c:\\") === 3 // "c:\\" +getRootLength("//server") === 7 // "//server" +getRootLength("//server/share") === 8 // "//server/" +getRootLength("\\\\server") === 7 // "\\\\server" +getRootLength("\\\\server\\share") === 8 // "\\\\server\\" +getRootLength("file:///path") === 8 // "file:///" +getRootLength("file:///c:") === 10 // "file:///c:" +getRootLength("file:///c:d") === 8 // "file:///" +getRootLength("file:///c:/path") === 11 // "file:///c:/" +getRootLength("file://server") === 13 // "file://server" +getRootLength("file://server/path") === 14 // "file://server/" +getRootLength("http://server") === 13 // "http://server" +getRootLength("http://server/path") === 14 // "http://server/" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getService.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getService.md new file mode 100644 index 0000000000..dac6220099 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getService.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getService" + +--- +```ts +getService(program, namespace): Service | undefined +``` + +Get the service information for the given namespace. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Service namespace | + +## Returns + +Service information or undefined if namespace is not a service namespace. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getSourceFileKindFromExt.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getSourceFileKindFromExt.md new file mode 100644 index 0000000000..0519c5c2e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getSourceFileKindFromExt.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] getSourceFileKindFromExt" + +--- +```ts +getSourceFileKindFromExt(path): SourceFileKind | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getSourceLocation.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getSourceLocation.md new file mode 100644 index 0000000000..8715826c64 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getSourceLocation.md @@ -0,0 +1,43 @@ +--- +jsApi: true +title: "[F] getSourceLocation" + +--- +## getSourceLocation(target, options) + +```ts +getSourceLocation(target, options?): SourceLocation +``` + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | +| `options`? | [`SourceLocationOptions`](../interfaces/SourceLocationOptions.md) | + +## getSourceLocation(target, options) + +```ts +getSourceLocation(target, options?): undefined +``` + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | `undefined` \| *typeof* [`NoTarget`](../variables/NoTarget.md) | +| `options`? | [`SourceLocationOptions`](../interfaces/SourceLocationOptions.md) | + +## getSourceLocation(target, options) + +```ts +getSourceLocation(target, options?): SourceLocation | undefined +``` + +### Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | `undefined` \| [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | +| `options`? | [`SourceLocationOptions`](../interfaces/SourceLocationOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getSummary.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getSummary.md new file mode 100644 index 0000000000..2d75b04224 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getSummary.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getSummary" + +--- +```ts +getSummary(program, type): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getTags.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getTags.md new file mode 100644 index 0000000000..5abc746d9f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getTags.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getTags" + +--- +```ts +getTags(program, target): string[] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getTypeName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getTypeName.md new file mode 100644 index 0000000000..f0afc39009 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getTypeName.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getTypeName" + +--- +```ts +getTypeName(type, options?): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) \| [`ValueType`](../interfaces/ValueType.md) | +| `options`? | [`TypeNameOptions`](../interfaces/TypeNameOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getVisibility.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getVisibility.md new file mode 100644 index 0000000000..d1f4c4ff4a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/getVisibility.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getVisibility" + +--- +```ts +getVisibility(program, target): string[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/hasParseError.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/hasParseError.md new file mode 100644 index 0000000000..a79a0b6c81 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/hasParseError.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] hasParseError" + +--- +```ts +hasParseError(node): number | true +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/hasProjectedName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/hasProjectedName.md new file mode 100644 index 0000000000..d4adfd20dd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/hasProjectedName.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[F] hasProjectedName" + +--- +```ts +hasProjectedName( + program, + target, + projectionName): boolean +``` + +Get the projected name of the given entity for the given projection. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Target | +| `projectionName` | `string` | - | + +## Returns + +Projected name for the given projection diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/hasTrailingDirectorySeparator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/hasTrailingDirectorySeparator.md new file mode 100644 index 0000000000..9c12615003 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/hasTrailingDirectorySeparator.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] hasTrailingDirectorySeparator" + +--- +```ts +hasTrailingDirectorySeparator(path): boolean +``` + +Determines whether a path has a trailing separator (`/` or `\\`). + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/ignoreDiagnostics.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/ignoreDiagnostics.md new file mode 100644 index 0000000000..cce487fbd2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/ignoreDiagnostics.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[F] ignoreDiagnostics" + +--- +```ts +ignoreDiagnostics(result): T +``` + +Ignore the diagnostics emitted by the diagnostic accessor pattern and just return the actual result. + +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `result` | [`DiagnosticResult`](../type-aliases/DiagnosticResult.md)<`T`\> | + +## Returns + +Actual result. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/interpolatePath.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/interpolatePath.md new file mode 100644 index 0000000000..313652ce1b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/interpolatePath.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] interpolatePath" + +--- +```ts +interpolatePath(pathTemplate, predefinedVariables): string +``` + +Interpolate a path template + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `pathTemplate` | `string` | Path template | +| `predefinedVariables` | `Record`<`string`, `undefined` \| `string`\> | Variables that can be used in the path template. | + +## Returns diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isAnyDirectorySeparator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isAnyDirectorySeparator.md new file mode 100644 index 0000000000..409e3f1606 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isAnyDirectorySeparator.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] isAnyDirectorySeparator" + +--- +```ts +isAnyDirectorySeparator(charCode): boolean +``` + +Determines whether a charCode corresponds to `/` or ``. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `charCode` | `number` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isArrayModelType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isArrayModelType.md new file mode 100644 index 0000000000..b9217fa59c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isArrayModelType.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isArrayModelType" + +--- +```ts +isArrayModelType(program, type): type is ArrayModelType +``` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | - | +| `type` | [`Model`](../interfaces/Model.md) | Model type | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isCadlValueTypeOf.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isCadlValueTypeOf.md new file mode 100644 index 0000000000..54f967b04e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isCadlValueTypeOf.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] isCadlValueTypeOf" + +--- +```ts +isCadlValueTypeOf(target, expectedType): target is InferredTypeSpecValue +``` + +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](../type-aliases/TypeKind.md) | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | [`TypeSpecValue`](../type-aliases/TypeSpecValue.md) | +| `expectedType` | `K` \| readonly `K`[] | + +## Returns + +## Deprecated + +use isTypeSpecValueTypeOf diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isComment.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isComment.md new file mode 100644 index 0000000000..3d2236928e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isComment.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isComment" + +--- +```ts +isComment(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isDeclaredInNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isDeclaredInNamespace.md new file mode 100644 index 0000000000..d801e0f281 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isDeclaredInNamespace.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] isDeclaredInNamespace" + +--- +```ts +isDeclaredInNamespace( + type, + namespace, + options): boolean +``` + +Check if the given type is declared in the specified namespace or, optionally, its child namespaces. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `type` | \| [`Model`](../interfaces/Model.md) \| [`Interface`](../interfaces/Interface.md) \| [`Enum`](../interfaces/Enum.md) \| [`Namespace`](../interfaces/Namespace.md) \| [`Operation`](../interfaces/Operation.md) | Type | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Namespace | +| `options` | `object` | - | +| `options.recursive`? | `boolean` | - | + +## Returns diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isDeclaredType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isDeclaredType.md new file mode 100644 index 0000000000..f8a99abd28 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isDeclaredType.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[F] isDeclaredType" + +--- +```ts +isDeclaredType(type): boolean +``` + +Check if the type is a declared type. This include: +- non templated type +- template declaration + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isDeprecated.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isDeprecated.md new file mode 100644 index 0000000000..e18babc8df --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isDeprecated.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] isDeprecated" + +--- +```ts +isDeprecated(program, type): boolean +``` + +Check if the given type is deprecated + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `type` | [`Type`](../type-aliases/Type.md) | Type | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isErrorModel.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isErrorModel.md new file mode 100644 index 0000000000..d518300a41 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isErrorModel.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isErrorModel" + +--- +```ts +isErrorModel(program, target): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isErrorType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isErrorType.md new file mode 100644 index 0000000000..7d7dbfe785 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isErrorType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isErrorType" + +--- +```ts +isErrorType(type): type is ErrorType +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isGlobalNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isGlobalNamespace.md new file mode 100644 index 0000000000..e7585f42b9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isGlobalNamespace.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] isGlobalNamespace" + +--- +```ts +isGlobalNamespace(program, namespace): namespace is Namespace & Object +``` + +Check if the given namespace is the global namespace + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Namespace | + +## Returns diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isImportStatement.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isImportStatement.md new file mode 100644 index 0000000000..15c4f80906 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isImportStatement.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isImportStatement" + +--- +```ts +isImportStatement(node): node is ImportStatementNode +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isIntrinsicType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isIntrinsicType.md new file mode 100644 index 0000000000..1de7bd9afa --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isIntrinsicType.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] isIntrinsicType" + +--- +```ts +isIntrinsicType( + program, + type, + kind): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `type` | [`Scalar`](../interfaces/Scalar.md) | +| `kind` | [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isKey.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isKey.md new file mode 100644 index 0000000000..b0e2c670e4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isKey.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isKey" + +--- +```ts +isKey(program, property): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `property` | [`ModelProperty`](../interfaces/ModelProperty.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isKeyword.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isKeyword.md new file mode 100644 index 0000000000..e15e18440b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isKeyword.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isKeyword" + +--- +```ts +isKeyword(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isListOperation.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isListOperation.md new file mode 100644 index 0000000000..a694ab1a7a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isListOperation.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isListOperation" + +--- +```ts +isListOperation(program, target): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Operation`](../interfaces/Operation.md) | + +## Returns + +## Deprecated + +Use `isListOperation` in `@typespec/rest` instead. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isModifier.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isModifier.md new file mode 100644 index 0000000000..de8bf19e0e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isModifier.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isModifier" + +--- +```ts +isModifier(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isNeverType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isNeverType.md new file mode 100644 index 0000000000..a0736e7b10 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isNeverType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isNeverType" + +--- +```ts +isNeverType(type): type is NeverType +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isNullType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isNullType.md new file mode 100644 index 0000000000..33d1d99183 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isNullType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isNullType" + +--- +```ts +isNullType(type): type is NullType +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isNumericType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isNumericType.md new file mode 100644 index 0000000000..4d8ca679a7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isNumericType.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isNumericType" + +--- +```ts +isNumericType(program, target): target is Scalar +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) \| [`ProjectedProgram`](../interfaces/ProjectedProgram.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isPathAbsolute.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isPathAbsolute.md new file mode 100644 index 0000000000..ceb4586309 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isPathAbsolute.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isPathAbsolute" + +--- +```ts +isPathAbsolute(path): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isProjectedProgram.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isProjectedProgram.md new file mode 100644 index 0000000000..51e055c943 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isProjectedProgram.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isProjectedProgram" + +--- +```ts +isProjectedProgram(program): program is ProjectedProgram +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) \| [`ProjectedProgram`](../interfaces/ProjectedProgram.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isPunctuation.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isPunctuation.md new file mode 100644 index 0000000000..5661e7072e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isPunctuation.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isPunctuation" + +--- +```ts +isPunctuation(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isRecordModelType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isRecordModelType.md new file mode 100644 index 0000000000..96d0f644fe --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isRecordModelType.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] isRecordModelType" + +--- +```ts +isRecordModelType(program, type): type is ArrayModelType +``` + +Check if a model is an array type. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | - | +| `type` | [`Model`](../interfaces/Model.md) | Model type | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isSecret.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isSecret.md new file mode 100644 index 0000000000..ae5e2b48a6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isSecret.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isSecret" + +--- +```ts +isSecret(program, target): boolean | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isService.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isService.md new file mode 100644 index 0000000000..8a9f0b3960 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isService.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] isService" + +--- +```ts +isService(program, namespace): boolean +``` + +Check if the namespace is defined as a service. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Namespace | + +## Returns + +Boolean diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isStatementKeyword.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isStatementKeyword.md new file mode 100644 index 0000000000..3bec936aee --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isStatementKeyword.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isStatementKeyword" + +--- +```ts +isStatementKeyword(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isStdNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isStdNamespace.md new file mode 100644 index 0000000000..80924c73d1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isStdNamespace.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isStdNamespace" + +--- +```ts +isStdNamespace(namespace): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isStringType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isStringType.md new file mode 100644 index 0000000000..efd49ecc3b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isStringType.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isStringType" + +--- +```ts +isStringType(program, target): target is Scalar +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) \| [`ProjectedProgram`](../interfaces/ProjectedProgram.md) | +| `target` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTemplateDeclaration.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTemplateDeclaration.md new file mode 100644 index 0000000000..517ed31640 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTemplateDeclaration.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] isTemplateDeclaration" + +--- +```ts +isTemplateDeclaration(type): type is Object +``` + +Resolve if the type is a template type declaration(Non initialized template type). + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`TemplatedType`](../type-aliases/TemplatedType.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTemplateDeclarationOrInstance.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTemplateDeclarationOrInstance.md new file mode 100644 index 0000000000..24d5c94d55 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTemplateDeclarationOrInstance.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] isTemplateDeclarationOrInstance" + +--- +```ts +isTemplateDeclarationOrInstance(type): boolean +``` + +Resolve if the type was created from a template type or is a template type declaration. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`TemplatedType`](../type-aliases/TemplatedType.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTemplateInstance.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTemplateInstance.md new file mode 100644 index 0000000000..06a1f65608 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTemplateInstance.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] isTemplateInstance" + +--- +```ts +isTemplateInstance(type): type is Object +``` + +Check the given type is a finished template instance. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTrivia.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTrivia.md new file mode 100644 index 0000000000..6b02bc0f08 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTrivia.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isTrivia" + +--- +```ts +isTrivia(token): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `token` | [`Token`](../enumerations/Token.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTypeSpecValueTypeOf.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTypeSpecValueTypeOf.md new file mode 100644 index 0000000000..87e9641e04 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isTypeSpecValueTypeOf.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] isTypeSpecValueTypeOf" + +--- +```ts +isTypeSpecValueTypeOf(target, expectedType): target is InferredTypeSpecValue +``` + +Check if the given target is of any of the typespec types. + +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](../type-aliases/TypeKind.md) | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `target` | [`TypeSpecValue`](../type-aliases/TypeSpecValue.md) | Target to validate. | +| `expectedType` | `K` \| readonly `K`[] | One or multiple allowed typespec types. | + +## Returns + +boolean if the target is of one of the allowed types. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isUnknownType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isUnknownType.md new file mode 100644 index 0000000000..39fa7cfefc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isUnknownType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isUnknownType" + +--- +```ts +isUnknownType(type): type is UnknownType +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isUrl.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isUrl.md new file mode 100644 index 0000000000..670d518d6b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isUrl.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] isUrl" + +--- +```ts +isUrl(path): boolean +``` + +Determines whether a path starts with a URL scheme (e.g. starts with `http://`, `ftp://`, `file://`, etc.). + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isVisible.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isVisible.md new file mode 100644 index 0000000000..116add3394 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isVisible.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] isVisible" + +--- +```ts +isVisible( + program, + property, + visibilities): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `property` | [`ModelProperty`](../interfaces/ModelProperty.md) | +| `visibilities` | readonly `string`[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isVoidType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isVoidType.md new file mode 100644 index 0000000000..f8e9b3083f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/isVoidType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] isVoidType" + +--- +```ts +isVoidType(type): type is VoidType +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/joinPaths.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/joinPaths.md new file mode 100644 index 0000000000..761a23b6c7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/joinPaths.md @@ -0,0 +1,32 @@ +--- +jsApi: true +title: "[F] joinPaths" + +--- +```ts +joinPaths(path, ...paths): string +``` + +Combines paths. If a path is absolute, it replaces any previous path. Relative paths are not simplified. + +```ts +// Non-rooted +joinPaths("path", "to", "file.ext") === "path/to/file.ext" +joinPaths("path", "dir", "..", "to", "file.ext") === "path/dir/../to/file.ext" +// POSIX +joinPaths("/path", "to", "file.ext") === "/path/to/file.ext" +joinPaths("/path", "/to", "file.ext") === "/to/file.ext" +// DOS +joinPaths("c:/path", "to", "file.ext") === "c:/path/to/file.ext" +joinPaths("c:/path", "c:/to", "file.ext") === "c:/to/file.ext" +// URL +joinPaths("file:///path", "to", "file.ext") === "file:///path/to/file.ext" +joinPaths("file:///path", "file:///to", "file.ext") === "file:///to/file.ext" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | +| ...`paths` | (`undefined` \| `string`)[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/listOperationsIn.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/listOperationsIn.md new file mode 100644 index 0000000000..7d35fa7450 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/listOperationsIn.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] listOperationsIn" + +--- +```ts +listOperationsIn(container, options): Operation[] +``` + +List operations in the given container. Will list operation recursively by default(Check subnamespaces.) + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `container` | [`Interface`](../interfaces/Interface.md) \| [`Namespace`](../interfaces/Namespace.md) | Container. | +| `options` | [`ListOperationOptions`](../interfaces/ListOperationOptions.md) | Options. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/listServices.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/listServices.md new file mode 100644 index 0000000000..c1c8ac3dec --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/listServices.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[F] listServices" + +--- +```ts +listServices(program): Service[] +``` + +List all the services defined in the typespec program + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | + +## Returns + +List of service. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/logDiagnostics.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/logDiagnostics.md new file mode 100644 index 0000000000..99216e7ad4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/logDiagnostics.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] logDiagnostics" + +--- +```ts +logDiagnostics(diagnostics, logger): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostics` | readonly [`Diagnostic`](../interfaces/Diagnostic.md)[] | +| `logger` | [`LogSink`](../interfaces/LogSink.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/logVerboseTestOutput.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/logVerboseTestOutput.md new file mode 100644 index 0000000000..064ff7e617 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/logVerboseTestOutput.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[F] logVerboseTestOutput" + +--- +```ts +logVerboseTestOutput(messageOrCallback): void +``` + +Verbose output is enabled by default for runs in mocha explorer in VS Code, +where the output is nicely associated with the individual test, and disabled +by default for command line runs where we don't want to spam the console. + +If the steps taken to produce the message are expensive, pass a callback +instead of producing the message then passing it here only to be dropped +when verbose output is disabled. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `messageOrCallback` | `string` \| (`log`) => `void` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/mapEventEmitterToNodeListener.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/mapEventEmitterToNodeListener.md new file mode 100644 index 0000000000..1d8cdc6aae --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/mapEventEmitterToNodeListener.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[F] mapEventEmitterToNodeListener" + +--- +```ts +mapEventEmitterToNodeListener(eventEmitter): SemanticNodeListener +``` + +Create a Semantic node listener from an event emitter. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `eventEmitter` | [`EventEmitter`](../classes/EventEmitter.md)<[`SemanticNodeListener`](../type-aliases/SemanticNodeListener.md)\> | Event emitter. | + +## Returns + +Semantic node listener. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/markDeprecated.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/markDeprecated.md new file mode 100644 index 0000000000..c65ddb6121 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/markDeprecated.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] markDeprecated" + +--- +```ts +markDeprecated( + program, + type, + details): void +``` + +Mark the given type as deprecated with the provided details. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `type` | [`Type`](../type-aliases/Type.md) | Type | +| `details` | [`DeprecationDetails`](../interfaces/DeprecationDetails.md) | Details of the deprecation | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/navigateProgram.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/navigateProgram.md new file mode 100644 index 0000000000..6f3fdc9654 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/navigateProgram.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] navigateProgram" + +--- +```ts +navigateProgram( + program, + listeners, + options): void +``` + +Navigate all types in the program. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program to navigate. | +| `listeners` | [`SemanticNodeListener`](../type-aliases/SemanticNodeListener.md) | Listener called when visiting types. | +| `options` | [`NavigationOptions`](../interfaces/NavigationOptions.md) | Navigation options. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/navigateType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/navigateType.md new file mode 100644 index 0000000000..c9d47f66b2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/navigateType.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] navigateType" + +--- +```ts +navigateType( + type, + listeners, + options): void +``` + +Navigate the given type and all the types that are used in it. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | Type to navigate. | +| `listeners` | [`SemanticNodeListener`](../type-aliases/SemanticNodeListener.md) | Listener for the types found. | +| `options` | [`NavigationOptions`](../interfaces/NavigationOptions.md) | Navigation options | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/navigateTypesInNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/navigateTypesInNamespace.md new file mode 100644 index 0000000000..c827c67660 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/navigateTypesInNamespace.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] navigateTypesInNamespace" + +--- +```ts +navigateTypesInNamespace( + namespace, + listeners, + options): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | +| `listeners` | `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` | +| `options` | [`NamespaceNavigationOptions`](../interfaces/NamespaceNavigationOptions.md) & [`NavigationOptions`](../interfaces/NavigationOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/normalizePath.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/normalizePath.md new file mode 100644 index 0000000000..74a9fceadf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/normalizePath.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] normalizePath" + +--- +```ts +normalizePath(path): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/normalizeSlashes.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/normalizeSlashes.md new file mode 100644 index 0000000000..9ed7a2775e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/normalizeSlashes.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[F] normalizeSlashes" + +--- +```ts +normalizeSlashes(path): string +``` + +Normalize path separators, converting `\` into `/`. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/paramMessage.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/paramMessage.md new file mode 100644 index 0000000000..e75e773936 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/paramMessage.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] paramMessage" + +--- +```ts +paramMessage(strings, ...keys): CallableMessage +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `string`[] | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `strings` | readonly `string`[] | +| ...`keys` | `T` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/parse.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/parse.md new file mode 100644 index 0000000000..07ce67685c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/parse.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] parse" + +--- +```ts +parse(code, options): TypeSpecScriptNode +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `string` \| [`SourceFile`](../interfaces/SourceFile.md) | +| `options` | [`ParseOptions`](../interfaces/ParseOptions.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/parseStandaloneTypeReference.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/parseStandaloneTypeReference.md new file mode 100644 index 0000000000..9f01d158d4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/parseStandaloneTypeReference.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] parseStandaloneTypeReference" + +--- +```ts +parseStandaloneTypeReference(code): [TypeReferenceNode, readonly Diagnostic[]] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `code` | `string` \| [`SourceFile`](../interfaces/SourceFile.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/projectProgram.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/projectProgram.md new file mode 100644 index 0000000000..7ce0f39a58 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/projectProgram.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] projectProgram" + +--- +```ts +projectProgram( + program, + projections, + startNode?): ProjectedProgram +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | +| `projections` | [`ProjectionApplication`](../interfaces/ProjectionApplication.md)[] | +| `startNode`? | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/reducePathComponents.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/reducePathComponents.md new file mode 100644 index 0000000000..d1c1773efe --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/reducePathComponents.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] reducePathComponents" + +--- +```ts +reducePathComponents(components): string[] +``` + +Reduce an array of path components to a more simplified path by navigating any +`"."` or `".."` entries in the path. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `components` | readonly `string`[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/removeTrailingDirectorySeparator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/removeTrailingDirectorySeparator.md new file mode 100644 index 0000000000..63b171f7dd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/removeTrailingDirectorySeparator.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] removeTrailingDirectorySeparator" + +--- +```ts +removeTrailingDirectorySeparator(path): string +``` + +Removes a trailing directory separator from a path, if it does not already have one. + +```ts +removeTrailingDirectorySeparator("/path/to/file.ext") === "/path/to/file.ext" +removeTrailingDirectorySeparator("/path/to/file.ext/") === "/path/to/file.ext" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/reportDeprecated.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/reportDeprecated.md new file mode 100644 index 0000000000..77840af0f3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/reportDeprecated.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] reportDeprecated" + +--- +```ts +reportDeprecated( + program, + message, + target): void +``` + +Report a deprecated diagnostic. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | TypeSpec Program. | +| `message` | `string` | Message describing the deprecation. | +| `target` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | Target of the deprecation. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolveCompilerOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolveCompilerOptions.md new file mode 100644 index 0000000000..b8db05d492 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolveCompilerOptions.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] resolveCompilerOptions" + +--- +```ts +resolveCompilerOptions(host, options): Promise<[CompilerOptions, readonly Diagnostic[]]> +``` + +Resolve the compiler options for the given entrypoint by resolving the tspconfig.yaml. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `host` | [`CompilerHost`](../interfaces/CompilerHost.md) | Compiler host | +| `options` | [`ResolveCompilerOptionsOptions`](../interfaces/ResolveCompilerOptionsOptions.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolveModule.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolveModule.md new file mode 100644 index 0000000000..4f233e9c6b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolveModule.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] resolveModule" + +--- +```ts +resolveModule( + host, + name, +options): Promise +``` + +Resolve a module + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `host` | [`ResolveModuleHost`](../interfaces/ResolveModuleHost.md) | | +| `name` | `string` | | +| `options` | [`ResolveModuleOptions`](../interfaces/ResolveModuleOptions.md) | | + +## Returns diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolvePath.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolvePath.md new file mode 100644 index 0000000000..b9c37cfbdd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolvePath.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] resolvePath" + +--- +```ts +resolvePath(path, ...paths): string +``` + +Combines and resolves paths. If a path is absolute, it replaces any previous path. Any +`.` and `..` path components are resolved. Trailing directory separators are preserved. + +```ts +resolvePath("/path", "to", "file.ext") === "path/to/file.ext" +resolvePath("/path", "to", "file.ext/") === "path/to/file.ext/" +resolvePath("/path", "dir", "..", "to", "file.ext") === "path/to/file.ext" +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | +| ...`paths` | (`undefined` \| `string`)[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolveUsages.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolveUsages.md new file mode 100644 index 0000000000..8e45b17886 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/resolveUsages.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] resolveUsages" + +--- +```ts +resolveUsages(types): UsageTracker +``` + +Resolve usage(input, output or both) of various types in the given namespace. +Will recursively scan all namespace, interfaces and operations contained inside the namespace. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `types` | [`OperationContainer`](../type-aliases/OperationContainer.md) \| [`OperationContainer`](../type-aliases/OperationContainer.md)[] | Entrypoint(s) namespace, interface or operations to get usage from. | + +## Returns + +Map of types to usage. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/scopeNavigationToNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/scopeNavigationToNamespace.md new file mode 100644 index 0000000000..2cb3d7998a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/scopeNavigationToNamespace.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[F] scopeNavigationToNamespace" + +--- +```ts +scopeNavigationToNamespace( + namespace, + listeners, + options): T +``` + +Scope the current navigation to the given namespace. + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` & `object` | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `namespace` | [`Namespace`](../interfaces/Namespace.md) | Namespace the traversal shouldn't leave. | +| `listeners` | `T` | Type listeners. | +| `options` | [`NamespaceNavigationOptions`](../interfaces/NamespaceNavigationOptions.md) | Scope options | + +## Returns + +wrapped listeners that that can be used with `navigateType` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/setCadlNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/setCadlNamespace.md new file mode 100644 index 0000000000..b72dd7e61f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/setCadlNamespace.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] setCadlNamespace" + +--- +```ts +setCadlNamespace(namespace, ...functions): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `namespace` | `string` | +| ...`functions` | (...`args`) => `any`[] | + +## Returns + +## Deprecated + +use setTypeSpecNamespace diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/setTypeSpecNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/setTypeSpecNamespace.md new file mode 100644 index 0000000000..c136758acf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/setTypeSpecNamespace.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] setTypeSpecNamespace" + +--- +```ts +setTypeSpecNamespace(namespace, ...functions): void +``` + +Set the TypeSpec namespace for that function. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `namespace` | `string` | Namespace string (e.g. "Foo.Bar") | +| ...`functions` | (...`args`) => `any`[] | Functions | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/skipTrivia.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/skipTrivia.md new file mode 100644 index 0000000000..aa72c70d31 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/skipTrivia.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] skipTrivia" + +--- +```ts +skipTrivia( + input, + position, + endPosition): number +``` + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `input` | `string` | `undefined` | +| `position` | `number` | `undefined` | +| `endPosition` | `number` | `input.length` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/skipWhiteSpace.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/skipWhiteSpace.md new file mode 100644 index 0000000000..d4c22456b7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/skipWhiteSpace.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] skipWhiteSpace" + +--- +```ts +skipWhiteSpace( + input, + position, + endPosition): number +``` + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `input` | `string` | `undefined` | +| `position` | `number` | `undefined` | +| `endPosition` | `number` | `input.length` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/typespecTypeToJson.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/typespecTypeToJson.md new file mode 100644 index 0000000000..5dcd158e9c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/typespecTypeToJson.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] typespecTypeToJson" + +--- +```ts +typespecTypeToJson(typespecType, target): [T | undefined, Diagnostic[]] +``` + +Convert a typespec type to a serializable Json object. +Emits diagnostics if the given type is invalid + +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `typespecType` | [`TypeSpecValue`](../type-aliases/TypeSpecValue.md) | The type to convert to Json data | +| `target` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | The diagnostic target in case of errors. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorNotOnType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorNotOnType.md new file mode 100644 index 0000000000..9cb27e6dcc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorNotOnType.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[F] validateDecoratorNotOnType" + +--- +```ts +validateDecoratorNotOnType( + context, + type, + badDecorator, + givenDecorator): boolean +``` + +Validate that a given decorator is not on a type or any of its base types. +Useful to check for decorator usage that conflicts with another decorator. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | Decorator context | +| `type` | [`Type`](../type-aliases/Type.md) | The type to check | +| `badDecorator` | [`DecoratorFunction`](../interfaces/DecoratorFunction.md) | The decorator we don't want present | +| `givenDecorator` | [`DecoratorFunction`](../interfaces/DecoratorFunction.md) | The decorator that is the reason why we don't want the bad decorator present | + +## Returns + +Whether the decorator application is valid diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorParamCount.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorParamCount.md new file mode 100644 index 0000000000..444c244585 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorParamCount.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] validateDecoratorParamCount" + +--- +```ts +validateDecoratorParamCount( + context, + min, + max, + parameters): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `min` | `number` | +| `max` | `undefined` \| `number` | +| `parameters` | `unknown`[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorParamType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorParamType.md new file mode 100644 index 0000000000..ee03f0ec48 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorParamType.md @@ -0,0 +1,62 @@ +--- +jsApi: true +title: "[F] validateDecoratorParamType" + +--- +```ts +validateDecoratorParamType( + program, + target, + value, + expectedType): value is InferredTypeSpecValue +``` + +Validate a decorator parameter has the correct type. + +## Type parameters + +| Parameter | +| :------ | +| `K` extends + \| `"Model"` + \| `"ModelProperty"` + \| `"Scalar"` + \| `"Interface"` + \| `"Enum"` + \| `"EnumMember"` + \| `"TemplateParameter"` + \| `"Namespace"` + \| `"Operation"` + \| `"String"` + \| `"Number"` + \| `"Boolean"` + \| `"Tuple"` + \| `"Union"` + \| `"UnionVariant"` + \| `"Intrinsic"` + \| `"Function"` + \| `"Decorator"` + \| `"FunctionParameter"` + \| `"Object"` + \| `"Projection"` | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | [`Program`](../interfaces/Program.md) | Program | +| `target` | [`Type`](../type-aliases/Type.md) | Decorator target | +| `value` | [`TypeSpecValue`](../type-aliases/TypeSpecValue.md) | Value of the parameter. | +| `expectedType` | `K` \| `K`[] | Expected type or list of expected type | + +## Returns + +true if the value is of one of the type in the list of expected types. If not emit a diagnostic. + +## Deprecated + +use + +## See + +createDecoratorDefinition#validate instead. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorTarget.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorTarget.md new file mode 100644 index 0000000000..a19d37a2c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorTarget.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[F] validateDecoratorTarget" + +--- +```ts +validateDecoratorTarget( + context, + target, + decoratorName, + expectedType): target is K extends "Any" ? Type : Object +``` + +Validate the decorator target is matching the expected value. + +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](../type-aliases/TypeKind.md) | + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | - | +| `target` | [`Type`](../type-aliases/Type.md) | | +| `decoratorName` | `string` | | +| `expectedType` | `K` \| readonly `K`[] | | + +## Returns diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorTargetIntrinsic.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorTargetIntrinsic.md new file mode 100644 index 0000000000..a9712bc109 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorTargetIntrinsic.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] validateDecoratorTargetIntrinsic" + +--- +```ts +validateDecoratorTargetIntrinsic( + context, + target, + decoratorName, + expectedType): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `target` | [`ModelProperty`](../interfaces/ModelProperty.md) \| [`Scalar`](../interfaces/Scalar.md) | +| `decoratorName` | `string` | +| `expectedType` | [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md) \| [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md)[] | + +## Returns + +## Deprecated + +this function is deprecated use decorator definition in typespec instead or check assignability directly. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorUniqueOnNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorUniqueOnNode.md new file mode 100644 index 0000000000..a69903de5c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/validateDecoratorUniqueOnNode.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] validateDecoratorUniqueOnNode" + +--- +```ts +validateDecoratorUniqueOnNode( + context, + type, + decorator): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](../interfaces/DecoratorContext.md) | +| `type` | [`Type`](../type-aliases/Type.md) | +| `decorator` | [`DecoratorFunction`](../interfaces/DecoratorFunction.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/visitChildren.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/visitChildren.md new file mode 100644 index 0000000000..6dee1450e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/visitChildren.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] visitChildren" + +--- +```ts +visitChildren(node, cb): T | undefined +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | +| `cb` | [`NodeCallback`](../type-aliases/NodeCallback.md)<`T`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/walkPropertiesInherited.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/walkPropertiesInherited.md new file mode 100644 index 0000000000..76771e5930 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/functions/walkPropertiesInherited.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] walkPropertiesInherited" + +--- +```ts +walkPropertiesInherited(model): Generator +``` + +Enumerates the properties declared by model or inherited from its base. + +Properties declared by more derived types are enumerated before properties +of less derived types. + +Properties that are overridden are not enumerated. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `model` | [`Model`](../interfaces/Model.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/index.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/index.md new file mode 100644 index 0000000000..e43e6e9225 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/index.md @@ -0,0 +1,541 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Enumerations + +- [IdentifierKind](enumerations/IdentifierKind.md) +- [ListenerFlow](enumerations/ListenerFlow.md) +- [ModifierFlags](enumerations/ModifierFlags.md) +- [NodeFlags](enumerations/NodeFlags.md) +- [SemanticTokenKind](enumerations/SemanticTokenKind.md) +- [SymbolFlags](enumerations/SymbolFlags.md) +- [SyntaxKind](enumerations/SyntaxKind.md) +- [Token](enumerations/Token.md) +- [TokenFlags](enumerations/TokenFlags.md) +- [UsageFlags](enumerations/UsageFlags.md) + +### Classes + +- [DuplicateTracker](classes/DuplicateTracker.md) +- [EventEmitter](classes/EventEmitter.md) +- [InvalidEncodingError](classes/InvalidEncodingError.md) +- [ProjectionError](classes/ProjectionError.md) +- [Queue](classes/Queue.md) +- [ResolveModuleError](classes/ResolveModuleError.md) + +### Interfaces + +- [AliasStatementNode](interfaces/AliasStatementNode.md) +- [AnyKeywordNode](interfaces/AnyKeywordNode.md) +- [ArrayExpressionNode](interfaces/ArrayExpressionNode.md) +- [ArrayModelType](interfaces/ArrayModelType.md) +- [AugmentDecoratorStatementNode](interfaces/AugmentDecoratorStatementNode.md) +- [BaseNode](interfaces/BaseNode.md) +- [BaseType](interfaces/BaseType.md) +- [BlockComment](interfaces/BlockComment.md) +- [BooleanLiteral](interfaces/BooleanLiteral.md) +- [BooleanLiteralNode](interfaces/BooleanLiteralNode.md) +- [CallableMessage](interfaces/CallableMessage.md) +- [Checker](interfaces/Checker.md) +- [CompilerHost](interfaces/CompilerHost.md) +- [CompilerLocationContext](interfaces/CompilerLocationContext.md) +- [CompilerOptions](interfaces/CompilerOptions.md) +- [DeclarationNode](interfaces/DeclarationNode.md) +- [DecoratedType](interfaces/DecoratedType.md) +- [Decorator](interfaces/Decorator.md) +- [DecoratorApplication](interfaces/DecoratorApplication.md) +- [DecoratorArgument](interfaces/DecoratorArgument.md) +- [DecoratorContext](interfaces/DecoratorContext.md) +- [DecoratorDeclarationStatementNode](interfaces/DecoratorDeclarationStatementNode.md) +- [DecoratorDefinition](interfaces/DecoratorDefinition.md) +- [DecoratorExpressionNode](interfaces/DecoratorExpressionNode.md) +- [DecoratorFunction](interfaces/DecoratorFunction.md) +- [DecoratorParamDefinition](interfaces/DecoratorParamDefinition.md) +- [DecoratorValidator](interfaces/DecoratorValidator.md) +- [DeprecatedDirective](interfaces/DeprecatedDirective.md) +- [DeprecationDetails](interfaces/DeprecationDetails.md) +- [Diagnostic](interfaces/Diagnostic.md) +- [DiagnosticCollector](interfaces/DiagnosticCollector.md) +- [DiagnosticCreator](interfaces/DiagnosticCreator.md) +- [DiagnosticDefinition](interfaces/DiagnosticDefinition.md) +- [DiagnosticMessages](interfaces/DiagnosticMessages.md) +- [DirectiveBase](interfaces/DirectiveBase.md) +- [DirectiveExpressionNode](interfaces/DirectiveExpressionNode.md) +- [Dirent](interfaces/Dirent.md) +- [DiscriminatedUnion](interfaces/DiscriminatedUnion.md) +- [Discriminator](interfaces/Discriminator.md) +- [DocData](interfaces/DocData.md) +- [DocErrorsTagNode](interfaces/DocErrorsTagNode.md) +- [DocNode](interfaces/DocNode.md) +- [DocParamTagNode](interfaces/DocParamTagNode.md) +- [DocReturnsTagNode](interfaces/DocReturnsTagNode.md) +- [DocTagBaseNode](interfaces/DocTagBaseNode.md) +- [DocTemplateTagNode](interfaces/DocTemplateTagNode.md) +- [DocTextNode](interfaces/DocTextNode.md) +- [DocUnknownTagNode](interfaces/DocUnknownTagNode.md) +- [EmitContext](interfaces/EmitContext.md) +- [EmitFileOptions](interfaces/EmitFileOptions.md) +- [EmptyStatementNode](interfaces/EmptyStatementNode.md) +- [EncodeData](interfaces/EncodeData.md) +- [Enum](interfaces/Enum.md) +- [EnumMember](interfaces/EnumMember.md) +- [EnumMemberNode](interfaces/EnumMemberNode.md) +- [EnumSpreadMemberNode](interfaces/EnumSpreadMemberNode.md) +- [EnumStatementNode](interfaces/EnumStatementNode.md) +- [ErrorType](interfaces/ErrorType.md) +- [ExternKeywordNode](interfaces/ExternKeywordNode.md) +- [FileLibraryMetadata](interfaces/FileLibraryMetadata.md) +- [FunctionDeclarationStatementNode](interfaces/FunctionDeclarationStatementNode.md) +- [FunctionParameter](interfaces/FunctionParameter.md) +- [FunctionParameterNode](interfaces/FunctionParameterNode.md) +- [FunctionType](interfaces/FunctionType.md) +- [IdentifierContext](interfaces/IdentifierContext.md) +- [IdentifierNode](interfaces/IdentifierNode.md) +- [ImportStatementNode](interfaces/ImportStatementNode.md) +- [Interface](interfaces/Interface.md) +- [InterfaceStatementNode](interfaces/InterfaceStatementNode.md) +- [IntersectionExpressionNode](interfaces/IntersectionExpressionNode.md) +- [IntrinsicType](interfaces/IntrinsicType.md) +- [InvalidStatementNode](interfaces/InvalidStatementNode.md) +- [JSONSchemaValidator](interfaces/JSONSchemaValidator.md) +- [JsNamespaceDeclarationNode](interfaces/JsNamespaceDeclarationNode.md) +- [JsSourceFileNode](interfaces/JsSourceFileNode.md) +- [LibraryInstance](interfaces/LibraryInstance.md) +- [LibraryLocationContext](interfaces/LibraryLocationContext.md) +- [LineAndCharacter](interfaces/LineAndCharacter.md) +- [LineComment](interfaces/LineComment.md) +- [LinterDefinition](interfaces/LinterDefinition.md) +- [LinterRule](interfaces/LinterRule.md) +- [LinterRuleContext](interfaces/LinterRuleContext.md) +- [LinterRuleDefinition](interfaces/LinterRuleDefinition.md) +- [LinterRuleSet](interfaces/LinterRuleSet.md) +- [ListOperationOptions](interfaces/ListOperationOptions.md) +- [LogInfo](interfaces/LogInfo.md) +- [LogSink](interfaces/LogSink.md) +- [Logger](interfaces/Logger.md) +- [MemberExpressionNode](interfaces/MemberExpressionNode.md) +- [Model](interfaces/Model.md) +- [ModelExpressionNode](interfaces/ModelExpressionNode.md) +- [ModelProperty](interfaces/ModelProperty.md) +- [ModelPropertyNode](interfaces/ModelPropertyNode.md) +- [ModelSpreadPropertyNode](interfaces/ModelSpreadPropertyNode.md) +- [ModelStatementNode](interfaces/ModelStatementNode.md) +- [ModuleLibraryMetadata](interfaces/ModuleLibraryMetadata.md) +- [Namespace](interfaces/Namespace.md) +- [NamespaceNavigationOptions](interfaces/NamespaceNavigationOptions.md) +- [NamespaceStatementNode](interfaces/NamespaceStatementNode.md) +- [NavigationOptions](interfaces/NavigationOptions.md) +- [NeverKeywordNode](interfaces/NeverKeywordNode.md) +- [NeverType](interfaces/NeverType.md) +- [NodePackage](interfaces/NodePackage.md) +- [NullType](interfaces/NullType.md) +- [NumericLiteral](interfaces/NumericLiteral.md) +- [NumericLiteralNode](interfaces/NumericLiteralNode.md) +- [ObjectType](interfaces/ObjectType.md) +- [Operation](interfaces/Operation.md) +- [OperationSignatureDeclarationNode](interfaces/OperationSignatureDeclarationNode.md) +- [OperationSignatureReferenceNode](interfaces/OperationSignatureReferenceNode.md) +- [OperationStatementNode](interfaces/OperationStatementNode.md) +- [ParseOptions](interfaces/ParseOptions.md) +- [ProcessedLog](interfaces/ProcessedLog.md) +- [Program](interfaces/Program.md) +- [ProjectLocationContext](interfaces/ProjectLocationContext.md) +- [ProjectedNameView](interfaces/ProjectedNameView.md) +- [ProjectedProgram](interfaces/ProjectedProgram.md) +- [Projection](interfaces/Projection.md) +- [ProjectionApplication](interfaces/ProjectionApplication.md) +- [ProjectionArithmeticExpressionNode](interfaces/ProjectionArithmeticExpressionNode.md) +- [ProjectionBlockExpressionNode](interfaces/ProjectionBlockExpressionNode.md) +- [ProjectionCallExpressionNode](interfaces/ProjectionCallExpressionNode.md) +- [ProjectionDecoratorReferenceExpressionNode](interfaces/ProjectionDecoratorReferenceExpressionNode.md) +- [ProjectionEnumMemberSelectorNode](interfaces/ProjectionEnumMemberSelectorNode.md) +- [ProjectionEnumSelectorNode](interfaces/ProjectionEnumSelectorNode.md) +- [ProjectionEqualityExpressionNode](interfaces/ProjectionEqualityExpressionNode.md) +- [ProjectionExpressionStatementNode](interfaces/ProjectionExpressionStatementNode.md) +- [ProjectionIfExpressionNode](interfaces/ProjectionIfExpressionNode.md) +- [ProjectionInterfaceSelectorNode](interfaces/ProjectionInterfaceSelectorNode.md) +- [ProjectionLambdaExpressionNode](interfaces/ProjectionLambdaExpressionNode.md) +- [ProjectionLambdaParameterDeclarationNode](interfaces/ProjectionLambdaParameterDeclarationNode.md) +- [ProjectionLogicalExpressionNode](interfaces/ProjectionLogicalExpressionNode.md) +- [ProjectionMemberExpressionNode](interfaces/ProjectionMemberExpressionNode.md) +- [ProjectionModelExpressionNode](interfaces/ProjectionModelExpressionNode.md) +- [ProjectionModelPropertyNode](interfaces/ProjectionModelPropertyNode.md) +- [ProjectionModelPropertySelectorNode](interfaces/ProjectionModelPropertySelectorNode.md) +- [ProjectionModelSelectorNode](interfaces/ProjectionModelSelectorNode.md) +- [ProjectionModelSpreadPropertyNode](interfaces/ProjectionModelSpreadPropertyNode.md) +- [ProjectionNode](interfaces/ProjectionNode.md) +- [ProjectionOperationSelectorNode](interfaces/ProjectionOperationSelectorNode.md) +- [ProjectionParameterDeclarationNode](interfaces/ProjectionParameterDeclarationNode.md) +- [ProjectionReferenceNode](interfaces/ProjectionReferenceNode.md) +- [ProjectionRelationalExpressionNode](interfaces/ProjectionRelationalExpressionNode.md) +- [ProjectionStatementNode](interfaces/ProjectionStatementNode.md) +- [ProjectionTupleExpressionNode](interfaces/ProjectionTupleExpressionNode.md) +- [ProjectionUnaryExpressionNode](interfaces/ProjectionUnaryExpressionNode.md) +- [ProjectionUnionSelectorNode](interfaces/ProjectionUnionSelectorNode.md) +- [ProjectionUnionVariantSelectorNode](interfaces/ProjectionUnionVariantSelectorNode.md) +- [Projector](interfaces/Projector.md) +- [RecordModelType](interfaces/RecordModelType.md) +- [ResolveCompilerOptionsOptions](interfaces/ResolveCompilerOptionsOptions.md) +- [ResolveModuleHost](interfaces/ResolveModuleHost.md) +- [ResolveModuleOptions](interfaces/ResolveModuleOptions.md) +- [ResolvedFile](interfaces/ResolvedFile.md) +- [ResolvedModule](interfaces/ResolvedModule.md) +- [ReturnExpressionNode](interfaces/ReturnExpressionNode.md) +- [ReturnRecord](interfaces/ReturnRecord.md) +- [RmOptions](interfaces/RmOptions.md) +- [Scalar](interfaces/Scalar.md) +- [ScalarStatementNode](interfaces/ScalarStatementNode.md) +- [Scanner](interfaces/Scanner.md) +- [SemanticToken](interfaces/SemanticToken.md) +- [Server](interfaces/Server.md) +- [ServerHost](interfaces/ServerHost.md) +- [ServerSourceFile](interfaces/ServerSourceFile.md) +- [ServerWorkspaceFolder](interfaces/ServerWorkspaceFolder.md) +- [Service](interfaces/Service.md) +- [ServiceDetails](interfaces/ServiceDetails.md) +- [SourceFile](interfaces/SourceFile.md) +- [SourceLocation](interfaces/SourceLocation.md) +- [SourceLocationOptions](interfaces/SourceLocationOptions.md) +- [StringLiteral](interfaces/StringLiteral.md) +- [StringLiteralNode](interfaces/StringLiteralNode.md) +- [SuppressDirective](interfaces/SuppressDirective.md) +- [Sym](interfaces/Sym.md) +- [SymbolLinks](interfaces/SymbolLinks.md) +- [SyntheticLocationContext](interfaces/SyntheticLocationContext.md) +- [TemplateDeclarationNode](interfaces/TemplateDeclarationNode.md) +- [TemplateParameter](interfaces/TemplateParameter.md) +- [TemplateParameterDeclarationNode](interfaces/TemplateParameterDeclarationNode.md) +- [TemplatedTypeBase](interfaces/TemplatedTypeBase.md) +- [TextRange](interfaces/TextRange.md) +- [Tracer](interfaces/Tracer.md) +- [TracerOptions](interfaces/TracerOptions.md) +- [Tuple](interfaces/Tuple.md) +- [TupleExpressionNode](interfaces/TupleExpressionNode.md) +- [TypeInstantiationMap](interfaces/TypeInstantiationMap.md) +- [TypeMapper](interfaces/TypeMapper.md) +- [TypeNameOptions](interfaces/TypeNameOptions.md) +- [TypeReferenceNode](interfaces/TypeReferenceNode.md) +- [TypeSpecCompletionItem](interfaces/TypeSpecCompletionItem.md) +- [TypeSpecLibrary](interfaces/TypeSpecLibrary.md) +- [TypeSpecLibraryDef](interfaces/TypeSpecLibraryDef.md) +- [TypeSpecManifest](interfaces/TypeSpecManifest.md) +- [TypeSpecScriptNode](interfaces/TypeSpecScriptNode.md) +- [Union](interfaces/Union.md) +- [UnionExpressionNode](interfaces/UnionExpressionNode.md) +- [UnionStatementNode](interfaces/UnionStatementNode.md) +- [UnionVariant](interfaces/UnionVariant.md) +- [UnionVariantNode](interfaces/UnionVariantNode.md) +- [UnknownType](interfaces/UnknownType.md) +- [UsageTracker](interfaces/UsageTracker.md) +- [UsingStatementNode](interfaces/UsingStatementNode.md) +- [ValueOfExpressionNode](interfaces/ValueOfExpressionNode.md) +- [ValueType](interfaces/ValueType.md) +- [VoidKeywordNode](interfaces/VoidKeywordNode.md) +- [VoidType](interfaces/VoidType.md) + +### Type Aliases + +- [BytesKnownEncoding](type-aliases/BytesKnownEncoding.md) +- [CadlCompletionItem](type-aliases/CadlCompletionItem.md) +- [CadlLibrary](type-aliases/CadlLibrary.md) +- [CadlLibraryDef](type-aliases/CadlLibraryDef.md) +- [CadlManifest](type-aliases/CadlManifest.md) +- [CadlScriptNode](type-aliases/CadlScriptNode.md) +- [CadlValue](type-aliases/CadlValue.md) +- [Comment](type-aliases/Comment.md) +- [CreateTypeProps](type-aliases/CreateTypeProps.md) +- [DateTimeKnownEncoding](type-aliases/DateTimeKnownEncoding.md) +- [Declaration](type-aliases/Declaration.md) +- [DecoratorArgumentValue](type-aliases/DecoratorArgumentValue.md) +- [DiagnosticFormat](type-aliases/DiagnosticFormat.md) +- [DiagnosticHandler](type-aliases/DiagnosticHandler.md) +- [DiagnosticMap](type-aliases/DiagnosticMap.md) +- [DiagnosticReport](type-aliases/DiagnosticReport.md) +- [DiagnosticReportWithoutTarget](type-aliases/DiagnosticReportWithoutTarget.md) +- [DiagnosticResult](type-aliases/DiagnosticResult.md) +- [DiagnosticSeverity](type-aliases/DiagnosticSeverity.md) +- [DiagnosticTarget](type-aliases/DiagnosticTarget.md) +- [Directive](type-aliases/Directive.md) +- [DirectiveArgument](type-aliases/DirectiveArgument.md) +- [DocContent](type-aliases/DocContent.md) +- [DocTag](type-aliases/DocTag.md) +- [DocToken](type-aliases/DocToken.md) +- [DurationKnownEncoding](type-aliases/DurationKnownEncoding.md) +- [EmitOptionsFor](type-aliases/EmitOptionsFor.md) +- [EmitterFunc](type-aliases/EmitterFunc.md) +- [Expression](type-aliases/Expression.md) +- [InferredCadlValue](type-aliases/InferredCadlValue.md) +- [InferredTypeSpecValue](type-aliases/InferredTypeSpecValue.md) +- [IntrinsicScalarName](type-aliases/IntrinsicScalarName.md) +- [JSONSchemaType](type-aliases/JSONSchemaType.md) +- [LibraryMetadata](type-aliases/LibraryMetadata.md) +- [LinterRuleDiagnosticFormat](type-aliases/LinterRuleDiagnosticFormat.md) +- [LinterRuleDiagnosticReport](type-aliases/LinterRuleDiagnosticReport.md) +- [LinterRuleDiagnosticReportWithoutTarget](type-aliases/LinterRuleDiagnosticReportWithoutTarget.md) +- [LiteralNode](type-aliases/LiteralNode.md) +- [LiteralType](type-aliases/LiteralType.md) +- [LocationContext](type-aliases/LocationContext.md) +- [LogLevel](type-aliases/LogLevel.md) +- [MarshalledValue](type-aliases/MarshalledValue.md) +- [MemberContainerNode](type-aliases/MemberContainerNode.md) +- [MemberContainerType](type-aliases/MemberContainerType.md) +- [MemberNode](type-aliases/MemberNode.md) +- [MemberType](type-aliases/MemberType.md) +- [ModelIndexer](type-aliases/ModelIndexer.md) +- [Modifier](type-aliases/Modifier.md) +- [ModuleResolutionResult](type-aliases/ModuleResolutionResult.md) +- [NeverIndexer](type-aliases/NeverIndexer.md) +- [NewLine](type-aliases/NewLine.md) +- [Node](type-aliases/Node.md) +- [NodeCallback](type-aliases/NodeCallback.md) +- [OperationContainer](type-aliases/OperationContainer.md) +- [OperationSignature](type-aliases/OperationSignature.md) +- [ProjectionExpression](type-aliases/ProjectionExpression.md) +- [ProjectionStatementItem](type-aliases/ProjectionStatementItem.md) +- [ReferenceExpression](type-aliases/ReferenceExpression.md) +- [RuleRef](type-aliases/RuleRef.md) +- [ScopeNode](type-aliases/ScopeNode.md) +- [SemanticNodeListener](type-aliases/SemanticNodeListener.md) +- [SourceFileKind](type-aliases/SourceFileKind.md) +- [Statement](type-aliases/Statement.md) +- [StdTypeName](type-aliases/StdTypeName.md) +- [StdTypes](type-aliases/StdTypes.md) +- [TemplateableNode](type-aliases/TemplateableNode.md) +- [TemplatedType](type-aliases/TemplatedType.md) +- [TrackableType](type-aliases/TrackableType.md) +- [Type](type-aliases/Type.md) +- [TypeKind](type-aliases/TypeKind.md) +- [TypeListeners](type-aliases/TypeListeners.md) +- [TypeOfDiagnostics](type-aliases/TypeOfDiagnostics.md) +- [TypeOrReturnRecord](type-aliases/TypeOrReturnRecord.md) +- [TypeSpecDiagnosticTarget](type-aliases/TypeSpecDiagnosticTarget.md) +- [TypeSpecValue](type-aliases/TypeSpecValue.md) +- [WriteLine](type-aliases/WriteLine.md) + +### Variables + +- [CadlPrettierPlugin](variables/CadlPrettierPlugin.md) +- [MANIFEST](variables/MANIFEST.md) +- [NoTarget](variables/NoTarget.md) +- [NodeHost](variables/NodeHost.md) +- [TypeSpecPrettierPlugin](variables/TypeSpecPrettierPlugin.md) +- [altDirectorySeparator](variables/altDirectorySeparator.md) +- [cadlVersion](variables/cadlVersion.md) +- [directorySeparator](variables/directorySeparator.md) +- [namespace](variables/namespace.md) +- [typespecVersion](variables/typespecVersion.md) + +### Functions + +- [$deprecated](functions/$deprecated.md) +- [$discriminator](functions/$discriminator.md) +- [$doc](functions/$doc.md) +- [$encode](functions/$encode.md) +- [$error](functions/$error.md) +- [$errorsDoc](functions/$errorsDoc.md) +- [$format](functions/$format.md) +- [$friendlyName](functions/$friendlyName.md) +- [$indexer](functions/$indexer.md) +- [$inspectType](functions/$inspectType.md) +- [$inspectTypeName](functions/$inspectTypeName.md) +- [$key](functions/$key.md) +- [$knownValues](functions/$knownValues.md) +- [$list](functions/$list.md) +- [$maxItems](functions/$maxItems.md) +- [$maxLength](functions/$maxLength.md) +- [$maxValue](functions/$maxValue.md) +- [$maxValueExclusive](functions/$maxValueExclusive.md) +- [$minItems](functions/$minItems.md) +- [$minLength](functions/$minLength.md) +- [$minValue](functions/$minValue.md) +- [$minValueExclusive](functions/$minValueExclusive.md) +- [$overload](functions/$overload.md) +- [$parameterVisibility](functions/$parameterVisibility.md) +- [$pattern](functions/$pattern.md) +- [$projectedName](functions/$projectedName.md) +- [$returnTypeVisibility](functions/$returnTypeVisibility.md) +- [$returnsDoc](functions/$returnsDoc.md) +- [$secret](functions/$secret.md) +- [$service](functions/$service.md) +- [$summary](functions/$summary.md) +- [$tag](functions/$tag.md) +- [$visibility](functions/$visibility.md) +- [$withDefaultKeyVisibility](functions/$withDefaultKeyVisibility.md) +- [$withOptionalProperties](functions/$withOptionalProperties.md) +- [$withUpdateableProperties](functions/$withUpdateableProperties.md) +- [$withVisibility](functions/$withVisibility.md) +- [$withoutDefaultValues](functions/$withoutDefaultValues.md) +- [$withoutOmittedProperties](functions/$withoutOmittedProperties.md) +- [addService](functions/addService.md) +- [assertType](functions/assertType.md) +- [cadlTypeToJson](functions/cadlTypeToJson.md) +- [checkFormatCadl](functions/checkFormatCadl.md) +- [checkFormatTypeSpec](functions/checkFormatTypeSpec.md) +- [compile](functions/compile.md) +- [compilerAssert](functions/compilerAssert.md) +- [createCadlLibrary](functions/createCadlLibrary.md) +- [createChecker](functions/createChecker.md) +- [createDecoratorDefinition](functions/createDecoratorDefinition.md) +- [createDiagnosticCollector](functions/createDiagnosticCollector.md) +- [createDiagnosticCreator](functions/createDiagnosticCreator.md) +- [createProjectedNameProgram](functions/createProjectedNameProgram.md) +- [createRekeyableMap](functions/createRekeyableMap.md) +- [createRule](functions/createRule.md) +- [createScanner](functions/createScanner.md) +- [createServer](functions/createServer.md) +- [createSourceFile](functions/createSourceFile.md) +- [createStateAccessors](functions/createStateAccessors.md) +- [createTypeSpecLibrary](functions/createTypeSpecLibrary.md) +- [emitFile](functions/emitFile.md) +- [ensureTrailingDirectorySeparator](functions/ensureTrailingDirectorySeparator.md) +- [filterModelProperties](functions/filterModelProperties.md) +- [finishTypeForProgram](functions/finishTypeForProgram.md) +- [formatDiagnostic](functions/formatDiagnostic.md) +- [formatIdentifier](functions/formatIdentifier.md) +- [formatTypeSpec](functions/formatTypeSpec.md) +- [getAllTags](functions/getAllTags.md) +- [getAnyExtensionFromPath](functions/getAnyExtensionFromPath.md) +- [getBaseFileName](functions/getBaseFileName.md) +- [getDeprecated](functions/getDeprecated.md) +- [getDeprecationDetails](functions/getDeprecationDetails.md) +- [getDirectoryPath](functions/getDirectoryPath.md) +- [getDiscriminatedTypes](functions/getDiscriminatedTypes.md) +- [getDiscriminatedUnion](functions/getDiscriminatedUnion.md) +- [getDiscriminator](functions/getDiscriminator.md) +- [getDoc](functions/getDoc.md) +- [getDocData](functions/getDocData.md) +- [getDocDataInternal](functions/getDocDataInternal.md) +- [getEffectiveModelType](functions/getEffectiveModelType.md) +- [getEncode](functions/getEncode.md) +- [getErrorsDoc](functions/getErrorsDoc.md) +- [getErrorsDocData](functions/getErrorsDocData.md) +- [getFirstAncestor](functions/getFirstAncestor.md) +- [getFormat](functions/getFormat.md) +- [getFriendlyName](functions/getFriendlyName.md) +- [getFullyQualifiedSymbolName](functions/getFullyQualifiedSymbolName.md) +- [getIdentifierContext](functions/getIdentifierContext.md) +- [getIndexer](functions/getIndexer.md) +- [getKeyName](functions/getKeyName.md) +- [getKnownValues](functions/getKnownValues.md) +- [getListOperationType](functions/getListOperationType.md) +- [getLocationContext](functions/getLocationContext.md) +- [getMaxItems](functions/getMaxItems.md) +- [getMaxLength](functions/getMaxLength.md) +- [getMaxValue](functions/getMaxValue.md) +- [getMaxValueExclusive](functions/getMaxValueExclusive.md) +- [getMinItems](functions/getMinItems.md) +- [getMinLength](functions/getMinLength.md) +- [getMinValue](functions/getMinValue.md) +- [getMinValueExclusive](functions/getMinValueExclusive.md) +- [getNamespaceFullName](functions/getNamespaceFullName.md) +- [getNodeAtPosition](functions/getNodeAtPosition.md) +- [getNormalizedAbsolutePath](functions/getNormalizedAbsolutePath.md) +- [getNormalizedAbsolutePathWithoutRoot](functions/getNormalizedAbsolutePathWithoutRoot.md) +- [getNormalizedPathComponents](functions/getNormalizedPathComponents.md) +- [getOverloadedOperation](functions/getOverloadedOperation.md) +- [getOverloads](functions/getOverloads.md) +- [getOverriddenProperty](functions/getOverriddenProperty.md) +- [getParameterVisibility](functions/getParameterVisibility.md) +- [getParentTemplateNode](functions/getParentTemplateNode.md) +- [getPathComponents](functions/getPathComponents.md) +- [getPathFromPathComponents](functions/getPathFromPathComponents.md) +- [getPattern](functions/getPattern.md) +- [getProjectedName](functions/getProjectedName.md) +- [getProjectedNames](functions/getProjectedNames.md) +- [getProperty](functions/getProperty.md) +- [getPropertyType](functions/getPropertyType.md) +- [getRelativePathFromDirectory](functions/getRelativePathFromDirectory.md) +- [getReturnTypeVisibility](functions/getReturnTypeVisibility.md) +- [getReturnsDoc](functions/getReturnsDoc.md) +- [getReturnsDocData](functions/getReturnsDocData.md) +- [getRootLength](functions/getRootLength.md) +- [getService](functions/getService.md) +- [getSourceFileKindFromExt](functions/getSourceFileKindFromExt.md) +- [getSourceLocation](functions/getSourceLocation.md) +- [getSummary](functions/getSummary.md) +- [getTags](functions/getTags.md) +- [getTypeName](functions/getTypeName.md) +- [getVisibility](functions/getVisibility.md) +- [hasParseError](functions/hasParseError.md) +- [hasProjectedName](functions/hasProjectedName.md) +- [hasTrailingDirectorySeparator](functions/hasTrailingDirectorySeparator.md) +- [ignoreDiagnostics](functions/ignoreDiagnostics.md) +- [interpolatePath](functions/interpolatePath.md) +- [isAnyDirectorySeparator](functions/isAnyDirectorySeparator.md) +- [isArrayModelType](functions/isArrayModelType.md) +- [isCadlValueTypeOf](functions/isCadlValueTypeOf.md) +- [isComment](functions/isComment.md) +- [isDeclaredInNamespace](functions/isDeclaredInNamespace.md) +- [isDeclaredType](functions/isDeclaredType.md) +- [isDeprecated](functions/isDeprecated.md) +- [isErrorModel](functions/isErrorModel.md) +- [isErrorType](functions/isErrorType.md) +- [isGlobalNamespace](functions/isGlobalNamespace.md) +- [isImportStatement](functions/isImportStatement.md) +- [isIntrinsicType](functions/isIntrinsicType.md) +- [isKey](functions/isKey.md) +- [isKeyword](functions/isKeyword.md) +- [isListOperation](functions/isListOperation.md) +- [isModifier](functions/isModifier.md) +- [isNeverType](functions/isNeverType.md) +- [isNullType](functions/isNullType.md) +- [isNumericType](functions/isNumericType.md) +- [isPathAbsolute](functions/isPathAbsolute.md) +- [isProjectedProgram](functions/isProjectedProgram.md) +- [isPunctuation](functions/isPunctuation.md) +- [isRecordModelType](functions/isRecordModelType.md) +- [isSecret](functions/isSecret.md) +- [isService](functions/isService.md) +- [isStatementKeyword](functions/isStatementKeyword.md) +- [isStdNamespace](functions/isStdNamespace.md) +- [isStringType](functions/isStringType.md) +- [isTemplateDeclaration](functions/isTemplateDeclaration.md) +- [isTemplateDeclarationOrInstance](functions/isTemplateDeclarationOrInstance.md) +- [isTemplateInstance](functions/isTemplateInstance.md) +- [isTrivia](functions/isTrivia.md) +- [isTypeSpecValueTypeOf](functions/isTypeSpecValueTypeOf.md) +- [isUnknownType](functions/isUnknownType.md) +- [isUrl](functions/isUrl.md) +- [isVisible](functions/isVisible.md) +- [isVoidType](functions/isVoidType.md) +- [joinPaths](functions/joinPaths.md) +- [listOperationsIn](functions/listOperationsIn.md) +- [listServices](functions/listServices.md) +- [logDiagnostics](functions/logDiagnostics.md) +- [logVerboseTestOutput](functions/logVerboseTestOutput.md) +- [mapEventEmitterToNodeListener](functions/mapEventEmitterToNodeListener.md) +- [markDeprecated](functions/markDeprecated.md) +- [navigateProgram](functions/navigateProgram.md) +- [navigateType](functions/navigateType.md) +- [navigateTypesInNamespace](functions/navigateTypesInNamespace.md) +- [normalizePath](functions/normalizePath.md) +- [normalizeSlashes](functions/normalizeSlashes.md) +- [paramMessage](functions/paramMessage.md) +- [parse](functions/parse.md) +- [parseStandaloneTypeReference](functions/parseStandaloneTypeReference.md) +- [projectProgram](functions/projectProgram.md) +- [reducePathComponents](functions/reducePathComponents.md) +- [removeTrailingDirectorySeparator](functions/removeTrailingDirectorySeparator.md) +- [reportDeprecated](functions/reportDeprecated.md) +- [resolveCompilerOptions](functions/resolveCompilerOptions.md) +- [resolveModule](functions/resolveModule.md) +- [resolvePath](functions/resolvePath.md) +- [resolveUsages](functions/resolveUsages.md) +- [scopeNavigationToNamespace](functions/scopeNavigationToNamespace.md) +- [setCadlNamespace](functions/setCadlNamespace.md) +- [setTypeSpecNamespace](functions/setTypeSpecNamespace.md) +- [skipTrivia](functions/skipTrivia.md) +- [skipWhiteSpace](functions/skipWhiteSpace.md) +- [typespecTypeToJson](functions/typespecTypeToJson.md) +- [validateDecoratorNotOnType](functions/validateDecoratorNotOnType.md) +- [validateDecoratorParamCount](functions/validateDecoratorParamCount.md) +- [validateDecoratorParamType](functions/validateDecoratorParamType.md) +- [validateDecoratorTarget](functions/validateDecoratorTarget.md) +- [validateDecoratorTargetIntrinsic](functions/validateDecoratorTargetIntrinsic.md) +- [validateDecoratorUniqueOnNode](functions/validateDecoratorUniqueOnNode.md) +- [visitChildren](functions/visitChildren.md) +- [walkPropertiesInherited](functions/walkPropertiesInherited.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/AliasStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/AliasStatementNode.md new file mode 100644 index 0000000000..8af7218489 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/AliasStatementNode.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] AliasStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `AliasStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | +| `readonly` | `value` | [`Expression`](../type-aliases/Expression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/AnyKeywordNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/AnyKeywordNode.md new file mode 100644 index 0000000000..cfa67c80a6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/AnyKeywordNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] AnyKeywordNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `UnknownKeyword` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ArrayExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ArrayExpressionNode.md new file mode 100644 index 0000000000..2f35c81548 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ArrayExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ArrayExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `elementType` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ArrayExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ArrayModelType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ArrayModelType.md new file mode 100644 index 0000000000..ce4daf5ef1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ArrayModelType.md @@ -0,0 +1,59 @@ +--- +jsApi: true +title: "[I] ArrayModelType" + +--- +## Extends + +- [`Model`](Model.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `baseModel?` | [`Model`](Model.md) | Model this model extends. This represent inheritance. | [`Model`](Model.md).`baseModel` | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`Model`](Model.md).`decorators` | +| `derivedModels` | [`Model`](Model.md)[] | Direct children. This is the reverse relation of [baseModel](ArrayModelType.md) | [`Model`](Model.md).`derivedModels` | +| `indexer` | `object` | - | [`Model`](Model.md).`indexer` | +| `indexer.key` | [`Scalar`](Scalar.md) | - | - | +| `indexer.value` | [`Type`](../type-aliases/Type.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`Model`](Model.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`Model`](Model.md).`isFinished` | +| `kind` | `"Model"` | - | [`Model`](Model.md).`kind` | +| `name` | `string` | - | [`Model`](Model.md).`name` | +| `namespace?` | [`Namespace`](Namespace.md) | - | [`Model`](Model.md).`namespace` | +| `node?` | [`ModelStatementNode`](ModelStatementNode.md) \| [`ModelExpressionNode`](ModelExpressionNode.md) \| [`IntersectionExpressionNode`](IntersectionExpressionNode.md) \| [`ProjectionModelExpressionNode`](ProjectionModelExpressionNode.md) | - | [`Model`](Model.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`Model`](Model.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`Model`](Model.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`Model`](Model.md).`projector` | +| `properties` | `RekeyableMap`<`string`, [`ModelProperty`](ModelProperty.md)\> | The properties of the model.

Properties are ordered in the order that they appear in source.
Properties obtained via `model is` appear before properties defined in
the model body. Properties obtained via `...` are inserted where the
spread appears in source.

Properties inherited via `model extends` are not included. Use
[walkPropertiesInherited](../functions/walkPropertiesInherited.md) to enumerate all properties in the
inheritance hierarchy. | [`Model`](Model.md).`properties` | +| `sourceModel?` | [`Model`](Model.md) | The model that is referenced via `model is`. | [`Model`](Model.md).`sourceModel` | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`Model`](Model.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`Model`](Model.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`Model`](Model.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`Model`](Model.md).[`projectionsByName`](Model.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/AugmentDecoratorStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/AugmentDecoratorStatementNode.md new file mode 100644 index 0000000000..0c6bbffcb2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/AugmentDecoratorStatementNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] AugmentDecoratorStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `AugmentDecoratorStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `targetType` | [`TypeReferenceNode`](TypeReferenceNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BaseNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BaseNode.md new file mode 100644 index 0000000000..1f5cc1b7b7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BaseNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] BaseNode" + +--- +## Extends + +- [`TextRange`](TextRange.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | - | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | - | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`TextRange`](TextRange.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | - | +| `readonly` | `kind` | [`SyntaxKind`](../enumerations/SyntaxKind.md) | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`TextRange`](TextRange.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BaseType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BaseType.md new file mode 100644 index 0000000000..d1d90d6eb1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BaseType.md @@ -0,0 +1,62 @@ +--- +jsApi: true +title: "[I] BaseType" + +--- +## Extended By + +- [`ObjectType`](ObjectType.md) +- [`Projection`](Projection.md) +- [`IntrinsicType`](IntrinsicType.md) +- [`Model`](Model.md) +- [`ModelProperty`](ModelProperty.md) +- [`Scalar`](Scalar.md) +- [`Interface`](Interface.md) +- [`Enum`](Enum.md) +- [`EnumMember`](EnumMember.md) +- [`Operation`](Operation.md) +- [`Namespace`](Namespace.md) +- [`StringLiteral`](StringLiteral.md) +- [`NumericLiteral`](NumericLiteral.md) +- [`BooleanLiteral`](BooleanLiteral.md) +- [`Tuple`](Tuple.md) +- [`Union`](Union.md) +- [`UnionVariant`](UnionVariant.md) +- [`TemplateParameter`](TemplateParameter.md) +- [`Decorator`](Decorator.md) +- [`FunctionType`](FunctionType.md) +- [`FunctionParameter`](FunctionParameter.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | +| `kind` | `string` | - | +| `node?` | [`Node`](../type-aliases/Node.md) | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | +| `projector?` | [`Projector`](Projector.md) | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BlockComment.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BlockComment.md new file mode 100644 index 0000000000..fdb2e5f012 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BlockComment.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[I] BlockComment" + +--- +## Extends + +- [`TextRange`](TextRange.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`TextRange`](TextRange.md).`end` | +| `readonly` | `kind` | `BlockComment` | - | - | +| `readonly` | `parsedAsDocs?` | `boolean` | If that comment was parsed as a doc comment. If parserOptions.docs=false this will always be false. | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`TextRange`](TextRange.md).`pos` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BooleanLiteral.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BooleanLiteral.md new file mode 100644 index 0000000000..80425018cc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BooleanLiteral.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] BooleanLiteral" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Boolean"` | - | [`BaseType`](BaseType.md).`kind` | +| `node?` | [`BooleanLiteralNode`](BooleanLiteralNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `value` | `boolean` | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BooleanLiteralNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BooleanLiteralNode.md new file mode 100644 index 0000000000..c62e5b765a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/BooleanLiteralNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] BooleanLiteralNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `BooleanLiteral` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | `boolean` | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CallableMessage.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CallableMessage.md new file mode 100644 index 0000000000..07283ef526 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CallableMessage.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] CallableMessage" + +--- +## Type parameters + +| Parameter | +| :------ | +| `T` extends `string`[] | + +```ts +CallableMessage(dict): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `dict` | `Record`<`T`[`number`], `string`\> | + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `keys` | `T` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Checker.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Checker.md new file mode 100644 index 0000000000..2e88a02ee9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Checker.md @@ -0,0 +1,531 @@ +--- +jsApi: true +title: "[I] Checker" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `anyType` | [`UnknownType`](UnknownType.md) | - | +| `errorType` | [`ErrorType`](ErrorType.md) | - | +| `neverType` | [`NeverType`](NeverType.md) | - | +| `typePrototype` | `TypePrototype` | - | +| `voidType` | [`VoidType`](VoidType.md) | - | + +## Methods + +### checkProgram() + +```ts +checkProgram(): void +``` + +*** + +### checkSourceFile() + +```ts +checkSourceFile(file): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `file` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) | + +*** + +### cloneType() + +```ts +cloneType(type, additionalProps?): T +``` + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`Type`](../type-aliases/Type.md) | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `T` | +| `additionalProps`? | `{ [P in string | number | symbol]?: T[P] }` | + +*** + +### createAndFinishType() + +```ts +createAndFinishType(typeDef): T & TypePrototype +``` + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`CreateTypeProps`](../type-aliases/CreateTypeProps.md) | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `typeDef` | `T` | + +*** + +### createFunctionType() + +```ts +createFunctionType(fn): FunctionType +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `fn` | (...`args`) => [`Type`](../type-aliases/Type.md) | + +*** + +### createLiteralType() + +#### createLiteralType(value, node) + +```ts +createLiteralType(value, node?): StringLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `value` | `string` | +| `node`? | [`StringLiteralNode`](StringLiteralNode.md) | + +#### createLiteralType(value, node) + +```ts +createLiteralType(value, node?): NumericLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `value` | `number` | +| `node`? | [`NumericLiteralNode`](NumericLiteralNode.md) | + +#### createLiteralType(value, node) + +```ts +createLiteralType(value, node?): BooleanLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `value` | `boolean` | +| `node`? | [`BooleanLiteralNode`](BooleanLiteralNode.md) | + +#### createLiteralType(value, node) + +```ts +createLiteralType(value, node?): StringLiteral | NumericLiteral | BooleanLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `value` | `string` \| `number` \| `boolean` | +| `node`? | [`StringLiteralNode`](StringLiteralNode.md) \| [`NumericLiteralNode`](NumericLiteralNode.md) \| [`BooleanLiteralNode`](BooleanLiteralNode.md) | + +#### createLiteralType(value, node) + +```ts +createLiteralType(value, node?): StringLiteral | NumericLiteral | BooleanLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `value` | `string` \| `number` \| `boolean` | +| `node`? | [`StringLiteralNode`](StringLiteralNode.md) \| [`NumericLiteralNode`](NumericLiteralNode.md) \| [`BooleanLiteralNode`](BooleanLiteralNode.md) | + +*** + +### createType() + +```ts +createType(typeDef): T & TypePrototype & object +``` + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`CreateTypeProps`](../type-aliases/CreateTypeProps.md) | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `typeDef` | `T` | + +*** + +### evalProjection() + +```ts +evalProjection( + node, + target, + args): Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`ProjectionNode`](ProjectionNode.md) | +| `target` | [`Type`](../type-aliases/Type.md) | +| `args` | [`Type`](../type-aliases/Type.md)[] | + +*** + +### finishType() + +```ts +finishType(typeDef): T +``` + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`Type`](../type-aliases/Type.md) | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `typeDef` | `T` | + +*** + +### getGlobalNamespaceNode() + +```ts +getGlobalNamespaceNode(): NamespaceStatementNode +``` + +*** + +### getGlobalNamespaceType() + +```ts +getGlobalNamespaceType(): Namespace +``` + +*** + +### getLiteralType() + +#### getLiteralType(node) + +```ts +getLiteralType(node): StringLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`StringLiteralNode`](StringLiteralNode.md) | + +#### getLiteralType(node) + +```ts +getLiteralType(node): NumericLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`NumericLiteralNode`](NumericLiteralNode.md) | + +#### getLiteralType(node) + +```ts +getLiteralType(node): BooleanLiteral +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`BooleanLiteralNode`](BooleanLiteralNode.md) | + +#### getLiteralType(node) + +```ts +getLiteralType(node): LiteralType +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`LiteralNode`](../type-aliases/LiteralNode.md) | + +*** + +### getMergedSymbol() + +```ts +getMergedSymbol(sym): undefined | Sym +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `sym` | `undefined` \| [`Sym`](Sym.md) | + +*** + +### getNamespaceString() + +```ts +getNamespaceString(type, options?): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | `undefined` \| [`Namespace`](Namespace.md) | +| `options`? | [`TypeNameOptions`](TypeNameOptions.md) | + +#### Returns + +#### Deprecated + +use `import { getNamespaceFullName } from "@typespec/compiler";` + +*** + +### getStdType() + +```ts +getStdType(name): StdTypes[T] +``` + +Std type + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md) \| `"Array"` \| `"Record"` | + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `name` | `T` | Name | + +*** + +### getTypeForNode() + +```ts +getTypeForNode(node): Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`Node`](../type-aliases/Node.md) | + +*** + +### getTypeName() + +```ts +getTypeName(type, options?): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | +| `options`? | [`TypeNameOptions`](TypeNameOptions.md) | + +#### Returns + +#### Deprecated + +use `import { getTypeName } from "@typespec/compiler";` + +*** + +### isStdType() + +#### isStdType(type, stdType) + +```ts +isStdType(type, stdType?): type is Scalar & Object +``` + +Check if the given type is one of the built-in standard TypeSpec Types. + +##### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `type` | [`Scalar`](Scalar.md) | Type to check | +| `stdType`? | [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md) | If provided check is that standard type | + +#### isStdType(type, stdType) + +```ts +isStdType(type, stdType?): type is Type & Object +``` + +##### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | +| `stdType`? | [`IntrinsicScalarName`](../type-aliases/IntrinsicScalarName.md) \| `"Array"` \| `"Record"` | + +*** + +### isTypeAssignableTo() + +```ts +isTypeAssignableTo( + source, + target, + diagnosticTarget): [boolean, readonly Diagnostic[]] +``` + +Check if the source type can be assigned to the target type. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `source` | [`Type`](../type-aliases/Type.md) \| [`ValueType`](ValueType.md) | Source type, should be assignable to the target. | +| `target` | [`Type`](../type-aliases/Type.md) \| [`ValueType`](ValueType.md) | Target type | +| `diagnosticTarget` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | Target for the diagnostic, unless something better can be inferred. | + +#### Returns + +[related, list of diagnostics] + +*** + +### mergeSourceFile() + +```ts +mergeSourceFile(file): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `file` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`JsSourceFileNode`](JsSourceFileNode.md) | + +*** + +### project() + +```ts +project( + target, + projection, + args?): Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | [`Type`](../type-aliases/Type.md) | +| `projection` | [`ProjectionNode`](ProjectionNode.md) | +| `args`? | (`string` \| `number` \| `boolean` \| [`Type`](../type-aliases/Type.md))[] | + +*** + +### resolveCompletions() + +```ts +resolveCompletions(node): Map +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`IdentifierNode`](IdentifierNode.md) | + +*** + +### resolveIdentifier() + +```ts +resolveIdentifier(node): undefined | Sym +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `node` | [`IdentifierNode`](IdentifierNode.md) | + +*** + +### resolveTypeReference() + +```ts +resolveTypeReference(node): [undefined | Type, readonly Diagnostic[]] +``` + +Check and resolve a type for the given type reference node. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `node` | [`TypeReferenceNode`](TypeReferenceNode.md) | Node. | + +#### Returns + +Resolved type and diagnostics if there was an error. + +*** + +### setUsingsForFile() + +```ts +setUsingsForFile(file): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `file` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CompilerHost.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CompilerHost.md new file mode 100644 index 0000000000..11d7861967 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CompilerHost.md @@ -0,0 +1,213 @@ +--- +jsApi: true +title: "[I] CompilerHost" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `logSink` | [`LogSink`](LogSink.md) | - | +| `parseCache?` | `WeakMap`<[`SourceFile`](SourceFile.md), [`TypeSpecScriptNode`](TypeSpecScriptNode.md)\> | Optional cache to reuse the results of parsing and binding across programs. | + +## Methods + +### fileURLToPath() + +```ts +fileURLToPath(url): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `url` | `string` | + +*** + +### getExecutionRoot() + +```ts +getExecutionRoot(): string +``` + +*** + +### getJsImport() + +```ts +getJsImport(path): Promise> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### getLibDirs() + +```ts +getLibDirs(): string[] +``` + +*** + +### getSourceFileKind() + +```ts +getSourceFileKind(path): undefined | SourceFileKind +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### mkdirp() + +```ts +mkdirp(path): Promise +``` + +create directory recursively. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | Path to the directory. | + +*** + +### pathToFileURL() + +```ts +pathToFileURL(path): string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### readDir() + +```ts +readDir(dir): Promise +``` + +Read directory. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `dir` | `string` | + +#### Returns + +list of file/directory in the given directory. Returns the name not the full path. + +*** + +### readFile() + +```ts +readFile(path): Promise +``` + +read a utf-8 or utf-8 with bom encoded file + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### readUrl() + +```ts +readUrl(url): Promise +``` + +read a file at the given url. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `url` | `string` | + +*** + +### realpath() + +```ts +realpath(path): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### rm() + +```ts +rm(path, options?): Promise +``` + +Deletes a directory or file. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | Path to the directory or file. | +| `options`? | [`RmOptions`](RmOptions.md) | - | + +*** + +### stat() + +```ts +stat(path): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### writeFile() + +```ts +writeFile(path, content): Promise +``` + +Write the file. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | Path to the file. | +| `content` | `string` | Content of the file. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CompilerLocationContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CompilerLocationContext.md new file mode 100644 index 0000000000..5f6b0e0433 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CompilerLocationContext.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] CompilerLocationContext" + +--- +Built-in + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `type` | `"compiler"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CompilerOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CompilerOptions.md new file mode 100644 index 0000000000..9ca4cd6625 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/CompilerOptions.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] CompilerOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `additionalImports?` | `string`[] | - | +| `config?` | `string` | Path to config YAML file or folder in which to search for default tspconfig.yaml file. | +| `designTimeBuild?` | `boolean` | When true, indicates that a compilation is being performed for live
analysis in the language server. | +| `emit?` | `string`[] | List or path to emitters to use. | +| `emitters?` | `Record`<`string`, `EmitterOptions`\> | **Deprecated**

use [emit](CompilerOptions.md) and [options](CompilerOptions.md) instead.

Will be removed in March 2022 sprint. | +| `ignoreDeprecated?` | `boolean` | Suppress all `deprecated` warnings. | +| `linterRuleSet?` | [`LinterRuleSet`](LinterRuleSet.md) | Ruleset to enable for linting. | +| `miscOptions?` | `Record`<`string`, `unknown`\> | - | +| `noEmit?` | `boolean` | - | +| `nostdlib?` | `boolean` | - | +| `options?` | `Record`<`string`, `EmitterOptions`\> | Emitter options.
Key value pair where the key must be the emitter name. | +| `outputDir?` | `string` | Default output directory used by emitters.

**Default**

` ./tsp-output ` | +| `outputPath?` | `string` | **Deprecated**

use outputDir. | +| `parseOptions?` | [`ParseOptions`](ParseOptions.md) | - | +| `trace?` | `string`[] | Trace area to enable. | +| `warningAsError?` | `boolean` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DeclarationNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DeclarationNode.md new file mode 100644 index 0000000000..cb1f3bb4aa --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DeclarationNode.md @@ -0,0 +1,30 @@ +--- +jsApi: true +title: "[I] DeclarationNode" + +--- +## Extended By + +- [`TypeSpecScriptNode`](TypeSpecScriptNode.md) +- [`NamespaceStatementNode`](NamespaceStatementNode.md) +- [`OperationStatementNode`](OperationStatementNode.md) +- [`ModelStatementNode`](ModelStatementNode.md) +- [`ScalarStatementNode`](ScalarStatementNode.md) +- [`InterfaceStatementNode`](InterfaceStatementNode.md) +- [`UnionStatementNode`](UnionStatementNode.md) +- [`EnumStatementNode`](EnumStatementNode.md) +- [`AliasStatementNode`](AliasStatementNode.md) +- [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md) +- [`DecoratorDeclarationStatementNode`](DecoratorDeclarationStatementNode.md) +- [`FunctionDeclarationStatementNode`](FunctionDeclarationStatementNode.md) +- [`ProjectionParameterDeclarationNode`](ProjectionParameterDeclarationNode.md) +- [`ProjectionLambdaParameterDeclarationNode`](ProjectionLambdaParameterDeclarationNode.md) +- [`ProjectionStatementNode`](ProjectionStatementNode.md) +- [`JsSourceFileNode`](JsSourceFileNode.md) +- [`JsNamespaceDeclarationNode`](JsNamespaceDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratedType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratedType.md new file mode 100644 index 0000000000..deec49240e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratedType.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DecoratedType" + +--- +## Extended By + +- [`Model`](Model.md) +- [`ModelProperty`](ModelProperty.md) +- [`Scalar`](Scalar.md) +- [`Interface`](Interface.md) +- [`Enum`](Enum.md) +- [`EnumMember`](EnumMember.md) +- [`Operation`](Operation.md) +- [`Namespace`](Namespace.md) +- [`Union`](Union.md) +- [`UnionVariant`](UnionVariant.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Decorator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Decorator.md new file mode 100644 index 0000000000..c85ef6409f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Decorator.md @@ -0,0 +1,51 @@ +--- +jsApi: true +title: "[I] Decorator" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `implementation` | (...`args`) => `void` | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Decorator"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | \`@${string}\` | - | - | +| `namespace` | [`Namespace`](Namespace.md) | - | - | +| `node` | [`DecoratorDeclarationStatementNode`](DecoratorDeclarationStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `parameters` | [`FunctionParameter`](FunctionParameter.md)[] | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `target` | [`FunctionParameter`](FunctionParameter.md) | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorApplication.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorApplication.md new file mode 100644 index 0000000000..610312d64d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorApplication.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] DecoratorApplication" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `args` | [`DecoratorArgument`](DecoratorArgument.md)[] | - | +| `decorator` | [`DecoratorFunction`](DecoratorFunction.md) | - | +| `definition?` | [`Decorator`](Decorator.md) | - | +| `node?` | [`DecoratorExpressionNode`](DecoratorExpressionNode.md) \| [`AugmentDecoratorStatementNode`](AugmentDecoratorStatementNode.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorArgument.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorArgument.md new file mode 100644 index 0000000000..1b43175dc5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorArgument.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] DecoratorArgument" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `jsValue` | `string` \| `number` \| `boolean` \| [`Type`](../type-aliases/Type.md) | Marshalled value for use in Javascript. | +| `node?` | [`Node`](../type-aliases/Node.md) | - | +| `value` | [`Type`](../type-aliases/Type.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorContext.md new file mode 100644 index 0000000000..24e6f39e37 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorContext.md @@ -0,0 +1,66 @@ +--- +jsApi: true +title: "[I] DecoratorContext" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `decoratorTarget` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | Point to the decorator target | +| `program` | [`Program`](Program.md) | - | + +## Methods + +### call() + +```ts +call( + decorator, + target, ... + args): R +``` + +Helper to call out to another decorator + +#### Type parameters + +| Parameter | +| :------ | +| `T` extends [`Type`](../type-aliases/Type.md) | +| `A` extends `any`[] | +| `R` | + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `decorator` | (`context`, `target`, ...`args`) => `R` | Other decorator function | +| `target` | `T` | - | +| ...`args` | `A` | Args to pass to other decorator function | + +*** + +### getArgumentTarget() + +```ts +getArgumentTarget(paramIndex): undefined | DiagnosticTarget +``` + +Function that can be used to retrieve the target for a parameter at the given index. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `paramIndex` | `number` | Parameter index in the typespec | + +#### Returns + +#### Example + +```ts +@foo("bar", 123) -> $foo(context, target, arg0: string, arg1: number); + getArgumentTarget(0) -> target for arg0 + getArgumentTarget(1) -> target for arg1 +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorDeclarationStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorDeclarationStatementNode.md new file mode 100644 index 0000000000..5560aefc58 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorDeclarationStatementNode.md @@ -0,0 +1,34 @@ +--- +jsApi: true +title: "[I] DecoratorDeclarationStatementNode" + +--- +Represent a decorator declaration + +## Example + +```typespec +extern dec doc(target: Type, value: valueof string); +``` + +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `DecoratorDeclarationStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `modifierFlags` | [`ModifierFlags`](../enumerations/ModifierFlags.md) | - | - | +| `readonly` | `modifiers` | readonly [`ExternKeywordNode`](ExternKeywordNode.md)[] | - | - | +| `readonly` | `parameters` | [`FunctionParameterNode`](FunctionParameterNode.md)[] | Additional parameters | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`FunctionParameterNode`](FunctionParameterNode.md) | Decorator target. First parameter. | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorDefinition.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorDefinition.md new file mode 100644 index 0000000000..73b25848c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorDefinition.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] DecoratorDefinition" + +--- +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends [`TypeKind`](../type-aliases/TypeKind.md) | - | +| `P` extends readonly [`DecoratorParamDefinition`](DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\>[] | - | +| `S` extends [`DecoratorParamDefinition`](DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\> \| `undefined` | `undefined` | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `args` | `P` | List of positional arguments in the function. | +| `readonly` | `name` | `string` | Name of the decorator. | +| `readonly` | `spreadArgs?` | `S` | **Optional**

Type of the spread args at the end of the function if applicable. | +| `readonly` | `target` | `T` \| readonly `T`[] | Decorator target. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorExpressionNode.md new file mode 100644 index 0000000000..60f9f274cf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorExpressionNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DecoratorExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `DecoratorExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorFunction.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorFunction.md new file mode 100644 index 0000000000..6a95ad3f69 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorFunction.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] DecoratorFunction" + +--- +```ts +DecoratorFunction( + program, + target, ... + customArgs): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`DecoratorContext`](DecoratorContext.md) | +| `target` | `any` | +| ...`customArgs` | `any`[] | + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `namespace?` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorParamDefinition.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorParamDefinition.md new file mode 100644 index 0000000000..a677ca5bcf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorParamDefinition.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[I] DecoratorParamDefinition" + +--- +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](../type-aliases/TypeKind.md) | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `kind` | `K` \| readonly `K`[] | Kind of the parameter | +| `readonly` | `optional?` | `boolean` | Is the parameter optional. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorValidator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorValidator.md new file mode 100644 index 0000000000..3ae5c968cd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DecoratorValidator.md @@ -0,0 +1,31 @@ +--- +jsApi: true +title: "[I] DecoratorValidator" + +--- +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends [`TypeKind`](../type-aliases/TypeKind.md) | - | +| `P` extends readonly [`DecoratorParamDefinition`](DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\>[] | - | +| `S` extends [`DecoratorParamDefinition`](DecoratorParamDefinition.md)<[`TypeKind`](../type-aliases/TypeKind.md)\> \| `undefined` | `undefined` | + +## Methods + +### validate() + +```ts +validate( + context, + target, + parameters): boolean +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`DecoratorContext`](DecoratorContext.md) | +| `target` | [`InferredTypeSpecValue`](../type-aliases/InferredTypeSpecValue.md)<`T`\> | +| `parameters` | `InferParameters`<`P`, `S`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DeprecatedDirective.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DeprecatedDirective.md new file mode 100644 index 0000000000..b5558b58ed --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DeprecatedDirective.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[I] DeprecatedDirective" + +--- +## Extends + +- [`DirectiveBase`](DirectiveBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `message` | `string` | - | - | +| `name` | `"deprecated"` | - | - | +| `node` | [`DirectiveExpressionNode`](DirectiveExpressionNode.md) | - | [`DirectiveBase`](DirectiveBase.md).`node` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DeprecationDetails.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DeprecationDetails.md new file mode 100644 index 0000000000..b826f1f4cf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DeprecationDetails.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] DeprecationDetails" + +--- +Provides details on the deprecation of a given type. + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `message` | `string` | The deprecation message to display when the type is used. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Diagnostic.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Diagnostic.md new file mode 100644 index 0000000000..b4e0fa22e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Diagnostic.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] Diagnostic" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `code` | `string` | - | +| `message` | `string` | - | +| `severity` | [`DiagnosticSeverity`](../type-aliases/DiagnosticSeverity.md) | - | +| `target` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticCollector.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticCollector.md new file mode 100644 index 0000000000..40ff22dacf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticCollector.md @@ -0,0 +1,80 @@ +--- +jsApi: true +title: "[I] DiagnosticCollector" + +--- +Helper object to collect diagnostics from function following the diagnostics accessor pattern(foo() => [T, Diagnostic[]]) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `diagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | - | + +## Methods + +### add() + +```ts +add(diagnostic): void +``` + +Add a diagnostic to the collection + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `diagnostic` | [`Diagnostic`](Diagnostic.md) | Diagnostic to add. | + +*** + +### pipe() + +```ts +pipe(result): T +``` + +Unwrap the Diagnostic result, add all the diagnostics and return the data. + +#### Type parameters + +| Parameter | +| :------ | +| `T` | + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `result` | [`DiagnosticResult`](../type-aliases/DiagnosticResult.md)<`T`\> | Accessor diagnostic result | + +*** + +### wrap() + +```ts +wrap(value): DiagnosticResult +``` + +Wrap the given value in a tuple including the diagnostics following the TypeSpec accessor pattern. + +#### Type parameters + +| Parameter | +| :------ | +| `T` | + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `value` | `T` | Accessor value to return | + +#### Returns + +#### Example + +```ts +return diagnostics.wrap(routes); +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticCreator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticCreator.md new file mode 100644 index 0000000000..30e7130973 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticCreator.md @@ -0,0 +1,60 @@ +--- +jsApi: true +title: "[I] DiagnosticCreator" + +--- +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `diagnostics` | [`DiagnosticMap`](../type-aliases/DiagnosticMap.md)<`T`\> | - | +| `readonly` | `type` | `T` | - | + +## Methods + +### createDiagnostic() + +```ts +createDiagnostic(diag): Diagnostic +``` + +#### Type parameters + +| Parameter | Default | +| :------ | :------ | +| `C` extends `string` \| `number` \| `symbol` | - | +| `M` extends `string` \| `number` \| `symbol` | `"default"` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diag` | [`DiagnosticReport`](../type-aliases/DiagnosticReport.md)<`T`, `C`, `M`\> | + +*** + +### reportDiagnostic() + +```ts +reportDiagnostic(program, diag): void +``` + +#### Type parameters + +| Parameter | Default | +| :------ | :------ | +| `C` extends `string` \| `number` \| `symbol` | - | +| `M` extends `string` \| `number` \| `symbol` | `"default"` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](Program.md) | +| `diag` | [`DiagnosticReport`](../type-aliases/DiagnosticReport.md)<`T`, `C`, `M`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticDefinition.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticDefinition.md new file mode 100644 index 0000000000..166fc62a3c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticDefinition.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[I] DiagnosticDefinition" + +--- +## Type parameters + +| Parameter | +| :------ | +| `M` extends [`DiagnosticMessages`](DiagnosticMessages.md) | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `messages` | `M` | - | +| `readonly` | `severity` | `"error"` \| `"warning"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticMessages.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticMessages.md new file mode 100644 index 0000000000..55a0d323be --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiagnosticMessages.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[I] DiagnosticMessages" + +--- +## Indexable + + \[`messageId`: `string`\]: `string` \| [`CallableMessage`](CallableMessage.md)<`string`[]\> diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DirectiveBase.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DirectiveBase.md new file mode 100644 index 0000000000..9e41fea0dc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DirectiveBase.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] DirectiveBase" + +--- +## Extended By + +- [`SuppressDirective`](SuppressDirective.md) +- [`DeprecatedDirective`](DeprecatedDirective.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `node` | [`DirectiveExpressionNode`](DirectiveExpressionNode.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DirectiveExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DirectiveExpressionNode.md new file mode 100644 index 0000000000..f67f8eca79 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DirectiveExpressionNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DirectiveExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | readonly [`DirectiveArgument`](../type-aliases/DirectiveArgument.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `DirectiveExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Dirent.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Dirent.md new file mode 100644 index 0000000000..71bb214e94 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Dirent.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] Dirent" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | - | + +## Methods + +### isDirectory() + +```ts +isDirectory(): boolean +``` + +*** + +### isFile() + +```ts +isFile(): boolean +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiscriminatedUnion.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiscriminatedUnion.md new file mode 100644 index 0000000000..47d11187ca --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DiscriminatedUnion.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] DiscriminatedUnion" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `propertyName` | `string` | - | +| `variants` | `Map`<`string`, [`Model`](Model.md)\> | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Discriminator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Discriminator.md new file mode 100644 index 0000000000..6fa4551106 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Discriminator.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] Discriminator" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `propertyName` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocData.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocData.md new file mode 100644 index 0000000000..3ceaf1de98 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocData.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] DocData" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `source` | `"decorator"` \| `"comment"` | How was the doc set.
- `@doc` means the `@doc` decorator was used
- `comment` means it was set from a `/** comment * /` | +| `value` | `string` | Doc value. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocErrorsTagNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocErrorsTagNode.md new file mode 100644 index 0000000000..62d380541a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocErrorsTagNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DocErrorsTagNode" + +--- +## Extends + +- [`DocTagBaseNode`](DocTagBaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`content` | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`flags` | +| `readonly` | `kind` | `DocErrorsTag` | - | [`DocTagBaseNode`](DocTagBaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`DocTagBaseNode`](DocTagBaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`tagName` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocNode.md new file mode 100644 index 0000000000..74a7db2828 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DocNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `Doc` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `tags` | readonly [`DocTag`](../type-aliases/DocTag.md)[] | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocParamTagNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocParamTagNode.md new file mode 100644 index 0000000000..7f437e1275 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocParamTagNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] DocParamTagNode" + +--- +## Extends + +- [`DocTagBaseNode`](DocTagBaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`content` | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`flags` | +| `readonly` | `kind` | `DocParamTag` | - | [`DocTagBaseNode`](DocTagBaseNode.md).`kind` | +| `readonly` | `paramName` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`DocTagBaseNode`](DocTagBaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`tagName` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocReturnsTagNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocReturnsTagNode.md new file mode 100644 index 0000000000..fb5cf9bb3a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocReturnsTagNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DocReturnsTagNode" + +--- +## Extends + +- [`DocTagBaseNode`](DocTagBaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`content` | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`flags` | +| `readonly` | `kind` | `DocReturnsTag` | - | [`DocTagBaseNode`](DocTagBaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`DocTagBaseNode`](DocTagBaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`tagName` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocTagBaseNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocTagBaseNode.md new file mode 100644 index 0000000000..95265ee0dc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocTagBaseNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DocTagBaseNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | [`SyntaxKind`](../enumerations/SyntaxKind.md) | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocTemplateTagNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocTemplateTagNode.md new file mode 100644 index 0000000000..5a682f117d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocTemplateTagNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] DocTemplateTagNode" + +--- +## Extends + +- [`DocTagBaseNode`](DocTagBaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`content` | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`flags` | +| `readonly` | `kind` | `DocTemplateTag` | - | [`DocTagBaseNode`](DocTagBaseNode.md).`kind` | +| `readonly` | `paramName` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`DocTagBaseNode`](DocTagBaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`tagName` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocTextNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocTextNode.md new file mode 100644 index 0000000000..a23d1b4ebd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocTextNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] DocTextNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `DocText` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `text` | `string` | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocUnknownTagNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocUnknownTagNode.md new file mode 100644 index 0000000000..59b330fbb7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/DocUnknownTagNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] DocUnknownTagNode" + +--- +## Extends + +- [`DocTagBaseNode`](DocTagBaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `content` | readonly [`DocTextNode`](DocTextNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`content` | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`DocTagBaseNode`](DocTagBaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`flags` | +| `readonly` | `kind` | `DocUnknownTag` | - | [`DocTagBaseNode`](DocTagBaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`DocTagBaseNode`](DocTagBaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`DocTagBaseNode`](DocTagBaseNode.md).`symbol` | +| `readonly` | `tagName` | [`IdentifierNode`](IdentifierNode.md) | - | [`DocTagBaseNode`](DocTagBaseNode.md).`tagName` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EmitContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EmitContext.md new file mode 100644 index 0000000000..ce610523cc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EmitContext.md @@ -0,0 +1,40 @@ +--- +jsApi: true +title: "[I] EmitContext" + +--- +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `TOptions` extends `object` | `Record`<`string`, `never`\> | + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `emitterOutputDir` | `string` | Configured output dir for the emitter. Emitter should emit all output under that directory. | +| `options` | `TOptions` | Emitter custom options defined in createTypeSpecLibrary | +| `program` | [`Program`](Program.md) | TypeSpec Program. | + +## Methods + +### getAssetEmitter() + +```ts +getAssetEmitter(TypeEmitterClass): AssetEmitter +``` + +Get an asset emitter to write emitted output to disk using a TypeEmitter + +#### Type parameters + +| Parameter | +| :------ | +| `T` | + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `TypeEmitterClass` | *typeof* `TypeEmitter` | The TypeEmitter to construct your emitted output | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EmitFileOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EmitFileOptions.md new file mode 100644 index 0000000000..21c9a670f4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EmitFileOptions.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] EmitFileOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `content` | `string` | - | +| `newLine?` | [`NewLine`](../type-aliases/NewLine.md) | - | +| `path` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EmptyStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EmptyStatementNode.md new file mode 100644 index 0000000000..6deaa371f0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EmptyStatementNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] EmptyStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `EmptyStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EncodeData.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EncodeData.md new file mode 100644 index 0000000000..fe9cbabff8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EncodeData.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] EncodeData" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `encoding` | `string` | - | +| `type` | [`Scalar`](Scalar.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Enum.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Enum.md new file mode 100644 index 0000000000..6762c5e474 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Enum.md @@ -0,0 +1,50 @@ +--- +jsApi: true +title: "[I] Enum" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Enum"` | - | [`BaseType`](BaseType.md).`kind` | +| `members` | `RekeyableMap`<`string`, [`EnumMember`](EnumMember.md)\> | The members of the enum.

Members are ordered in the order that they appear in source. Members
obtained via `...` are inserted where the spread appears in source. | - | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `node` | [`EnumStatementNode`](EnumStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumMember.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumMember.md new file mode 100644 index 0000000000..c6347aee9d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumMember.md @@ -0,0 +1,51 @@ +--- +jsApi: true +title: "[I] EnumMember" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `enum` | [`Enum`](Enum.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"EnumMember"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `node` | [`EnumMemberNode`](EnumMemberNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `sourceMember?` | [`EnumMember`](EnumMember.md) | when spread operators make new enum members,
this tracks the enum member we copied from. | - | +| `value?` | `string` \| `number` | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumMemberNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumMemberNode.md new file mode 100644 index 0000000000..38ca5eea27 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumMemberNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] EnumMemberNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `EnumMember` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`EnumStatementNode`](EnumStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value?` | [`StringLiteralNode`](StringLiteralNode.md) \| [`NumericLiteralNode`](NumericLiteralNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumSpreadMemberNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumSpreadMemberNode.md new file mode 100644 index 0000000000..56fc99d21d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumSpreadMemberNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] EnumSpreadMemberNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `EnumSpreadMember` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`TypeReferenceNode`](TypeReferenceNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumStatementNode.md new file mode 100644 index 0000000000..2ec544dd0a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/EnumStatementNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] EnumStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `EnumStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `members` | readonly ([`EnumMemberNode`](EnumMemberNode.md) \| [`EnumSpreadMemberNode`](EnumSpreadMemberNode.md))[] | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ErrorType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ErrorType.md new file mode 100644 index 0000000000..9cb66d9d94 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ErrorType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] ErrorType" + +--- +## Extends + +- [`IntrinsicType`](IntrinsicType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`IntrinsicType`](IntrinsicType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`IntrinsicType`](IntrinsicType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`IntrinsicType`](IntrinsicType.md).`kind` | +| `name` | `"ErrorType"` | - | [`IntrinsicType`](IntrinsicType.md).`name` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`IntrinsicType`](IntrinsicType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`IntrinsicType`](IntrinsicType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`IntrinsicType`](IntrinsicType.md).[`projectionsByName`](IntrinsicType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ExternKeywordNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ExternKeywordNode.md new file mode 100644 index 0000000000..894e5e8f5c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ExternKeywordNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ExternKeywordNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ExternKeyword` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FileLibraryMetadata.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FileLibraryMetadata.md new file mode 100644 index 0000000000..c8cdd0fef4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FileLibraryMetadata.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[I] FileLibraryMetadata" + +--- +## Extends + +- `LibraryMetadataBase` + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `bugs?` | `object` | - | LibraryMetadataBase.bugs | +| `bugs.url?` | `string` | Url where to file bugs for this library. | - | +| `homepage?` | `string` | Library homepage. | LibraryMetadataBase.homepage | +| `name?` | `string` | Library name as specified in the package.json or in exported $lib. | - | +| `type` | `"file"` | - | - | +| `version?` | `string` | Library version | LibraryMetadataBase.version | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionDeclarationStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionDeclarationStatementNode.md new file mode 100644 index 0000000000..61a5a1db85 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionDeclarationStatementNode.md @@ -0,0 +1,34 @@ +--- +jsApi: true +title: "[I] FunctionDeclarationStatementNode" + +--- +Represent a function declaration + +## Example + +```typespec +extern fn camelCase(value: StringLiteral): StringLiteral; +``` + +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `FunctionDeclarationStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `modifierFlags` | [`ModifierFlags`](../enumerations/ModifierFlags.md) | - | - | +| `readonly` | `modifiers` | readonly [`ExternKeywordNode`](ExternKeywordNode.md)[] | - | - | +| `readonly` | `parameters` | [`FunctionParameterNode`](FunctionParameterNode.md)[] | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `returnType?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionParameter.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionParameter.md new file mode 100644 index 0000000000..9991d7da9a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionParameter.md @@ -0,0 +1,50 @@ +--- +jsApi: true +title: "[I] FunctionParameter" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"FunctionParameter"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `node` | [`FunctionParameterNode`](FunctionParameterNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `optional` | `boolean` | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `rest` | `boolean` | - | - | +| `type` | [`Type`](../type-aliases/Type.md) \| [`ValueType`](ValueType.md) | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionParameterNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionParameterNode.md new file mode 100644 index 0000000000..525c999fbc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionParameterNode.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] FunctionParameterNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `FunctionParameter` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `optional` | `boolean` | Parameter defined with `?` | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `rest` | `boolean` | Parameter defined with `...` notation. | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `type?` | [`Expression`](../type-aliases/Expression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionType.md new file mode 100644 index 0000000000..202b58404b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/FunctionType.md @@ -0,0 +1,51 @@ +--- +jsApi: true +title: "[I] FunctionType" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `implementation` | (...`args`) => `unknown` | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Function"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `node?` | [`FunctionDeclarationStatementNode`](FunctionDeclarationStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `parameters` | [`FunctionParameter`](FunctionParameter.md)[] | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `returnType` | [`Type`](../type-aliases/Type.md) | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IdentifierContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IdentifierContext.md new file mode 100644 index 0000000000..6a5a70c1e4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IdentifierContext.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] IdentifierContext" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `kind` | [`IdentifierKind`](../enumerations/IdentifierKind.md) | - | +| `node` | [`Node`](../type-aliases/Node.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IdentifierNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IdentifierNode.md new file mode 100644 index 0000000000..b67502bf58 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IdentifierNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] IdentifierNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `Identifier` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `sv` | `string` | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ImportStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ImportStatementNode.md new file mode 100644 index 0000000000..0001a7e2a1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ImportStatementNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ImportStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ImportStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `path` | [`StringLiteralNode`](StringLiteralNode.md) | - | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Interface.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Interface.md new file mode 100644 index 0000000000..78aae04109 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Interface.md @@ -0,0 +1,54 @@ +--- +jsApi: true +title: "[I] Interface" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md).[`TemplatedTypeBase`](TemplatedTypeBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Interface"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `node` | [`InterfaceStatementNode`](InterfaceStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `operations` | `RekeyableMap`<`string`, [`Operation`](Operation.md)\> | The operations of the interface.

Operations are ordered in the order that they appear in the source.
Operations obtained via `interface extends` appear before operations
declared in the interface body. | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `sourceInterfaces` | [`Interface`](Interface.md)[] | The interfaces that provide additional operations via `interface extends`.

Note that despite the same `extends` keyword in source form, this is a
different semantic relationship than the one from [Model](Model.md) to
[Model.baseModel](ArrayModelType.md). Operations from extended interfaces are copied
into [Interface.operations](Interface.md). | - | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/InterfaceStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/InterfaceStatementNode.md new file mode 100644 index 0000000000..f3a992398d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/InterfaceStatementNode.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[I] InterfaceStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `extends` | readonly [`TypeReferenceNode`](TypeReferenceNode.md)[] | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `InterfaceStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `operations` | readonly [`OperationStatementNode`](OperationStatementNode.md)[] | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IntersectionExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IntersectionExpressionNode.md new file mode 100644 index 0000000000..f2ebd1f482 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IntersectionExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] IntersectionExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `IntersectionExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `options` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IntrinsicType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IntrinsicType.md new file mode 100644 index 0000000000..619457528e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/IntrinsicType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] IntrinsicType" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | \| `"unknown"` \| `"never"` \| `"null"` \| `"void"` \| `"ErrorType"` | - | - | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/InvalidStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/InvalidStatementNode.md new file mode 100644 index 0000000000..3f47cdc128 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/InvalidStatementNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] InvalidStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `InvalidStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/JSONSchemaValidator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/JSONSchemaValidator.md new file mode 100644 index 0000000000..34ad2abc1a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/JSONSchemaValidator.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] JSONSchemaValidator" + +--- +## Methods + +### validate() + +```ts +validate(config, target): Diagnostic[] +``` + +Validate the configuration against its JSON Schema. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `config` | `unknown` | Configuration to validate. | +| `target` | [`SourceFile`](SourceFile.md) \| `YamlScript` \| *typeof* [`NoTarget`](../variables/NoTarget.md) | Source file target to use for diagnostics. | + +#### Returns + +Diagnostics produced by schema validation of the configuration. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/JsNamespaceDeclarationNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/JsNamespaceDeclarationNode.md new file mode 100644 index 0000000000..e67fca43ef --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/JsNamespaceDeclarationNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] JsNamespaceDeclarationNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `JsNamespaceDeclaration` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/JsSourceFileNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/JsSourceFileNode.md new file mode 100644 index 0000000000..a8af98851b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/JsSourceFileNode.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] JsSourceFileNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `esmExports` | `any` | - | - | +| `readonly` | `file` | [`SourceFile`](SourceFile.md) | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `JsSourceFile` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `namespaceSymbols` | [`Sym`](Sym.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LibraryInstance.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LibraryInstance.md new file mode 100644 index 0000000000..b1d2e4d71d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LibraryInstance.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] LibraryInstance" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `definition?` | [`TypeSpecLibrary`](TypeSpecLibrary.md)<`any`, `Record`<`string`, `never`\>\> | - | +| `entrypoint` | `undefined` \| [`JsSourceFileNode`](JsSourceFileNode.md) | - | +| `metadata` | [`LibraryMetadata`](../type-aliases/LibraryMetadata.md) | - | +| `module` | [`ModuleResolutionResult`](../type-aliases/ModuleResolutionResult.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LibraryLocationContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LibraryLocationContext.md new file mode 100644 index 0000000000..278ecf3d50 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LibraryLocationContext.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] LibraryLocationContext" + +--- +Defined in a library. + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `metadata` | [`ModuleLibraryMetadata`](ModuleLibraryMetadata.md) | - | +| `type` | `"library"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LineAndCharacter.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LineAndCharacter.md new file mode 100644 index 0000000000..908afd3e56 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LineAndCharacter.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] LineAndCharacter" + +--- +Identifies the position within a source file by line number and offset from +beginning of line. + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `character` | `number` | The offset in UTF-16 code units to the character from the beginning of the
line. 0-based.

NOTE: This is not necessarily the same as what a given text editor might
call the "column". Tabs, combining characters, surrogate pairs, and so on
can all cause an editor to report the column differently. Indeed, different
text editors report different column numbers for the same position in a
given document. | +| `line` | `number` | The line number. 0-based. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LineComment.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LineComment.md new file mode 100644 index 0000000000..bc04dd4ba8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LineComment.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[I] LineComment" + +--- +## Extends + +- [`TextRange`](TextRange.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`TextRange`](TextRange.md).`end` | +| `readonly` | `kind` | `LineComment` | - | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`TextRange`](TextRange.md).`pos` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterDefinition.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterDefinition.md new file mode 100644 index 0000000000..e6df6493b6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterDefinition.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] LinterDefinition" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `ruleSets?` | `Record`<`string`, [`LinterRuleSet`](LinterRuleSet.md)\> | - | +| `rules` | [`LinterRuleDefinition`](LinterRuleDefinition.md)<`string`, [`DiagnosticMessages`](DiagnosticMessages.md)\>[] | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRule.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRule.md new file mode 100644 index 0000000000..dd898a4a68 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRule.md @@ -0,0 +1,45 @@ +--- +jsApi: true +title: "[I] LinterRule" + +--- +Resolved instance of a linter rule that will run. + +## Extends + +- [`LinterRuleDefinition`](LinterRuleDefinition.md)<`N`, `DM`\> + +## Type parameters + +| Parameter | +| :------ | +| `N` extends `string` | +| `DM` extends [`DiagnosticMessages`](DiagnosticMessages.md) | + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `description` | `string` | - | [`LinterRuleDefinition`](LinterRuleDefinition.md).`description` | +| `id` | `string` | Expanded rule id in format `:` | - | +| `messages` | `DM` | - | [`LinterRuleDefinition`](LinterRuleDefinition.md).`messages` | +| `name` | `N` | - | [`LinterRuleDefinition`](LinterRuleDefinition.md).`name` | +| `severity` | `"warning"` | - | [`LinterRuleDefinition`](LinterRuleDefinition.md).`severity` | + +## Methods + +### create() + +```ts +create(context): SemanticNodeListener +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`LinterRuleContext`](LinterRuleContext.md)<`DM`\> | + +#### Inherited from + +[`LinterRuleDefinition`](LinterRuleDefinition.md).[`create`](LinterRuleDefinition.md#create) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRuleContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRuleContext.md new file mode 100644 index 0000000000..65a96be11b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRuleContext.md @@ -0,0 +1,36 @@ +--- +jsApi: true +title: "[I] LinterRuleContext" + +--- +## Type parameters + +| Parameter | +| :------ | +| `DM` extends [`DiagnosticMessages`](DiagnosticMessages.md) | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `program` | [`Program`](Program.md) | - | + +## Methods + +### reportDiagnostic() + +```ts +reportDiagnostic(diag): void +``` + +#### Type parameters + +| Parameter | +| :------ | +| `M` extends `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diag` | [`LinterRuleDiagnosticReport`](../type-aliases/LinterRuleDiagnosticReport.md)<`DM`, `M`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRuleDefinition.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRuleDefinition.md new file mode 100644 index 0000000000..105294cd00 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRuleDefinition.md @@ -0,0 +1,38 @@ +--- +jsApi: true +title: "[I] LinterRuleDefinition" + +--- +## Extended By + +- [`LinterRule`](LinterRule.md) + +## Type parameters + +| Parameter | +| :------ | +| `N` extends `string` | +| `DM` extends [`DiagnosticMessages`](DiagnosticMessages.md) | + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `description` | `string` | - | +| `messages` | `DM` | - | +| `name` | `N` | - | +| `severity` | `"warning"` | - | + +## Methods + +### create() + +```ts +create(context): SemanticNodeListener +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`LinterRuleContext`](LinterRuleContext.md)<`DM`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRuleSet.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRuleSet.md new file mode 100644 index 0000000000..2c2e36aab3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LinterRuleSet.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] LinterRuleSet" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `disable?` | `Record`<\`${string}/${string}\`, `string`\> | Rules to disable. A rule CANNOT be in enable and disable map. | +| `enable?` | `Record`<\`${string}/${string}\`, `boolean`\> | Rules to enable/configure | +| `extends?` | \`${string}/${string}\`[] | Other ruleset this ruleset extends | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ListOperationOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ListOperationOptions.md new file mode 100644 index 0000000000..d6db33c018 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ListOperationOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] ListOperationOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `recursive?` | `boolean` | If the container is a namespace look for operation in sub namespaces.

**Default**

` true ` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LogInfo.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LogInfo.md new file mode 100644 index 0000000000..35857be4e2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LogInfo.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] LogInfo" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `code?` | `string` | - | +| `level` | [`LogLevel`](../type-aliases/LogLevel.md) | - | +| `message` | `string` | - | +| `target?` | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LogSink.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LogSink.md new file mode 100644 index 0000000000..fdcbbbb13a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/LogSink.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[I] LogSink" + +--- +## Methods + +### log() + +```ts +log(log): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `log` | [`ProcessedLog`](ProcessedLog.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Logger.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Logger.md new file mode 100644 index 0000000000..3ab0310ea7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Logger.md @@ -0,0 +1,60 @@ +--- +jsApi: true +title: "[I] Logger" + +--- +## Methods + +### error() + +```ts +error(message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | + +*** + +### log() + +```ts +log(log): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `log` | [`LogInfo`](LogInfo.md) | + +*** + +### trace() + +```ts +trace(message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | + +*** + +### warn() + +```ts +warn(message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/MemberExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/MemberExpressionNode.md new file mode 100644 index 0000000000..7226d7a018 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/MemberExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] MemberExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `base` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `MemberExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `selector` | `"."` \| `"::"` | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Model.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Model.md new file mode 100644 index 0000000000..40a4049a7d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Model.md @@ -0,0 +1,57 @@ +--- +jsApi: true +title: "[I] Model" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md).[`TemplatedTypeBase`](TemplatedTypeBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `baseModel?` | [`Model`](Model.md) | Model this model extends. This represent inheritance. | - | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `derivedModels` | [`Model`](Model.md)[] | Direct children. This is the reverse relation of [baseModel](ArrayModelType.md) | - | +| `indexer?` | [`ModelIndexer`](../type-aliases/ModelIndexer.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Model"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `node?` | [`ModelStatementNode`](ModelStatementNode.md) \| [`ModelExpressionNode`](ModelExpressionNode.md) \| [`IntersectionExpressionNode`](IntersectionExpressionNode.md) \| [`ProjectionModelExpressionNode`](ProjectionModelExpressionNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `properties` | `RekeyableMap`<`string`, [`ModelProperty`](ModelProperty.md)\> | The properties of the model.

Properties are ordered in the order that they appear in source.
Properties obtained via `model is` appear before properties defined in
the model body. Properties obtained via `...` are inserted where the
spread appears in source.

Properties inherited via `model extends` are not included. Use
[walkPropertiesInherited](../functions/walkPropertiesInherited.md) to enumerate all properties in the
inheritance hierarchy. | - | +| `sourceModel?` | [`Model`](Model.md) | The model that is referenced via `model is`. | - | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelExpressionNode.md new file mode 100644 index 0000000000..50941f6c05 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ModelExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ModelExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `properties` | ([`ModelPropertyNode`](ModelPropertyNode.md) \| [`ModelSpreadPropertyNode`](ModelSpreadPropertyNode.md))[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelProperty.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelProperty.md new file mode 100644 index 0000000000..be3ac3d208 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelProperty.md @@ -0,0 +1,53 @@ +--- +jsApi: true +title: "[I] ModelProperty" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `default?` | [`Type`](../type-aliases/Type.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"ModelProperty"` | - | [`BaseType`](BaseType.md).`kind` | +| `model?` | [`Model`](Model.md) | - | - | +| `name` | `string` | - | - | +| `node` | [`ModelPropertyNode`](ModelPropertyNode.md) \| [`ModelSpreadPropertyNode`](ModelSpreadPropertyNode.md) \| [`ProjectionModelPropertyNode`](ProjectionModelPropertyNode.md) \| [`ProjectionModelSpreadPropertyNode`](ProjectionModelSpreadPropertyNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `optional` | `boolean` | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `sourceProperty?` | [`ModelProperty`](ModelProperty.md) | - | - | +| `type` | [`Type`](../type-aliases/Type.md) | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelPropertyNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelPropertyNode.md new file mode 100644 index 0000000000..39b945081a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelPropertyNode.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] ModelPropertyNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `default?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `ModelProperty` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `optional` | `boolean` | - | - | +| `readonly` | `parent?` | [`ModelStatementNode`](ModelStatementNode.md) \| [`ModelExpressionNode`](ModelExpressionNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | [`Expression`](../type-aliases/Expression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelSpreadPropertyNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelSpreadPropertyNode.md new file mode 100644 index 0000000000..dc53dafffa --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelSpreadPropertyNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ModelSpreadPropertyNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ModelSpreadProperty` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`ModelStatementNode`](ModelStatementNode.md) \| [`ModelExpressionNode`](ModelExpressionNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`TypeReferenceNode`](TypeReferenceNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelStatementNode.md new file mode 100644 index 0000000000..966190d728 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModelStatementNode.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[I] ModelStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `extends?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `is?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `kind` | `ModelStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `properties` | readonly ([`ModelPropertyNode`](ModelPropertyNode.md) \| [`ModelSpreadPropertyNode`](ModelSpreadPropertyNode.md))[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModuleLibraryMetadata.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModuleLibraryMetadata.md new file mode 100644 index 0000000000..6044378c00 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ModuleLibraryMetadata.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ModuleLibraryMetadata" + +--- +Data for a library. Either loaded via a node_modules package or a standalone js file + +## Extends + +- `LibraryMetadataBase` + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `bugs?` | `object` | - | LibraryMetadataBase.bugs | +| `bugs.url?` | `string` | Url where to file bugs for this library. | - | +| `homepage?` | `string` | Library homepage. | LibraryMetadataBase.homepage | +| `name` | `string` | Library name as specified in the package.json or in exported $lib. | - | +| `type` | `"module"` | - | - | +| `version?` | `string` | Library version | LibraryMetadataBase.version | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Namespace.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Namespace.md new file mode 100644 index 0000000000..3a531295e6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Namespace.md @@ -0,0 +1,58 @@ +--- +jsApi: true +title: "[I] Namespace" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decoratorDeclarations` | `Map`<`string`, [`Decorator`](Decorator.md)\> | The decorators declared in the namespace.

Order is implementation-defined and may change. | - | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `enums` | `Map`<`string`, [`Enum`](Enum.md)\> | The enums in the namespace.

Order is implementation-defined and may change. | - | +| `functionDeclarations` | `Map`<`string`, [`FunctionType`](FunctionType.md)\> | The functions declared in the namespace.

Order is implementation-defined and may change. | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `interfaces` | `Map`<`string`, [`Interface`](Interface.md)\> | The interfaces in the namespace.

Order is implementation-defined and may change. | - | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Namespace"` | - | [`BaseType`](BaseType.md).`kind` | +| `models` | `Map`<`string`, [`Model`](Model.md)\> | The models in the namespace.

Order is implementation-defined and may change. | - | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `namespaces` | `Map`<`string`, [`Namespace`](Namespace.md)\> | The sub-namespaces in the namespace.

Order is implementation-defined and may change. | - | +| `node` | [`JsNamespaceDeclarationNode`](JsNamespaceDeclarationNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `operations` | `Map`<`string`, [`Operation`](Operation.md)\> | The operations in the namespace.

Order is implementation-defined and may change. | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `scalars` | `Map`<`string`, [`Scalar`](Scalar.md)\> | The scalars in the namespace.

Order is implementation-defined and may change. | - | +| `unions` | `Map`<`string`, [`Union`](Union.md)\> | The unions in the namespace.

Order is implementation-defined and may change. | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NamespaceNavigationOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NamespaceNavigationOptions.md new file mode 100644 index 0000000000..5634ab26b8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NamespaceNavigationOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] NamespaceNavigationOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `skipSubNamespaces?` | `boolean` | Recursively navigate sub namespaces.

**Default**

` false ` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NamespaceStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NamespaceStatementNode.md new file mode 100644 index 0000000000..cb497e2426 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NamespaceStatementNode.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] NamespaceStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `NamespaceStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `statements?` | [`NamespaceStatementNode`](NamespaceStatementNode.md) \| readonly [`Statement`](../type-aliases/Statement.md)[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NavigationOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NavigationOptions.md new file mode 100644 index 0000000000..f41933be2a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NavigationOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] NavigationOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `includeTemplateDeclaration?` | `boolean` | Skip non instantiated templates. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NeverKeywordNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NeverKeywordNode.md new file mode 100644 index 0000000000..5ce3541c66 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NeverKeywordNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] NeverKeywordNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `NeverKeyword` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NeverType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NeverType.md new file mode 100644 index 0000000000..b385be071a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NeverType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] NeverType" + +--- +## Extends + +- [`IntrinsicType`](IntrinsicType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`IntrinsicType`](IntrinsicType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`IntrinsicType`](IntrinsicType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`IntrinsicType`](IntrinsicType.md).`kind` | +| `name` | `"never"` | - | [`IntrinsicType`](IntrinsicType.md).`name` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`IntrinsicType`](IntrinsicType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`IntrinsicType`](IntrinsicType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`IntrinsicType`](IntrinsicType.md).[`projectionsByName`](IntrinsicType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NodePackage.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NodePackage.md new file mode 100644 index 0000000000..155498500a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NodePackage.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] NodePackage" + +--- +Type for package.json https://docs.npmjs.com/cli/v8/configuring-npm/package-json + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `bugs?` | `object` | - | +| `bugs.email?` | `string` | - | +| `bugs.url?` | `string` | - | +| `dependencies?` | `Record`<`string`, `string`\> | - | +| `description?` | `string` | - | +| `devDependencies?` | `Record`<`string`, `string`\> | - | +| `homepage?` | `string` | - | +| `main?` | `string` | - | +| `name` | `string` | - | +| `peerDependencies?` | `Record`<`string`, `string`\> | - | +| `private?` | `boolean` | - | +| `tspMain?` | `string` | - | +| `type?` | `"module"` \| `"commonjs"` | - | +| `version` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NullType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NullType.md new file mode 100644 index 0000000000..38d7324140 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NullType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] NullType" + +--- +## Extends + +- [`IntrinsicType`](IntrinsicType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`IntrinsicType`](IntrinsicType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`IntrinsicType`](IntrinsicType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`IntrinsicType`](IntrinsicType.md).`kind` | +| `name` | `"null"` | - | [`IntrinsicType`](IntrinsicType.md).`name` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`IntrinsicType`](IntrinsicType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`IntrinsicType`](IntrinsicType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`IntrinsicType`](IntrinsicType.md).[`projectionsByName`](IntrinsicType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NumericLiteral.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NumericLiteral.md new file mode 100644 index 0000000000..f992e84843 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NumericLiteral.md @@ -0,0 +1,48 @@ +--- +jsApi: true +title: "[I] NumericLiteral" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Number"` | - | [`BaseType`](BaseType.md).`kind` | +| `node?` | [`NumericLiteralNode`](NumericLiteralNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `value` | `number` | - | - | +| `valueAsString` | `string` | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NumericLiteralNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NumericLiteralNode.md new file mode 100644 index 0000000000..39570e96e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/NumericLiteralNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] NumericLiteralNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `NumericLiteral` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | `number` | - | - | +| `readonly` | `valueAsString` | `string` | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ObjectType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ObjectType.md new file mode 100644 index 0000000000..a3a2d01ea6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ObjectType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] ObjectType" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Object"` | - | [`BaseType`](BaseType.md).`kind` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `properties` | `Record`<`string`, [`Type`](../type-aliases/Type.md)\> | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Operation.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Operation.md new file mode 100644 index 0000000000..d4f41a567a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Operation.md @@ -0,0 +1,56 @@ +--- +jsApi: true +title: "[I] Operation" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md).[`TemplatedTypeBase`](TemplatedTypeBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `interface?` | [`Interface`](Interface.md) | - | - | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Operation"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `node` | [`OperationStatementNode`](OperationStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `parameters` | [`Model`](Model.md) | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `returnType` | [`Type`](../type-aliases/Type.md) | - | - | +| `sourceOperation?` | [`Operation`](Operation.md) | The operation that is referenced via `op is`. | - | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/OperationSignatureDeclarationNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/OperationSignatureDeclarationNode.md new file mode 100644 index 0000000000..9c315a01b3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/OperationSignatureDeclarationNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] OperationSignatureDeclarationNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `OperationSignatureDeclaration` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parameters` | [`ModelExpressionNode`](ModelExpressionNode.md) | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `returnType` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/OperationSignatureReferenceNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/OperationSignatureReferenceNode.md new file mode 100644 index 0000000000..bb74214901 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/OperationSignatureReferenceNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] OperationSignatureReferenceNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `baseOperation` | [`TypeReferenceNode`](TypeReferenceNode.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `OperationSignatureReference` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/OperationStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/OperationStatementNode.md new file mode 100644 index 0000000000..70e71b1070 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/OperationStatementNode.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] OperationStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `OperationStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) \| [`InterfaceStatementNode`](InterfaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `signature` | [`OperationSignature`](../type-aliases/OperationSignature.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ParseOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ParseOptions.md new file mode 100644 index 0000000000..dc69b899be --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ParseOptions.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ParseOptions" + +--- +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `comments?` | `boolean` | When true, collect comment ranges in [TypeSpecScriptNode.comments](TypeSpecScriptNode.md). | +| `readonly` | `docs?` | `boolean` | When true, parse doc comments into [Node.docs](BaseNode.md). | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProcessedLog.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProcessedLog.md new file mode 100644 index 0000000000..4716d55258 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProcessedLog.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] ProcessedLog" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `code?` | `string` | - | +| `level` | [`LogLevel`](../type-aliases/LogLevel.md) | - | +| `message` | `string` | - | +| `sourceLocation?` | [`SourceLocation`](SourceLocation.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Program.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Program.md new file mode 100644 index 0000000000..37521c68a3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Program.md @@ -0,0 +1,200 @@ +--- +jsApi: true +title: "[I] Program" + +--- +## Extended By + +- [`ProjectedProgram`](ProjectedProgram.md) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `public` | `checker` | [`Checker`](Checker.md) | - | +| `public` | `compilerOptions` | [`CompilerOptions`](CompilerOptions.md) | - | +| `readonly` | `diagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | - | +| `public` | `emitters` | `EmitterRef`[] | - | +| `public` | `host` | [`CompilerHost`](CompilerHost.md) | - | +| `public` | `jsSourceFiles` | `Map`<`string`, [`JsSourceFileNode`](JsSourceFileNode.md)\> | - | +| `public` | `literalTypes` | `Map`<`string` \| `number` \| `boolean`, [`LiteralType`](../type-aliases/LiteralType.md)\> | - | +| `public` | `mainFile?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) | - | +| `readonly` | `projectRoot` | `string` | Project root. If a tsconfig was found/specified this is the directory for the tsconfig.json. Otherwise directory where the entrypoint is located. | +| `public` | `sourceFiles` | `Map`<`string`, [`TypeSpecScriptNode`](TypeSpecScriptNode.md)\> | All source files in the program, keyed by their file path. | +| `public` | `stateMaps` | `Map`<`symbol`, `StateMap`\> | - | +| `public` | `stateSets` | `Map`<`symbol`, `StateSet`\> | - | +| `public` | `tracer` | [`Tracer`](Tracer.md) | - | + +## Methods + +### getGlobalNamespaceType() + +```ts +getGlobalNamespaceType(): Namespace +``` + +*** + +### getOption() + +```ts +getOption(key): undefined | string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `string` | + +*** + +### getSourceFileLocationContext() + +```ts +getSourceFileLocationContext(sourceFile): LocationContext +``` + +Return location context of the given source file. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `sourceFile` | [`SourceFile`](SourceFile.md) | + +*** + +### hasError() + +```ts +hasError(): boolean +``` + +*** + +### loadTypeSpecScript() + +```ts +loadTypeSpecScript(typespecScript): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `typespecScript` | [`SourceFile`](SourceFile.md) | + +*** + +### onValidate() + +```ts +onValidate(cb, LibraryMetadata): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `cb` | (`program`) => `void` \| `Promise`<`void`\> | +| `LibraryMetadata` | [`LibraryMetadata`](../type-aliases/LibraryMetadata.md) | + +*** + +### reportDiagnostic() + +```ts +reportDiagnostic(diagnostic): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostic` | [`Diagnostic`](Diagnostic.md) | + +*** + +### reportDiagnostics() + +```ts +reportDiagnostics(diagnostics): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | + +*** + +### reportDuplicateSymbols() + +```ts +reportDuplicateSymbols(symbols): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `symbols` | `undefined` \| `SymbolTable` | + +*** + +### resolveTypeReference() + +```ts +resolveTypeReference(reference): [undefined | Type, readonly Diagnostic[]] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `reference` | `string` | + +*** + +### stateMap() + +```ts +stateMap(key): Map +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `symbol` | + +*** + +### stateSet() + +```ts +stateSet(key): Set +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `symbol` | + +*** + +### trace() + +```ts +trace(area, message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `area` | `string` | +| `message` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectLocationContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectLocationContext.md new file mode 100644 index 0000000000..4ab05797d3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectLocationContext.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] ProjectLocationContext" + +--- +Defined in the user project. + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `type` | `"project"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectedNameView.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectedNameView.md new file mode 100644 index 0000000000..57becaa013 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectedNameView.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[I] ProjectedNameView" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `program` | [`ProjectedProgram`](ProjectedProgram.md) | - | + +## Methods + +### getProjectedName() + +```ts +getProjectedName(target): string +``` + +Get the name of the given entity in that scope. +If there is a projected name it returns that one otherwise return the original name. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `target` | `Object` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectedProgram.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectedProgram.md new file mode 100644 index 0000000000..84f3d1db8f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectedProgram.md @@ -0,0 +1,253 @@ +--- +jsApi: true +title: "[I] ProjectedProgram" + +--- +## Extends + +- [`Program`](Program.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `public` | `checker` | [`Checker`](Checker.md) | - | [`Program`](Program.md).`checker` | +| `public` | `compilerOptions` | [`CompilerOptions`](CompilerOptions.md) | - | [`Program`](Program.md).`compilerOptions` | +| `readonly` | `diagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | - | [`Program`](Program.md).`diagnostics` | +| `public` | `emitters` | `EmitterRef`[] | - | [`Program`](Program.md).`emitters` | +| `public` | `host` | [`CompilerHost`](CompilerHost.md) | - | [`Program`](Program.md).`host` | +| `public` | `jsSourceFiles` | `Map`<`string`, [`JsSourceFileNode`](JsSourceFileNode.md)\> | - | [`Program`](Program.md).`jsSourceFiles` | +| `public` | `literalTypes` | `Map`<`string` \| `number` \| `boolean`, [`LiteralType`](../type-aliases/LiteralType.md)\> | - | [`Program`](Program.md).`literalTypes` | +| `public` | `mainFile?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) | - | [`Program`](Program.md).`mainFile` | +| `readonly` | `projectRoot` | `string` | Project root. If a tsconfig was found/specified this is the directory for the tsconfig.json. Otherwise directory where the entrypoint is located. | [`Program`](Program.md).`projectRoot` | +| `public` | `projector` | [`Projector`](Projector.md) | - | - | +| `public` | `sourceFiles` | `Map`<`string`, [`TypeSpecScriptNode`](TypeSpecScriptNode.md)\> | All source files in the program, keyed by their file path. | [`Program`](Program.md).`sourceFiles` | +| `public` | `stateMaps` | `Map`<`symbol`, `StateMap`\> | - | [`Program`](Program.md).`stateMaps` | +| `public` | `stateSets` | `Map`<`symbol`, `StateSet`\> | - | [`Program`](Program.md).`stateSets` | +| `public` | `tracer` | [`Tracer`](Tracer.md) | - | [`Program`](Program.md).`tracer` | + +## Methods + +### getGlobalNamespaceType() + +```ts +getGlobalNamespaceType(): Namespace +``` + +#### Inherited from + +[`Program`](Program.md).[`getGlobalNamespaceType`](Program.md#getglobalnamespacetype) + +*** + +### getOption() + +```ts +getOption(key): undefined | string +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `string` | + +#### Inherited from + +[`Program`](Program.md).[`getOption`](Program.md#getoption) + +*** + +### getSourceFileLocationContext() + +```ts +getSourceFileLocationContext(sourceFile): LocationContext +``` + +Return location context of the given source file. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `sourceFile` | [`SourceFile`](SourceFile.md) | + +#### Inherited from + +[`Program`](Program.md).[`getSourceFileLocationContext`](Program.md#getsourcefilelocationcontext) + +*** + +### hasError() + +```ts +hasError(): boolean +``` + +#### Inherited from + +[`Program`](Program.md).[`hasError`](Program.md#haserror) + +*** + +### loadTypeSpecScript() + +```ts +loadTypeSpecScript(typespecScript): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `typespecScript` | [`SourceFile`](SourceFile.md) | + +#### Inherited from + +[`Program`](Program.md).[`loadTypeSpecScript`](Program.md#loadtypespecscript) + +*** + +### onValidate() + +```ts +onValidate(cb, LibraryMetadata): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `cb` | (`program`) => `void` \| `Promise`<`void`\> | +| `LibraryMetadata` | [`LibraryMetadata`](../type-aliases/LibraryMetadata.md) | + +#### Inherited from + +[`Program`](Program.md).[`onValidate`](Program.md#onvalidate) + +*** + +### reportDiagnostic() + +```ts +reportDiagnostic(diagnostic): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostic` | [`Diagnostic`](Diagnostic.md) | + +#### Inherited from + +[`Program`](Program.md).[`reportDiagnostic`](Program.md#reportdiagnostic) + +*** + +### reportDiagnostics() + +```ts +reportDiagnostics(diagnostics): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | + +#### Inherited from + +[`Program`](Program.md).[`reportDiagnostics`](Program.md#reportdiagnostics) + +*** + +### reportDuplicateSymbols() + +```ts +reportDuplicateSymbols(symbols): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `symbols` | `undefined` \| `SymbolTable` | + +#### Inherited from + +[`Program`](Program.md).[`reportDuplicateSymbols`](Program.md#reportduplicatesymbols) + +*** + +### resolveTypeReference() + +```ts +resolveTypeReference(reference): [undefined | Type, readonly Diagnostic[]] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `reference` | `string` | + +#### Inherited from + +[`Program`](Program.md).[`resolveTypeReference`](Program.md#resolvetypereference) + +*** + +### stateMap() + +```ts +stateMap(key): Map +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `symbol` | + +#### Inherited from + +[`Program`](Program.md).[`stateMap`](Program.md#statemap) + +*** + +### stateSet() + +```ts +stateSet(key): Set +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `key` | `symbol` | + +#### Inherited from + +[`Program`](Program.md).[`stateSet`](Program.md#stateset) + +*** + +### trace() + +```ts +trace(area, message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `area` | `string` | +| `message` | `string` | + +#### Inherited from + +[`Program`](Program.md).[`trace`](Program.md#trace) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Projection.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Projection.md new file mode 100644 index 0000000000..70137039a5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Projection.md @@ -0,0 +1,48 @@ +--- +jsApi: true +title: "[I] Projection" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Projection"` | - | [`BaseType`](BaseType.md).`kind` | +| `node` | `undefined` | - | [`BaseType`](BaseType.md).`node` | +| `nodeByKind` | `Map`<`string`, [`ProjectionStatementNode`](ProjectionStatementNode.md)\> | - | - | +| `nodeByType` | `Map`<[`Type`](../type-aliases/Type.md), [`ProjectionStatementNode`](ProjectionStatementNode.md)\> | - | - | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionApplication.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionApplication.md new file mode 100644 index 0000000000..d7f7018e6a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionApplication.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] ProjectionApplication" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `arguments` | [`DecoratorArgumentValue`](../type-aliases/DecoratorArgumentValue.md)[] | - | +| `direction?` | `"to"` \| `"from"` | - | +| `projectionName` | `string` | - | +| `scope?` | [`Type`](../type-aliases/Type.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionArithmeticExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionArithmeticExpressionNode.md new file mode 100644 index 0000000000..dbabf3f1f6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionArithmeticExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionArithmeticExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionArithmeticExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `left` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `op` | `"+"` \| `"-"` \| `"*"` \| `"/"` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `right` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionBlockExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionBlockExpressionNode.md new file mode 100644 index 0000000000..3cd344a2d3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionBlockExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionBlockExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionBlockExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `statements` | [`ProjectionExpressionStatementNode`](ProjectionExpressionStatementNode.md)[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionCallExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionCallExpressionNode.md new file mode 100644 index 0000000000..07e1dd56d6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionCallExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionCallExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md)[] | - | - | +| `readonly` | `callKind` | `"method"` \| `"template"` | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionCallExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionDecoratorReferenceExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionDecoratorReferenceExpressionNode.md new file mode 100644 index 0000000000..ecbf88c818 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionDecoratorReferenceExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionDecoratorReferenceExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionDecoratorReferenceExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionEnumMemberSelectorNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionEnumMemberSelectorNode.md new file mode 100644 index 0000000000..77b794d67d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionEnumMemberSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionEnumMemberSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionEnumMemberSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionEnumSelectorNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionEnumSelectorNode.md new file mode 100644 index 0000000000..fd423cd7a0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionEnumSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionEnumSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionEnumSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionEqualityExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionEqualityExpressionNode.md new file mode 100644 index 0000000000..ffab6af2ec --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionEqualityExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionEqualityExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionEqualityExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `left` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `op` | `"=="` \| `"!="` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `right` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionExpressionStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionExpressionStatementNode.md new file mode 100644 index 0000000000..48ceddd074 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionExpressionStatementNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionExpressionStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `expr` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionExpressionStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionIfExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionIfExpressionNode.md new file mode 100644 index 0000000000..5709c2bd7a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionIfExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionIfExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `alternate?` | [`ProjectionIfExpressionNode`](ProjectionIfExpressionNode.md) \| [`ProjectionBlockExpressionNode`](ProjectionBlockExpressionNode.md) | - | - | +| `readonly` | `consequent` | [`ProjectionBlockExpressionNode`](ProjectionBlockExpressionNode.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionIfExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `test` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionInterfaceSelectorNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionInterfaceSelectorNode.md new file mode 100644 index 0000000000..6d4ba90aa4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionInterfaceSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionInterfaceSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionInterfaceSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionLambdaExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionLambdaExpressionNode.md new file mode 100644 index 0000000000..ec3f666c25 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionLambdaExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionLambdaExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `body` | [`ProjectionBlockExpressionNode`](ProjectionBlockExpressionNode.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionLambdaExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | - | +| `readonly` | `parameters` | readonly [`ProjectionLambdaParameterDeclarationNode`](ProjectionLambdaParameterDeclarationNode.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionLambdaParameterDeclarationNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionLambdaParameterDeclarationNode.md new file mode 100644 index 0000000000..dfd6838af1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionLambdaParameterDeclarationNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionLambdaParameterDeclarationNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `ProjectionLambdaParameterDeclaration` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionLogicalExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionLogicalExpressionNode.md new file mode 100644 index 0000000000..1d6769f693 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionLogicalExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionLogicalExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionLogicalExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `left` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `op` | `"||"` \| `"&&"` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `right` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionMemberExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionMemberExpressionNode.md new file mode 100644 index 0000000000..d2470b7bd6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionMemberExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionMemberExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `base` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `ProjectionMemberExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `selector` | `"."` \| `"::"` | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelExpressionNode.md new file mode 100644 index 0000000000..12953310a6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionModelExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionModelExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `properties` | ([`ProjectionModelPropertyNode`](ProjectionModelPropertyNode.md) \| [`ProjectionModelSpreadPropertyNode`](ProjectionModelSpreadPropertyNode.md))[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelPropertyNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelPropertyNode.md new file mode 100644 index 0000000000..662c717103 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelPropertyNode.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] ProjectionModelPropertyNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `default?` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `ProjectionModelProperty` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `optional` | `boolean` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelPropertySelectorNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelPropertySelectorNode.md new file mode 100644 index 0000000000..17da083af1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelPropertySelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionModelPropertySelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionModelPropertySelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelSelectorNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelSelectorNode.md new file mode 100644 index 0000000000..82f3d98218 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionModelSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionModelSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelSpreadPropertyNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelSpreadPropertyNode.md new file mode 100644 index 0000000000..3cde0520c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionModelSpreadPropertyNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionModelSpreadPropertyNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionModelSpreadProperty` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionNode.md new file mode 100644 index 0000000000..7a5f624c20 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionNode.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[I] ProjectionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `body` | readonly [`ProjectionExpressionStatementNode`](ProjectionExpressionStatementNode.md)[] | - | - | +| `readonly` | `direction` | \| `"to"` \| `"from"` \| `"pre_to"` \| `"pre_from"` \| `""` | - | - | +| `readonly` | `directionId` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `Projection` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | - | +| `readonly` | `modifierIds` | readonly [`IdentifierNode`](IdentifierNode.md)[] | - | - | +| `readonly` | `parameters` | [`ProjectionParameterDeclarationNode`](ProjectionParameterDeclarationNode.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionOperationSelectorNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionOperationSelectorNode.md new file mode 100644 index 0000000000..188a022208 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionOperationSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionOperationSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionOperationSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionParameterDeclarationNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionParameterDeclarationNode.md new file mode 100644 index 0000000000..28340cac97 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionParameterDeclarationNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionParameterDeclarationNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `ProjectionParameterDeclaration` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionReferenceNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionReferenceNode.md new file mode 100644 index 0000000000..c85e901603 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionReferenceNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] ProjectionReferenceNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionReference` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionRelationalExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionRelationalExpressionNode.md new file mode 100644 index 0000000000..d79122b315 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionRelationalExpressionNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] ProjectionRelationalExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionRelationalExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `left` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `op` | `"<="` \| `">="` \| `"<"` \| `">"` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `right` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionStatementNode.md new file mode 100644 index 0000000000..d7fa6316aa --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionStatementNode.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[I] ProjectionStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `from?` | [`ProjectionNode`](ProjectionNode.md) | - | - | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `ProjectionStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `preFrom?` | [`ProjectionNode`](ProjectionNode.md) | - | - | +| `readonly` | `preTo?` | [`ProjectionNode`](ProjectionNode.md) | - | - | +| `readonly` | `projections` | readonly [`ProjectionNode`](ProjectionNode.md)[] | - | - | +| `readonly` | `selector` | \| [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) \| [`ProjectionModelSelectorNode`](ProjectionModelSelectorNode.md) \| [`ProjectionModelPropertySelectorNode`](ProjectionModelPropertySelectorNode.md) \| [`ProjectionInterfaceSelectorNode`](ProjectionInterfaceSelectorNode.md) \| [`ProjectionOperationSelectorNode`](ProjectionOperationSelectorNode.md) \| [`ProjectionEnumSelectorNode`](ProjectionEnumSelectorNode.md) \| [`ProjectionEnumMemberSelectorNode`](ProjectionEnumMemberSelectorNode.md) \| [`ProjectionUnionSelectorNode`](ProjectionUnionSelectorNode.md) \| [`ProjectionUnionVariantSelectorNode`](ProjectionUnionVariantSelectorNode.md) | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `to?` | [`ProjectionNode`](ProjectionNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionTupleExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionTupleExpressionNode.md new file mode 100644 index 0000000000..872452c7bc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionTupleExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ProjectionTupleExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionTupleExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `values` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md)[] | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionUnaryExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionUnaryExpressionNode.md new file mode 100644 index 0000000000..958f09466e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionUnaryExpressionNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] ProjectionUnaryExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionUnaryExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `op` | `"!"` | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionUnionSelectorNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionUnionSelectorNode.md new file mode 100644 index 0000000000..b3abf4cc23 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionUnionSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionUnionSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionUnionSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionUnionVariantSelectorNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionUnionVariantSelectorNode.md new file mode 100644 index 0000000000..5f05eecedc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ProjectionUnionVariantSelectorNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] ProjectionUnionVariantSelectorNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ProjectionUnionVariantSelector` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Projector.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Projector.md new file mode 100644 index 0000000000..d4e048c656 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Projector.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[I] Projector" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `parentProjector?` | [`Projector`](Projector.md) | - | +| `projectedGlobalNamespace?` | [`Namespace`](Namespace.md) | - | +| `projectedStartNode?` | [`Type`](../type-aliases/Type.md) | - | +| `projectedTypes` | `Map`<[`Type`](../type-aliases/Type.md), [`Type`](../type-aliases/Type.md)\> | - | +| `projections` | [`ProjectionApplication`](ProjectionApplication.md)[] | - | + +## Methods + +### projectType() + +```ts +projectType(type): Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/RecordModelType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/RecordModelType.md new file mode 100644 index 0000000000..293139afb8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/RecordModelType.md @@ -0,0 +1,59 @@ +--- +jsApi: true +title: "[I] RecordModelType" + +--- +## Extends + +- [`Model`](Model.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `baseModel?` | [`Model`](Model.md) | Model this model extends. This represent inheritance. | [`Model`](Model.md).`baseModel` | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`Model`](Model.md).`decorators` | +| `derivedModels` | [`Model`](Model.md)[] | Direct children. This is the reverse relation of [baseModel](ArrayModelType.md) | [`Model`](Model.md).`derivedModels` | +| `indexer` | `object` | - | [`Model`](Model.md).`indexer` | +| `indexer.key` | [`Scalar`](Scalar.md) | - | - | +| `indexer.value` | [`Type`](../type-aliases/Type.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`Model`](Model.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`Model`](Model.md).`isFinished` | +| `kind` | `"Model"` | - | [`Model`](Model.md).`kind` | +| `name` | `string` | - | [`Model`](Model.md).`name` | +| `namespace?` | [`Namespace`](Namespace.md) | - | [`Model`](Model.md).`namespace` | +| `node?` | [`ModelStatementNode`](ModelStatementNode.md) \| [`ModelExpressionNode`](ModelExpressionNode.md) \| [`IntersectionExpressionNode`](IntersectionExpressionNode.md) \| [`ProjectionModelExpressionNode`](ProjectionModelExpressionNode.md) | - | [`Model`](Model.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`Model`](Model.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`Model`](Model.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`Model`](Model.md).`projector` | +| `properties` | `RekeyableMap`<`string`, [`ModelProperty`](ModelProperty.md)\> | The properties of the model.

Properties are ordered in the order that they appear in source.
Properties obtained via `model is` appear before properties defined in
the model body. Properties obtained via `...` are inserted where the
spread appears in source.

Properties inherited via `model extends` are not included. Use
[walkPropertiesInherited](../functions/walkPropertiesInherited.md) to enumerate all properties in the
inheritance hierarchy. | [`Model`](Model.md).`properties` | +| `sourceModel?` | [`Model`](Model.md) | The model that is referenced via `model is`. | [`Model`](Model.md).`sourceModel` | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`Model`](Model.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`Model`](Model.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`Model`](Model.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`Model`](Model.md).[`projectionsByName`](Model.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolveCompilerOptionsOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolveCompilerOptionsOptions.md new file mode 100644 index 0000000000..28cdf7a4c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolveCompilerOptionsOptions.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[I] ResolveCompilerOptionsOptions" + +--- +## Extends + +- `ConfigToOptionsOptions` + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `args?` | `Record`<`string`, `string`\> | Any arguments to interpolate the config. | ConfigToOptionsOptions.args | +| `configPath?` | `string` | Explicit config path. | - | +| `cwd` | `string` | Current working directory. This will be used to interpolate `{cwd}` in the config. | ConfigToOptionsOptions.cwd | +| `entrypoint` | `string` | Absolute entrypoint path | - | +| `env?` | `Record`<`string`, `undefined` \| `string`\> | Environment variables. | ConfigToOptionsOptions.env | +| `overrides?` | `Partial`<`TypeSpecConfig`\> | Compiler options to override the config | ConfigToOptionsOptions.overrides | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolveModuleHost.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolveModuleHost.md new file mode 100644 index 0000000000..078679676d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolveModuleHost.md @@ -0,0 +1,52 @@ +--- +jsApi: true +title: "[I] ResolveModuleHost" + +--- +## Methods + +### readFile() + +```ts +readFile(path): Promise +``` + +Read a utf-8 encoded file. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### realpath() + +```ts +realpath(path): Promise +``` + +Resolve the real path for the current host. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | + +*** + +### stat() + +```ts +stat(path): Promise +``` + +Get information about the given path + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `path` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolveModuleOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolveModuleOptions.md new file mode 100644 index 0000000000..51aa932045 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolveModuleOptions.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] ResolveModuleOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `baseDir` | `string` | - | +| `directoryIndexFiles?` | `string`[] | When resolution reach a directory without package.json look for those files to load in order.

**Default**

` ["index.mjs", "index.js"] ` | +| `resolveMain?` | (`pkg`) => `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolvedFile.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolvedFile.md new file mode 100644 index 0000000000..371c9095d4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolvedFile.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ResolvedFile" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `path` | `string` | - | +| `type` | `"file"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolvedModule.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolvedModule.md new file mode 100644 index 0000000000..15f57df7ad --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ResolvedModule.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] ResolvedModule" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `mainFile` | `string` | Resolved main file for the module. | +| `manifest` | [`NodePackage`](NodePackage.md) | Value of package.json. | +| `path` | `string` | Root of the package. (Same level as package.json) | +| `type` | `"module"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ReturnExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ReturnExpressionNode.md new file mode 100644 index 0000000000..54c1f0736f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ReturnExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ReturnExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `Return` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | [`ProjectionExpression`](../type-aliases/ProjectionExpression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ReturnRecord.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ReturnRecord.md new file mode 100644 index 0000000000..5b0340c8eb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ReturnRecord.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ReturnRecord" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `kind` | `"Return"` | - | +| `value` | [`Type`](../type-aliases/Type.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/RmOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/RmOptions.md new file mode 100644 index 0000000000..4633ef9b42 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/RmOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] RmOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `recursive?` | `boolean` | If `true`, perform a recursive directory removal. In
recursive mode, errors are not reported if `path` does not exist, and
operations are retried on failure.

**Default**

` false ` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Scalar.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Scalar.md new file mode 100644 index 0000000000..839d509377 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Scalar.md @@ -0,0 +1,54 @@ +--- +jsApi: true +title: "[I] Scalar" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md).[`TemplatedTypeBase`](TemplatedTypeBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `baseScalar?` | [`Scalar`](Scalar.md) | Scalar this scalar extends. | - | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `derivedScalars` | [`Scalar`](Scalar.md)[] | Direct children. This is the reverse relation of

**See**

baseScalar | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Scalar"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` | - | - | +| `namespace?` | [`Namespace`](Namespace.md) | Namespace the scalar was defined in. | - | +| `node` | [`ScalarStatementNode`](ScalarStatementNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateArguments` | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateMapper` | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateNode` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ScalarStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ScalarStatementNode.md new file mode 100644 index 0000000000..7e8fa55554 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ScalarStatementNode.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] ScalarStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `extends?` | [`TypeReferenceNode`](TypeReferenceNode.md) | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `ScalarStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Scanner.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Scanner.md new file mode 100644 index 0000000000..d3cd27e70a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Scanner.md @@ -0,0 +1,91 @@ +--- +jsApi: true +title: "[I] Scanner" + +--- +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `file` | [`SourceFile`](SourceFile.md) | The source code being scanned. | +| `readonly` | `position` | `number` | The offset in UTF-16 code units to the current position at the start of the next token. | +| `readonly` | `token` | [`Token`](../enumerations/Token.md) | The current token | +| `readonly` | `tokenFlags` | [`TokenFlags`](../enumerations/TokenFlags.md) | The flags on the current token. | +| `readonly` | `tokenPosition` | `number` | The offset in UTF-16 code units to the start of the current token. | + +## Methods + +### eof() + +```ts +eof(): boolean +``` + +Determine if the scanner has reached the end of the input. + +*** + +### getTokenText() + +```ts +getTokenText(): string +``` + +The exact spelling of the current token. + +*** + +### getTokenValue() + +```ts +getTokenValue(): string +``` + +The value of the current token. + +String literals are escaped and unquoted, identifiers are normalized, +and all other tokens return their exact spelling sames as +getTokenText(). + +*** + +### scan() + +```ts +scan(): Token +``` + +Advance one token. + +*** + +### scanDoc() + +```ts +scanDoc(): DocToken +``` + +Advance one token inside DocComment. Use inside [scanRange](Scanner.md#scanrange) callback over DocComment range. + +*** + +### scanRange() + +```ts +scanRange(range, callback): T +``` + +Reset the scanner to the given start and end positions, invoke the callback, and then restore scanner state. + +#### Type parameters + +| Parameter | +| :------ | +| `T` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `range` | [`TextRange`](TextRange.md) | +| `callback` | () => `T` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SemanticToken.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SemanticToken.md new file mode 100644 index 0000000000..e49a1e1d5f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SemanticToken.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] SemanticToken" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `end` | `number` | - | +| `kind` | [`SemanticTokenKind`](../enumerations/SemanticTokenKind.md) | - | +| `pos` | `number` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Server.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Server.md new file mode 100644 index 0000000000..1c732148fb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Server.md @@ -0,0 +1,306 @@ +--- +jsApi: true +title: "[I] Server" + +--- +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `pendingMessages` | readonly `string`[] | - | +| `readonly` | `workspaceFolders` | readonly [`ServerWorkspaceFolder`](ServerWorkspaceFolder.md)[] | - | + +## Methods + +### buildSemanticTokens() + +```ts +buildSemanticTokens(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `SemanticTokensParams` | + +*** + +### checkChange() + +```ts +checkChange(change): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `change` | `TextDocumentChangeEvent`<`TextDocument`\> | + +*** + +### compile() + +```ts +compile(document): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `document` | `TextDocument` \| `TextDocumentIdentifier` | + +*** + +### complete() + +```ts +complete(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `CompletionParams` | + +*** + +### documentClosed() + +```ts +documentClosed(change): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `change` | `TextDocumentChangeEvent`<`TextDocument`\> | + +*** + +### findDocumentHighlight() + +```ts +findDocumentHighlight(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `DocumentHighlightParams` | + +*** + +### findReferences() + +```ts +findReferences(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `ReferenceParams` | + +*** + +### formatDocument() + +```ts +formatDocument(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `DocumentFormattingParams` | + +*** + +### getDocumentSymbols() + +```ts +getDocumentSymbols(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `DocumentSymbolParams` | + +*** + +### getFoldingRanges() + +```ts +getFoldingRanges(getFoldingRanges): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `getFoldingRanges` | `FoldingRangeParams` | + +*** + +### getHover() + +```ts +getHover(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `HoverParams` | + +*** + +### getSemanticTokens() + +```ts +getSemanticTokens(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `SemanticTokensParams` | + +*** + +### getSignatureHelp() + +```ts +getSignatureHelp(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `SignatureHelpParams` | + +*** + +### gotoDefinition() + +```ts +gotoDefinition(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `DefinitionParams` | + +*** + +### initialize() + +```ts +initialize(params): Promise> +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `InitializeParams` | + +*** + +### initialized() + +```ts +initialized(params): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `InitializedParams` | + +*** + +### log() + +```ts +log(message, details?): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | +| `details`? | `any` | + +*** + +### prepareRename() + +```ts +prepareRename(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `PrepareRenameParams` | + +*** + +### rename() + +```ts +rename(params): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `RenameParams` | + +*** + +### watchedFilesChanged() + +```ts +watchedFilesChanged(params): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `DidChangeWatchedFilesParams` | + +*** + +### workspaceFoldersChanged() + +```ts +workspaceFoldersChanged(e): Promise +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `e` | `WorkspaceFoldersChangeEvent` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServerHost.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServerHost.md new file mode 100644 index 0000000000..b912a5e8e0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServerHost.md @@ -0,0 +1,53 @@ +--- +jsApi: true +title: "[I] ServerHost" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `compilerHost` | [`CompilerHost`](CompilerHost.md) | - | +| `throwInternalErrors?` | `boolean` | - | + +## Methods + +### getOpenDocumentByURL() + +```ts +getOpenDocumentByURL(url): undefined | TextDocument +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `url` | `string` | + +*** + +### log() + +```ts +log(message): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `message` | `string` | + +*** + +### sendDiagnostics() + +```ts +sendDiagnostics(params): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `params` | `PublishDiagnosticsParams` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServerSourceFile.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServerSourceFile.md new file mode 100644 index 0000000000..f50a90d0ce --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServerSourceFile.md @@ -0,0 +1,53 @@ +--- +jsApi: true +title: "[I] ServerSourceFile" + +--- +## Extends + +- [`SourceFile`](SourceFile.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `document?` | `TextDocument` | - | - | +| `readonly` | `path` | `string` | The source file path.

This is used only for diagnostics. The command line compiler will populate
it with the actual path from which the file was read, but it can actually
be an arbitrary name for other scenarios. | [`SourceFile`](SourceFile.md).`path` | +| `readonly` | `text` | `string` | The source code text. | [`SourceFile`](SourceFile.md).`text` | + +## Methods + +### getLineAndCharacterOfPosition() + +```ts +getLineAndCharacterOfPosition(position): LineAndCharacter +``` + +Converts a one-dimensional position in the document (measured in UTF-16 +code units) to line number and offset from line start. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `position` | `number` | + +#### Inherited from + +[`SourceFile`](SourceFile.md).[`getLineAndCharacterOfPosition`](SourceFile.md#getlineandcharacterofposition) + +*** + +### getLineStarts() + +```ts +getLineStarts(): readonly number[] +``` + +Array of positions in the text where each line begins. There is one entry +per line, in order of lines, and each entry represents the offset in UTF-16 +code units from the start of the document to the beginning of the line. + +#### Inherited from + +[`SourceFile`](SourceFile.md).[`getLineStarts`](SourceFile.md#getlinestarts) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServerWorkspaceFolder.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServerWorkspaceFolder.md new file mode 100644 index 0000000000..982da160b0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServerWorkspaceFolder.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[I] ServerWorkspaceFolder" + +--- +## Extends + +- `WorkspaceFolder` + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `name` | `string` | The name of the workspace folder. Used to refer to this
workspace folder in the user interface. | WorkspaceFolder.name | +| `path` | `string` | - | - | +| `uri` | `string` | The associated URI for this workspace folder. | WorkspaceFolder.uri | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Service.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Service.md new file mode 100644 index 0000000000..c5895d499e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Service.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[I] Service" + +--- +## Extends + +- [`ServiceDetails`](ServiceDetails.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `title?` | `string` | - | [`ServiceDetails`](ServiceDetails.md).`title` | +| `type` | [`Namespace`](Namespace.md) | - | - | +| `version?` | `string` | - | [`ServiceDetails`](ServiceDetails.md).`version` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServiceDetails.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServiceDetails.md new file mode 100644 index 0000000000..c6af2118ae --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ServiceDetails.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[I] ServiceDetails" + +--- +## Extended By + +- [`Service`](Service.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `title?` | `string` | - | +| `version?` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SourceFile.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SourceFile.md new file mode 100644 index 0000000000..96ecc3a7de --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SourceFile.md @@ -0,0 +1,44 @@ +--- +jsApi: true +title: "[I] SourceFile" + +--- +## Extended By + +- [`ServerSourceFile`](ServerSourceFile.md) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `path` | `string` | The source file path.

This is used only for diagnostics. The command line compiler will populate
it with the actual path from which the file was read, but it can actually
be an arbitrary name for other scenarios. | +| `readonly` | `text` | `string` | The source code text. | + +## Methods + +### getLineAndCharacterOfPosition() + +```ts +getLineAndCharacterOfPosition(position): LineAndCharacter +``` + +Converts a one-dimensional position in the document (measured in UTF-16 +code units) to line number and offset from line start. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `position` | `number` | + +*** + +### getLineStarts() + +```ts +getLineStarts(): readonly number[] +``` + +Array of positions in the text where each line begins. There is one entry +per line, in order of lines, and each entry represents the offset in UTF-16 +code units from the start of the document to the beginning of the line. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SourceLocation.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SourceLocation.md new file mode 100644 index 0000000000..f017413ccf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SourceLocation.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[I] SourceLocation" + +--- +## Extends + +- [`TextRange`](TextRange.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`TextRange`](TextRange.md).`end` | +| `public` | `file` | [`SourceFile`](SourceFile.md) | - | - | +| `public` | `isSynthetic?` | `boolean` | - | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`TextRange`](TextRange.md).`pos` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SourceLocationOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SourceLocationOptions.md new file mode 100644 index 0000000000..3cd8d892df --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SourceLocationOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] SourceLocationOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `locateId?` | `boolean` | If trying to resolve the location of a type with an ID, show the location of the ID node instead of the entire type.
This makes sure that the location range is not too large and hard to read. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/StringLiteral.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/StringLiteral.md new file mode 100644 index 0000000000..78db796f29 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/StringLiteral.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] StringLiteral" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"String"` | - | [`BaseType`](BaseType.md).`kind` | +| `node?` | [`StringLiteralNode`](StringLiteralNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `value` | `string` | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/StringLiteralNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/StringLiteralNode.md new file mode 100644 index 0000000000..90140a9794 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/StringLiteralNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] StringLiteralNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `StringLiteral` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | `string` | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SuppressDirective.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SuppressDirective.md new file mode 100644 index 0000000000..b578a32134 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SuppressDirective.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[I] SuppressDirective" + +--- +## Extends + +- [`DirectiveBase`](DirectiveBase.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `code` | `string` | - | - | +| `message` | `string` | - | - | +| `name` | `"suppress"` | - | - | +| `node` | [`DirectiveExpressionNode`](DirectiveExpressionNode.md) | - | [`DirectiveBase`](DirectiveBase.md).`node` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Sym.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Sym.md new file mode 100644 index 0000000000..06e634f494 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Sym.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[I] Sym" + +--- +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `declarations` | readonly [`Node`](../type-aliases/Node.md)[] | Nodes which contribute to this declaration | +| `readonly` | `exports?` | `SymbolTable` | Externally visible symbols contained inside this symbol. E.g. all declarations
in a namespace, or members of an enum. | +| `readonly` | `flags` | [`SymbolFlags`](../enumerations/SymbolFlags.md) | - | +| `readonly` | `id?` | `number` | A unique identifier for this symbol. Used to look up the symbol links. | +| `readonly` | `members?` | `SymbolTable` | Symbols for members of this symbol which must be referenced off the parent symbol
and cannot be referenced by other means (i.e. by unqualified lookup of the symbol
name). | +| `readonly` | `metatypeMembers?` | `SymbolTable` | Symbol table | +| `readonly` | `name` | `string` | The name of the symbol | +| `readonly` | `parent?` | [`Sym`](Sym.md) | The symbol containing this symbol, if any. E.g. for things declared in
a namespace, this refers to the namespace. | +| `readonly` | `symbolSource?` | [`Sym`](Sym.md) | For using symbols, this is the used symbol. | +| `readonly` | `type?` | [`Type`](../type-aliases/Type.md) | For late-bound symbols, this is the type referenced by the symbol. | +| `readonly` | `value?` | (...`args`) => `any` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SymbolLinks.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SymbolLinks.md new file mode 100644 index 0000000000..e36931875f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SymbolLinks.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] SymbolLinks" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `declaredType?` | [`Type`](../type-aliases/Type.md) | - | +| `instantiations?` | [`TypeInstantiationMap`](TypeInstantiationMap.md) | - | +| `type?` | [`Type`](../type-aliases/Type.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SyntheticLocationContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SyntheticLocationContext.md new file mode 100644 index 0000000000..a45cd6cad5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/SyntheticLocationContext.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] SyntheticLocationContext" + +--- +Refer to a type that was not declared in a file + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `type` | `"synthetic"` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplateDeclarationNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplateDeclarationNode.md new file mode 100644 index 0000000000..8167575c7c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplateDeclarationNode.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[I] TemplateDeclarationNode" + +--- +## Extended By + +- [`OperationStatementNode`](OperationStatementNode.md) +- [`ModelStatementNode`](ModelStatementNode.md) +- [`ScalarStatementNode`](ScalarStatementNode.md) +- [`InterfaceStatementNode`](InterfaceStatementNode.md) +- [`UnionStatementNode`](UnionStatementNode.md) +- [`AliasStatementNode`](AliasStatementNode.md) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `locals?` | `SymbolTable` | - | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplateParameter.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplateParameter.md new file mode 100644 index 0000000000..c9b333f356 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplateParameter.md @@ -0,0 +1,48 @@ +--- +jsApi: true +title: "[I] TemplateParameter" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `constraint?` | [`Type`](../type-aliases/Type.md) \| [`ValueType`](ValueType.md) | - | - | +| `default?` | [`Type`](../type-aliases/Type.md) | - | - | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"TemplateParameter"` | - | [`BaseType`](BaseType.md).`kind` | +| `node` | [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplateParameterDeclarationNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplateParameterDeclarationNode.md new file mode 100644 index 0000000000..2ac7bb59d3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplateParameterDeclarationNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] TemplateParameterDeclarationNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `constraint?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `default?` | [`Expression`](../type-aliases/Expression.md) | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `TemplateParameterDeclaration` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`TemplateableNode`](../type-aliases/TemplateableNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplatedTypeBase.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplatedTypeBase.md new file mode 100644 index 0000000000..987e48f7a6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TemplatedTypeBase.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[I] TemplatedTypeBase" + +--- +## Extended By + +- [`Model`](Model.md) +- [`Scalar`](Scalar.md) +- [`Interface`](Interface.md) +- [`Operation`](Operation.md) +- [`Union`](Union.md) + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | +| `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | +| `templateNode?` | [`Node`](../type-aliases/Node.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TextRange.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TextRange.md new file mode 100644 index 0000000000..cabae13e55 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TextRange.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[I] TextRange" + +--- +## Extended By + +- [`BaseNode`](BaseNode.md) +- [`LineComment`](LineComment.md) +- [`BlockComment`](BlockComment.md) +- [`SourceLocation`](SourceLocation.md) + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Tracer.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Tracer.md new file mode 100644 index 0000000000..3a3f9861be --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Tracer.md @@ -0,0 +1,39 @@ +--- +jsApi: true +title: "[I] Tracer" + +--- +## Methods + +### sub() + +```ts +sub(subarea): Tracer +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `subarea` | `string` | + +*** + +### trace() + +```ts +trace( + area, + message, + target?): void +``` + +Trace + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `area` | `string` | | +| `message` | `string` | | +| `target`? | [`DiagnosticTarget`](../type-aliases/DiagnosticTarget.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TracerOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TracerOptions.md new file mode 100644 index 0000000000..145b6400fb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TracerOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] TracerOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `filter?` | `string`[] | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Tuple.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Tuple.md new file mode 100644 index 0000000000..2fceb725ba --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Tuple.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] Tuple" + +--- +## Extends + +- [`BaseType`](BaseType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"Tuple"` | - | [`BaseType`](BaseType.md).`kind` | +| `node` | [`TupleExpressionNode`](TupleExpressionNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `values` | [`Type`](../type-aliases/Type.md)[] | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TupleExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TupleExpressionNode.md new file mode 100644 index 0000000000..3a0251e246 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TupleExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] TupleExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `TupleExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `values` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeInstantiationMap.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeInstantiationMap.md new file mode 100644 index 0000000000..23d9ed98f8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeInstantiationMap.md @@ -0,0 +1,35 @@ +--- +jsApi: true +title: "[I] TypeInstantiationMap" + +--- +Maps type arguments to instantiated type. + +## Methods + +### get() + +```ts +get(args): undefined | Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `args` | readonly [`Type`](../type-aliases/Type.md)[] | + +*** + +### set() + +```ts +set(args, type): void +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `args` | readonly [`Type`](../type-aliases/Type.md)[] | +| `type` | [`Type`](../type-aliases/Type.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeMapper.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeMapper.md new file mode 100644 index 0000000000..974a74ff32 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeMapper.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] TypeMapper" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `args` | readonly [`Type`](../type-aliases/Type.md)[] | - | +| `partial` | `boolean` | - | + +## Methods + +### getMappedType() + +```ts +getMappedType(type): Type +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`TemplateParameter`](TemplateParameter.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeNameOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeNameOptions.md new file mode 100644 index 0000000000..8b4ff0574e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeNameOptions.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] TypeNameOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `namespaceFilter?` | (`ns`) => `boolean` | - | +| `printable?` | `boolean` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeReferenceNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeReferenceNode.md new file mode 100644 index 0000000000..85a89e6b07 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeReferenceNode.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[I] TypeReferenceNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `arguments` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `TypeReference` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecCompletionItem.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecCompletionItem.md new file mode 100644 index 0000000000..ac1c10531e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecCompletionItem.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] TypeSpecCompletionItem" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `label?` | `string` | Optional label if different from the text to complete. | +| `sym` | [`Sym`](Sym.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecLibrary.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecLibrary.md new file mode 100644 index 0000000000..13585f50c4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecLibrary.md @@ -0,0 +1,105 @@ +--- +jsApi: true +title: "[I] TypeSpecLibrary" + +--- +Definition of a TypeSpec library + +## Extends + +- [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md)<`T`, `E`\> + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `E` extends `Record`<`string`, `any`\> | `Record`<`string`, `never`\> | + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `diagnostics` | [`DiagnosticMap`](../type-aliases/DiagnosticMap.md)<`T`\> | Map of potential diagnostics that can be emitted in this library where the key is the diagnostic code. | [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md).`diagnostics` | +| `readonly` | `emitter?` | `object` | Emitter configuration if library is an emitter. | [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md).`emitter` | +| `readonly` | `emitter.options?` | [`JSONSchemaType`](../type-aliases/JSONSchemaType.md)<`E`\> | - | - | +| `readonly` | `emitterOptionValidator?` | [`JSONSchemaValidator`](JSONSchemaValidator.md) | JSON Schema validator for emitter options | - | +| `readonly` | `linter?` | [`LinterDefinition`](LinterDefinition.md) | Configuration if library is providing linting rules/rulesets. | [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md).`linter` | +| `readonly` | `name` | `string` | Name of the library. Must match the package.json name. | [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md).`name` | +| `public` | `requireImports?` | readonly `string`[] | List of other library that should be imported when this is used as an emitter.
Compiler will emit an error if the libraries are not explicitly imported. | [`TypeSpecLibraryDef`](TypeSpecLibraryDef.md).`requireImports` | + +## Methods + +### createDiagnostic() + +```ts +createDiagnostic(diag): Diagnostic +``` + +#### Type parameters + +| Parameter | +| :------ | +| `C` extends `string` \| `number` \| `symbol` | +| `M` extends `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `diag` | [`DiagnosticReport`](../type-aliases/DiagnosticReport.md)<`T`, `C`, `M`\> | + +*** + +### createStateSymbol() + +```ts +createStateSymbol(name): symbol +``` + +Get or create a symbol with the given name unique for that library. + +#### Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `name` | `string` | Symbol name scoped with the library name. | + +*** + +### getTracer() + +```ts +getTracer(program): Tracer +``` + +Returns a tracer scopped to the current library. +All trace area logged via this tracer will be prefixed with the library name. + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](Program.md) | + +*** + +### reportDiagnostic() + +```ts +reportDiagnostic(program, diag): void +``` + +#### Type parameters + +| Parameter | +| :------ | +| `C` extends `string` \| `number` \| `symbol` | +| `M` extends `string` \| `number` \| `symbol` | + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | [`Program`](Program.md) | +| `diag` | [`DiagnosticReport`](../type-aliases/DiagnosticReport.md)<`T`, `C`, `M`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecLibraryDef.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecLibraryDef.md new file mode 100644 index 0000000000..f7fae3e4e6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecLibraryDef.md @@ -0,0 +1,28 @@ +--- +jsApi: true +title: "[I] TypeSpecLibraryDef" + +--- +Definition of a TypeSpec library + +## Extended By + +- [`TypeSpecLibrary`](TypeSpecLibrary.md) + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `E` extends `Record`<`string`, `any`\> | `Record`<`string`, `never`\> | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `diagnostics` | [`DiagnosticMap`](../type-aliases/DiagnosticMap.md)<`T`\> | Map of potential diagnostics that can be emitted in this library where the key is the diagnostic code. | +| `readonly` | `emitter?` | `object` | Emitter configuration if library is an emitter. | +| `readonly` | `emitter.options?` | [`JSONSchemaType`](../type-aliases/JSONSchemaType.md)<`E`\> | - | +| `readonly` | `linter?` | [`LinterDefinition`](LinterDefinition.md) | Configuration if library is providing linting rules/rulesets. | +| `readonly` | `name` | `string` | Name of the library. Must match the package.json name. | +| `public` | `requireImports?` | readonly `string`[] | List of other library that should be imported when this is used as an emitter.
Compiler will emit an error if the libraries are not explicitly imported. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecManifest.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecManifest.md new file mode 100644 index 0000000000..67130a08b8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecManifest.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[I] TypeSpecManifest" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `commit` | `string` | Full commit sha. | +| `pr?` | `number` | Number of the pull request, if the build was from a pull request. | +| `version` | `string` | Version of the tsp compiler. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecScriptNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecScriptNode.md new file mode 100644 index 0000000000..b3ac438174 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/TypeSpecScriptNode.md @@ -0,0 +1,32 @@ +--- +jsApi: true +title: "[I] TypeSpecScriptNode" + +--- +## Extends + +- [`DeclarationNode`](DeclarationNode.md).[`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `comments` | readonly [`Comment`](../type-aliases/Comment.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `file` | [`SourceFile`](SourceFile.md) | - | - | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `inScopeNamespaces` | readonly [`NamespaceStatementNode`](NamespaceStatementNode.md)[] | - | - | +| `readonly` | `kind` | `TypeSpecScript` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals` | `SymbolTable` | - | - | +| `readonly` | `namespaces` | [`NamespaceStatementNode`](NamespaceStatementNode.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `parseDiagnostics` | readonly [`Diagnostic`](Diagnostic.md)[] | - | - | +| `readonly` | `parseOptions` | [`ParseOptions`](ParseOptions.md) | - | - | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `printable` | `boolean` | - | - | +| `readonly` | `statements` | readonly [`Statement`](../type-aliases/Statement.md)[] | - | - | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `usings` | readonly [`UsingStatementNode`](UsingStatementNode.md)[] | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Union.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Union.md new file mode 100644 index 0000000000..1bcadb301d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/Union.md @@ -0,0 +1,55 @@ +--- +jsApi: true +title: "[I] Union" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md).[`TemplatedTypeBase`](TemplatedTypeBase.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `public` | `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `public` | `expression` | `boolean` | - | - | +| `public` | `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `public` | `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `public` | `kind` | `"Union"` | - | [`BaseType`](BaseType.md).`kind` | +| `public` | `name?` | `string` | - | - | +| `public` | `namespace?` | [`Namespace`](Namespace.md) | - | - | +| `public` | `node` | [`UnionStatementNode`](UnionStatementNode.md) \| [`UnionExpressionNode`](UnionExpressionNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `readonly` | `options` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use variants | - | +| `public` | `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `public` | `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `public` | `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `public` | `templateArguments?` | [`Type`](../type-aliases/Type.md)[] | **Deprecated**

use templateMapper instead. | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateArguments` | +| `public` | `templateMapper?` | [`TypeMapper`](TypeMapper.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateMapper` | +| `public` | `templateNode?` | [`Node`](../type-aliases/Node.md) | - | [`TemplatedTypeBase`](TemplatedTypeBase.md).`templateNode` | +| `public` | `variants` | `RekeyableMap`<`string` \| `symbol`, [`UnionVariant`](UnionVariant.md)\> | The variants of the union.

Variants are ordered in order that they appear in source. | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionExpressionNode.md new file mode 100644 index 0000000000..14c5a5e550 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] UnionExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `UnionExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `options` | readonly [`Expression`](../type-aliases/Expression.md)[] | - | - | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionStatementNode.md new file mode 100644 index 0000000000..1220ada39c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionStatementNode.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[I] UnionStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md).[`DeclarationNode`](DeclarationNode.md).[`TemplateDeclarationNode`](TemplateDeclarationNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id` | [`IdentifierNode`](IdentifierNode.md) | - | [`DeclarationNode`](DeclarationNode.md).`id` | +| `readonly` | `kind` | `UnionStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `locals?` | `SymbolTable` | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`locals` | +| `readonly` | `options` | readonly [`UnionVariantNode`](UnionVariantNode.md)[] | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `templateParameters` | readonly [`TemplateParameterDeclarationNode`](TemplateParameterDeclarationNode.md)[] | - | [`TemplateDeclarationNode`](TemplateDeclarationNode.md).`templateParameters` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionVariant.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionVariant.md new file mode 100644 index 0000000000..94aba8a4f6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionVariant.md @@ -0,0 +1,50 @@ +--- +jsApi: true +title: "[I] UnionVariant" + +--- +## Extends + +- [`BaseType`](BaseType.md).[`DecoratedType`](DecoratedType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `decorators` | [`DecoratorApplication`](DecoratorApplication.md)[] | - | [`DecoratedType`](DecoratedType.md).`decorators` | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`BaseType`](BaseType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`BaseType`](BaseType.md).`isFinished` | +| `kind` | `"UnionVariant"` | - | [`BaseType`](BaseType.md).`kind` | +| `name` | `string` \| `symbol` | - | - | +| `node` | `undefined` \| [`UnionVariantNode`](UnionVariantNode.md) | - | [`BaseType`](BaseType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`BaseType`](BaseType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`BaseType`](BaseType.md).`projector` | +| `type` | [`Type`](../type-aliases/Type.md) | - | - | +| `union` | [`Union`](Union.md) | - | - | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`BaseType`](BaseType.md).[`projectionsByName`](BaseType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionVariantNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionVariantNode.md new file mode 100644 index 0000000000..e592839947 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnionVariantNode.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[I] UnionVariantNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `decorators` | readonly [`DecoratorExpressionNode`](DecoratorExpressionNode.md)[] | - | - | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `id?` | [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `kind` | `UnionVariant` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`UnionStatementNode`](UnionStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `value` | [`Expression`](../type-aliases/Expression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnknownType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnknownType.md new file mode 100644 index 0000000000..3fa09ba62b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UnknownType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] UnknownType" + +--- +## Extends + +- [`IntrinsicType`](IntrinsicType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`IntrinsicType`](IntrinsicType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`IntrinsicType`](IntrinsicType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`IntrinsicType`](IntrinsicType.md).`kind` | +| `name` | `"unknown"` | - | [`IntrinsicType`](IntrinsicType.md).`name` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`IntrinsicType`](IntrinsicType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`IntrinsicType`](IntrinsicType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`IntrinsicType`](IntrinsicType.md).[`projectionsByName`](IntrinsicType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UsageTracker.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UsageTracker.md new file mode 100644 index 0000000000..777ceaa089 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UsageTracker.md @@ -0,0 +1,25 @@ +--- +jsApi: true +title: "[I] UsageTracker" + +--- +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `readonly` | `types` | readonly [`TrackableType`](../type-aliases/TrackableType.md)[] | - | + +## Methods + +### isUsedAs() + +```ts +isUsedAs(type, usage): boolean +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `type` | [`TrackableType`](../type-aliases/TrackableType.md) | +| `usage` | [`UsageFlags`](../enumerations/UsageFlags.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UsingStatementNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UsingStatementNode.md new file mode 100644 index 0000000000..644117d12f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/UsingStatementNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] UsingStatementNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `UsingStatement` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `name` | [`MemberExpressionNode`](MemberExpressionNode.md) \| [`IdentifierNode`](IdentifierNode.md) | - | - | +| `readonly` | `parent?` | [`TypeSpecScriptNode`](TypeSpecScriptNode.md) \| [`NamespaceStatementNode`](NamespaceStatementNode.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ValueOfExpressionNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ValueOfExpressionNode.md new file mode 100644 index 0000000000..9c4c98a981 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ValueOfExpressionNode.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[I] ValueOfExpressionNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `ValueOfExpression` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | +| `readonly` | `target` | [`Expression`](../type-aliases/Expression.md) | - | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ValueType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ValueType.md new file mode 100644 index 0000000000..894a39a776 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/ValueType.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ValueType" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `kind` | `"Value"` | - | +| `target` | [`Type`](../type-aliases/Type.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/VoidKeywordNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/VoidKeywordNode.md new file mode 100644 index 0000000000..6035a0d3b7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/VoidKeywordNode.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[I] VoidKeywordNode" + +--- +## Extends + +- [`BaseNode`](BaseNode.md) + +## Properties + +| Modifier | Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | :------ | +| `readonly` | `directives?` | readonly [`DirectiveExpressionNode`](DirectiveExpressionNode.md)[] | - | [`BaseNode`](BaseNode.md).`directives` | +| `readonly` | `docs?` | readonly [`DocNode`](DocNode.md)[] | - | [`BaseNode`](BaseNode.md).`docs` | +| `readonly` | `end` | `number` | The ending position measured in UTF-16 code units from the start of the
full string. Exclusive. | [`BaseNode`](BaseNode.md).`end` | +| `readonly` | `flags` | [`NodeFlags`](../enumerations/NodeFlags.md) | - | [`BaseNode`](BaseNode.md).`flags` | +| `readonly` | `kind` | `VoidKeyword` | - | [`BaseNode`](BaseNode.md).`kind` | +| `readonly` | `parent?` | [`Node`](../type-aliases/Node.md) | - | [`BaseNode`](BaseNode.md).`parent` | +| `readonly` | `pos` | `number` | The starting position of the ranger measured in UTF-16 code units from the
start of the full string. Inclusive. | [`BaseNode`](BaseNode.md).`pos` | +| `readonly` | `symbol` | [`Sym`](Sym.md) | Could be undefined but making this optional creates a lot of noise. In practice,
you will likely only access symbol in cases where you know the node has a symbol. | [`BaseNode`](BaseNode.md).`symbol` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/VoidType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/VoidType.md new file mode 100644 index 0000000000..79d22f6062 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/interfaces/VoidType.md @@ -0,0 +1,47 @@ +--- +jsApi: true +title: "[I] VoidType" + +--- +## Extends + +- [`IntrinsicType`](IntrinsicType.md) + +## Properties + +| Property | Type | Description | Inheritance | +| :------ | :------ | :------ | :------ | +| `instantiationParameters?` | [`Type`](../type-aliases/Type.md)[] | - | [`IntrinsicType`](IntrinsicType.md).`instantiationParameters` | +| `isFinished` | `boolean` | Reflect if a type has been finished(Decorators have been called).
There is multiple reasons a type might not be finished:
- a template declaration will not
- a template instance that argument that are still template parameters
- a template instance that is only partially instantiated(like a templated operation inside a templated interface) | [`IntrinsicType`](IntrinsicType.md).`isFinished` | +| `kind` | `"Intrinsic"` | - | [`IntrinsicType`](IntrinsicType.md).`kind` | +| `name` | `"void"` | - | [`IntrinsicType`](IntrinsicType.md).`name` | +| `node?` | [`Node`](../type-aliases/Node.md) | - | [`IntrinsicType`](IntrinsicType.md).`node` | +| `projectionBase?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionBase` | +| `projectionSource?` | [`Type`](../type-aliases/Type.md) | - | [`IntrinsicType`](IntrinsicType.md).`projectionSource` | +| `projector?` | [`Projector`](Projector.md) | - | [`IntrinsicType`](IntrinsicType.md).`projector` | + +## Accessors + +### projections + +```ts +get projections(): ProjectionStatementNode[] +``` + +## Methods + +### projectionsByName() + +```ts +projectionsByName(name): ProjectionStatementNode[] +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `name` | `string` | + +#### Inherited from + +[`IntrinsicType`](IntrinsicType.md).[`projectionsByName`](IntrinsicType.md#projectionsbyname) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/BytesKnownEncoding.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/BytesKnownEncoding.md new file mode 100644 index 0000000000..d0d2a38d47 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/BytesKnownEncoding.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] BytesKnownEncoding" + +--- +```ts +type BytesKnownEncoding: "base64" | "base64url"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlCompletionItem.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlCompletionItem.md new file mode 100644 index 0000000000..3636164b4f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlCompletionItem.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] CadlCompletionItem" + +--- +```ts +type CadlCompletionItem: TypeSpecCompletionItem; +``` + +## Deprecated + +Use TypeSpecCompletionItem diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlLibrary.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlLibrary.md new file mode 100644 index 0000000000..439cb3d7a3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlLibrary.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[T] CadlLibrary" + +--- +```ts +type CadlLibrary: TypeSpecLibrary; +``` + +## Deprecated + +Use TypeSpecLibrary + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `E` extends `Record`<`string`, `any`\> | `Record`<`string`, `never`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlLibraryDef.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlLibraryDef.md new file mode 100644 index 0000000000..0406e7a139 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlLibraryDef.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[T] CadlLibraryDef" + +--- +```ts +type CadlLibraryDef: TypeSpecLibraryDef; +``` + +## Deprecated + +Use TypeSpecLibraryDef + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `E` extends `Record`<`string`, `any`\> | `Record`<`string`, `never`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlManifest.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlManifest.md new file mode 100644 index 0000000000..8dbe5c70e6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlManifest.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] CadlManifest" + +--- +```ts +type CadlManifest: TypeSpecManifest; +``` + +## Deprecated + +Use TypeSpecManifest diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlScriptNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlScriptNode.md new file mode 100644 index 0000000000..cc62bc8a92 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlScriptNode.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] CadlScriptNode" + +--- +```ts +type CadlScriptNode: TypeSpecScriptNode; +``` + +## Deprecated + +Use TypeSpecScriptNode diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlValue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlValue.md new file mode 100644 index 0000000000..7a0c2a0a20 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CadlValue.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[T] CadlValue" + +--- +```ts +type CadlValue: TypeSpecValue; +``` + +## Deprecated + +Use TypeSpecValue diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Comment.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Comment.md new file mode 100644 index 0000000000..cb9d83c25d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Comment.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] Comment" + +--- +```ts +type Comment: LineComment | BlockComment; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CreateTypeProps.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CreateTypeProps.md new file mode 100644 index 0000000000..09077fab54 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/CreateTypeProps.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] CreateTypeProps" + +--- +```ts +type CreateTypeProps: Omit; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DateTimeKnownEncoding.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DateTimeKnownEncoding.md new file mode 100644 index 0000000000..adb02250da --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DateTimeKnownEncoding.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DateTimeKnownEncoding" + +--- +```ts +type DateTimeKnownEncoding: "rfc3339" | "rfc7231" | "unixTimestamp"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Declaration.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Declaration.md new file mode 100644 index 0000000000..02ab5c9b0f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Declaration.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[T] Declaration" + +--- +```ts +type Declaration: + | ModelStatementNode + | ScalarStatementNode + | InterfaceStatementNode + | UnionStatementNode + | NamespaceStatementNode + | OperationStatementNode + | TemplateParameterDeclarationNode + | ProjectionStatementNode + | ProjectionParameterDeclarationNode + | ProjectionLambdaParameterDeclarationNode + | EnumStatementNode + | AliasStatementNode + | DecoratorDeclarationStatementNode + | FunctionDeclarationStatementNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DecoratorArgumentValue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DecoratorArgumentValue.md new file mode 100644 index 0000000000..08ae00dea0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DecoratorArgumentValue.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] DecoratorArgumentValue" + +--- +```ts +type DecoratorArgumentValue: Type | number | string | boolean; +``` + +Type System types diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticFormat.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticFormat.md new file mode 100644 index 0000000000..a8cda9bcb2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticFormat.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[T] DiagnosticFormat" + +--- +```ts +type DiagnosticFormat: T[C][M] extends CallableMessage ? object : Record; +``` + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `C` extends keyof `T` | - | +| `M` extends keyof `T`[`C`] | `"default"` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticHandler.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticHandler.md new file mode 100644 index 0000000000..08aa8b590d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticHandler.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] DiagnosticHandler" + +--- +```ts +type DiagnosticHandler: (diagnostic) => void; +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `diagnostic` | [`Diagnostic`](../interfaces/Diagnostic.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticMap.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticMap.md new file mode 100644 index 0000000000..914e233943 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticMap.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] DiagnosticMap" + +--- +```ts +type DiagnosticMap: { readonly [code in keyof T]: DiagnosticDefinition }; +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends `object` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticReport.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticReport.md new file mode 100644 index 0000000000..4a3471badc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticReport.md @@ -0,0 +1,22 @@ +--- +jsApi: true +title: "[T] DiagnosticReport" + +--- +```ts +type DiagnosticReport: DiagnosticReportWithoutTarget & object; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `target` | [`DiagnosticTarget`](DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | - | + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `C` extends keyof `T` | - | +| `M` extends keyof `T`[`C`] | `"default"` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticReportWithoutTarget.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticReportWithoutTarget.md new file mode 100644 index 0000000000..5f28ab15e6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticReportWithoutTarget.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[T] DiagnosticReportWithoutTarget" + +--- +```ts +type DiagnosticReportWithoutTarget: object & DiagnosticFormat; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `code` | `C` | - | +| `messageId` | `M` | - | + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends `object` | - | +| `C` extends keyof `T` | - | +| `M` extends keyof `T`[`C`] | `"default"` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticResult.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticResult.md new file mode 100644 index 0000000000..9f7bc17eeb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticResult.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[T] DiagnosticResult" + +--- +```ts +type DiagnosticResult: [T, readonly Diagnostic[]]; +``` + +Return type of accessor functions in TypeSpec. +Tuple composed of: +- 0: Actual result of an accessor function +- 1: List of diagnostics that were emitted while retrieving the data. + +## Type parameters + +| Parameter | +| :------ | +| `T` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticSeverity.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticSeverity.md new file mode 100644 index 0000000000..cb099c51c1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticSeverity.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DiagnosticSeverity" + +--- +```ts +type DiagnosticSeverity: "error" | "warning"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticTarget.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticTarget.md new file mode 100644 index 0000000000..186c4100a7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DiagnosticTarget.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DiagnosticTarget" + +--- +```ts +type DiagnosticTarget: TypeSpecDiagnosticTarget | SourceLocation; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Directive.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Directive.md new file mode 100644 index 0000000000..b60793174b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Directive.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] Directive" + +--- +```ts +type Directive: SuppressDirective | DeprecatedDirective; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DirectiveArgument.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DirectiveArgument.md new file mode 100644 index 0000000000..229b21308c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DirectiveArgument.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DirectiveArgument" + +--- +```ts +type DirectiveArgument: StringLiteralNode | IdentifierNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DocContent.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DocContent.md new file mode 100644 index 0000000000..2feb91bacc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DocContent.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DocContent" + +--- +```ts +type DocContent: DocTextNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DocTag.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DocTag.md new file mode 100644 index 0000000000..63dab4fe8f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DocTag.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[T] DocTag" + +--- +```ts +type DocTag: + | DocReturnsTagNode + | DocErrorsTagNode + | DocParamTagNode + | DocTemplateTagNode + | DocUnknownTagNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DocToken.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DocToken.md new file mode 100644 index 0000000000..2c143a86cf --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DocToken.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[T] DocToken" + +--- +```ts +type DocToken: + | Token.NewLine + | Token.Whitespace + | Token.ConflictMarker + | Token.Star + | Token.At + | Token.CloseBrace + | Token.Identifier + | Token.Hyphen + | Token.DocText + | Token.DocCodeSpan + | Token.DocCodeFenceDelimiter + | Token.EndOfFile; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DurationKnownEncoding.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DurationKnownEncoding.md new file mode 100644 index 0000000000..e40ff8e007 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/DurationKnownEncoding.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] DurationKnownEncoding" + +--- +```ts +type DurationKnownEncoding: "ISO8601" | "seconds"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/EmitOptionsFor.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/EmitOptionsFor.md new file mode 100644 index 0000000000..50a0c41d5a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/EmitOptionsFor.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[T] EmitOptionsFor" + +--- +```ts +type EmitOptionsFor: C extends TypeSpecLibrary ? E : never; +``` + +Get the options for the onEmit of this library. + +## Type parameters + +| Parameter | +| :------ | +| `C` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/EmitterFunc.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/EmitterFunc.md new file mode 100644 index 0000000000..1c75463e4e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/EmitterFunc.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] EmitterFunc" + +--- +```ts +type EmitterFunc: (context) => Promise | void; +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | [`EmitContext`](../interfaces/EmitContext.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Expression.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Expression.md new file mode 100644 index 0000000000..eb40abc01e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Expression.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[T] Expression" + +--- +```ts +type Expression: + | ArrayExpressionNode + | MemberExpressionNode + | ModelExpressionNode + | TupleExpressionNode + | UnionExpressionNode + | IntersectionExpressionNode + | TypeReferenceNode + | ValueOfExpressionNode + | IdentifierNode + | StringLiteralNode + | NumericLiteralNode + | BooleanLiteralNode + | VoidKeywordNode + | NeverKeywordNode + | AnyKeywordNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/InferredCadlValue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/InferredCadlValue.md new file mode 100644 index 0000000000..da265fb262 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/InferredCadlValue.md @@ -0,0 +1,18 @@ +--- +jsApi: true +title: "[T] InferredCadlValue" + +--- +```ts +type InferredCadlValue: InferredTypeSpecValue; +``` + +## Deprecated + +Use InferredTypeSpecValue + +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](TypeKind.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/InferredTypeSpecValue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/InferredTypeSpecValue.md new file mode 100644 index 0000000000..3f5fdccbed --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/InferredTypeSpecValue.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] InferredTypeSpecValue" + +--- +```ts +type InferredTypeSpecValue: K extends "Any" ? TypeSpecValue : K extends infer T[] ? InferredTypeSpecValue : K extends "String" ? string : K extends "Number" ? number : K extends "Boolean" ? boolean : Type & object; +``` + +## Type parameters + +| Parameter | +| :------ | +| `K` extends [`TypeKind`](TypeKind.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/IntrinsicScalarName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/IntrinsicScalarName.md new file mode 100644 index 0000000000..46387c05fd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/IntrinsicScalarName.md @@ -0,0 +1,33 @@ +--- +jsApi: true +title: "[T] IntrinsicScalarName" + +--- +```ts +type IntrinsicScalarName: + | "bytes" + | "numeric" + | "integer" + | "float" + | "int64" + | "int32" + | "int16" + | "int8" + | "uint64" + | "uint32" + | "uint16" + | "uint8" + | "safeint" + | "float32" + | "float64" + | "decimal" + | "decimal128" + | "string" + | "plainDate" + | "plainTime" + | "utcDateTime" + | "offsetDateTime" + | "duration" + | "boolean" + | "url"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/JSONSchemaType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/JSONSchemaType.md new file mode 100644 index 0000000000..d1ede8cc96 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/JSONSchemaType.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] JSONSchemaType" + +--- +```ts +type JSONSchemaType: AjvJSONSchemaType; +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LibraryMetadata.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LibraryMetadata.md new file mode 100644 index 0000000000..e0887bf732 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LibraryMetadata.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] LibraryMetadata" + +--- +```ts +type LibraryMetadata: FileLibraryMetadata | ModuleLibraryMetadata; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticFormat.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticFormat.md new file mode 100644 index 0000000000..2c6d055a69 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticFormat.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] LinterRuleDiagnosticFormat" + +--- +```ts +type LinterRuleDiagnosticFormat: T[M] extends CallableMessage ? object : Record; +``` + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends [`DiagnosticMessages`](../interfaces/DiagnosticMessages.md) | - | +| `M` extends keyof `T` | `"default"` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReport.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReport.md new file mode 100644 index 0000000000..6dcef34271 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReport.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[T] LinterRuleDiagnosticReport" + +--- +```ts +type LinterRuleDiagnosticReport: LinterRuleDiagnosticReportWithoutTarget & object; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `target` | [`DiagnosticTarget`](DiagnosticTarget.md) \| *typeof* [`NoTarget`](../variables/NoTarget.md) | - | + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends [`DiagnosticMessages`](../interfaces/DiagnosticMessages.md) | - | +| `M` extends keyof `T` | `"default"` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReportWithoutTarget.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReportWithoutTarget.md new file mode 100644 index 0000000000..4b5c72a898 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LinterRuleDiagnosticReportWithoutTarget.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[T] LinterRuleDiagnosticReportWithoutTarget" + +--- +```ts +type LinterRuleDiagnosticReportWithoutTarget: object & LinterRuleDiagnosticFormat; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `messageId` | `M` | - | + +## Type parameters + +| Parameter | Default | +| :------ | :------ | +| `T` extends [`DiagnosticMessages`](../interfaces/DiagnosticMessages.md) | - | +| `M` extends keyof `T` | `"default"` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LiteralNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LiteralNode.md new file mode 100644 index 0000000000..d140813d91 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LiteralNode.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] LiteralNode" + +--- +```ts +type LiteralNode: StringLiteralNode | NumericLiteralNode | BooleanLiteralNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LiteralType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LiteralType.md new file mode 100644 index 0000000000..0418cc26d6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LiteralType.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] LiteralType" + +--- +```ts +type LiteralType: StringLiteral | NumericLiteral | BooleanLiteral; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LocationContext.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LocationContext.md new file mode 100644 index 0000000000..0b64651ee9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LocationContext.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] LocationContext" + +--- +```ts +type LocationContext: ProjectLocationContext | CompilerLocationContext | SyntheticLocationContext | LibraryLocationContext; +``` + +Represent a location context in the mind of the compiler. This can be: +- the user project +- a library +- the compiler(standard library) +- virtual diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LogLevel.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LogLevel.md new file mode 100644 index 0000000000..d7add61d1e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/LogLevel.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] LogLevel" + +--- +```ts +type LogLevel: "trace" | "warning" | "error"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MarshalledValue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MarshalledValue.md new file mode 100644 index 0000000000..899b184703 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MarshalledValue.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] MarshalledValue" + +--- +```ts +type MarshalledValue: Type extends StringLiteral ? string : Type extends NumericLiteral ? number : Type extends BooleanLiteral ? boolean : Type; +``` + +## Type parameters + +| Parameter | +| :------ | +| `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberContainerNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberContainerNode.md new file mode 100644 index 0000000000..a2e623dab8 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberContainerNode.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] MemberContainerNode" + +--- +```ts +type MemberContainerNode: + | ModelStatementNode + | ModelExpressionNode + | InterfaceStatementNode + | EnumStatementNode + | UnionStatementNode; +``` + +Node types that can have referencable members diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberContainerType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberContainerType.md new file mode 100644 index 0000000000..f91bcc9915 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberContainerType.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] MemberContainerType" + +--- +```ts +type MemberContainerType: Model | Enum | Interface | Union; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberNode.md new file mode 100644 index 0000000000..c43ba0af08 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberNode.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] MemberNode" + +--- +```ts +type MemberNode: ModelPropertyNode | EnumMemberNode | OperationStatementNode | UnionVariantNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberType.md new file mode 100644 index 0000000000..80140f981e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/MemberType.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] MemberType" + +--- +```ts +type MemberType: ModelProperty | EnumMember | Operation | UnionVariant; +``` + +Type that can be used as members of a container type. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ModelIndexer.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ModelIndexer.md new file mode 100644 index 0000000000..e979ed290e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ModelIndexer.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] ModelIndexer" + +--- +```ts +type ModelIndexer: object; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `key` | [`Scalar`](../interfaces/Scalar.md) | - | +| `value` | [`Type`](Type.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Modifier.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Modifier.md new file mode 100644 index 0000000000..19ff00dcc4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Modifier.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] Modifier" + +--- +```ts +type Modifier: ExternKeywordNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ModuleResolutionResult.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ModuleResolutionResult.md new file mode 100644 index 0000000000..a38c9ee663 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ModuleResolutionResult.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] ModuleResolutionResult" + +--- +```ts +type ModuleResolutionResult: ResolvedFile | ResolvedModule; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/NeverIndexer.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/NeverIndexer.md new file mode 100644 index 0000000000..49d9389265 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/NeverIndexer.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] NeverIndexer" + +--- +```ts +type NeverIndexer: object; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `key` | [`NeverType`](../interfaces/NeverType.md) | - | +| `value` | `undefined` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/NewLine.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/NewLine.md new file mode 100644 index 0000000000..9a00fe40cd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/NewLine.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] NewLine" + +--- +```ts +type NewLine: "lf" | "crlf"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Node.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Node.md new file mode 100644 index 0000000000..82d14b0673 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Node.md @@ -0,0 +1,45 @@ +--- +jsApi: true +title: "[T] Node" + +--- +```ts +type Node: + | TypeSpecScriptNode + | JsSourceFileNode + | JsNamespaceDeclarationNode + | TemplateParameterDeclarationNode + | ProjectionParameterDeclarationNode + | ProjectionLambdaParameterDeclarationNode + | ModelPropertyNode + | UnionVariantNode + | OperationStatementNode + | OperationSignatureDeclarationNode + | OperationSignatureReferenceNode + | EnumMemberNode + | EnumSpreadMemberNode + | ModelSpreadPropertyNode + | DecoratorExpressionNode + | DirectiveExpressionNode + | Statement + | Expression + | FunctionParameterNode + | Modifier + | DocNode + | DocContent + | DocTag + | ProjectionStatementItem + | ProjectionExpression + | ProjectionModelSelectorNode + | ProjectionModelPropertySelectorNode + | ProjectionInterfaceSelectorNode + | ProjectionOperationSelectorNode + | ProjectionEnumSelectorNode + | ProjectionEnumMemberSelectorNode + | ProjectionUnionSelectorNode + | ProjectionUnionVariantSelectorNode + | ProjectionModelPropertyNode + | ProjectionModelSpreadPropertyNode + | ProjectionStatementNode + | ProjectionNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/NodeCallback.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/NodeCallback.md new file mode 100644 index 0000000000..d3ed4a633a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/NodeCallback.md @@ -0,0 +1,20 @@ +--- +jsApi: true +title: "[T] NodeCallback" + +--- +```ts +type NodeCallback: (c) => T; +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` | + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `c` | [`Node`](Node.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/OperationContainer.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/OperationContainer.md new file mode 100644 index 0000000000..67ffa61aa0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/OperationContainer.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] OperationContainer" + +--- +```ts +type OperationContainer: Namespace | Interface | Operation; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/OperationSignature.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/OperationSignature.md new file mode 100644 index 0000000000..f6bcceb7ea --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/OperationSignature.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] OperationSignature" + +--- +```ts +type OperationSignature: OperationSignatureDeclarationNode | OperationSignatureReferenceNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ProjectionExpression.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ProjectionExpression.md new file mode 100644 index 0000000000..6ed8c1e44e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ProjectionExpression.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[T] ProjectionExpression" + +--- +```ts +type ProjectionExpression: + | ProjectionLogicalExpressionNode + | ProjectionRelationalExpressionNode + | ProjectionEqualityExpressionNode + | ProjectionUnaryExpressionNode + | ProjectionArithmeticExpressionNode + | ProjectionCallExpressionNode + | ProjectionMemberExpressionNode + | ProjectionDecoratorReferenceExpressionNode + | ProjectionTupleExpressionNode + | ProjectionModelExpressionNode + | ProjectionIfExpressionNode + | ProjectionBlockExpressionNode + | ProjectionLambdaExpressionNode + | StringLiteralNode + | NumericLiteralNode + | BooleanLiteralNode + | IdentifierNode + | VoidKeywordNode + | NeverKeywordNode + | AnyKeywordNode + | ReturnExpressionNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ProjectionStatementItem.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ProjectionStatementItem.md new file mode 100644 index 0000000000..79861ce4f5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ProjectionStatementItem.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] ProjectionStatementItem" + +--- +```ts +type ProjectionStatementItem: ProjectionExpressionStatementNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ReferenceExpression.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ReferenceExpression.md new file mode 100644 index 0000000000..a255a58230 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ReferenceExpression.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[T] ReferenceExpression" + +--- +```ts +type ReferenceExpression: + | TypeReferenceNode + | MemberExpressionNode + | IdentifierNode + | VoidKeywordNode + | NeverKeywordNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/RuleRef.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/RuleRef.md new file mode 100644 index 0000000000..35404a94e3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/RuleRef.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] RuleRef" + +--- +```ts +type RuleRef: \${string}/${string}\; +``` + +Reference to a rule. In this format `:` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ScopeNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ScopeNode.md new file mode 100644 index 0000000000..9572988303 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/ScopeNode.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[T] ScopeNode" + +--- +```ts +type ScopeNode: + | NamespaceStatementNode + | ModelStatementNode + | InterfaceStatementNode + | AliasStatementNode + | TypeSpecScriptNode + | JsSourceFileNode + | ProjectionLambdaExpressionNode + | ProjectionNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/SemanticNodeListener.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/SemanticNodeListener.md new file mode 100644 index 0000000000..2a762c98f0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/SemanticNodeListener.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] SemanticNodeListener" + +--- +```ts +type SemanticNodeListener: object & TypeListeners; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `root` | (`context`) => `void` \| `undefined` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/SourceFileKind.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/SourceFileKind.md new file mode 100644 index 0000000000..f487dbb863 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/SourceFileKind.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] SourceFileKind" + +--- +```ts +type SourceFileKind: "typespec" | "js"; +``` + +Type of the source file that can be loaded via typespec diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Statement.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Statement.md new file mode 100644 index 0000000000..7ced5c24fe --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Statement.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[T] Statement" + +--- +```ts +type Statement: + | ImportStatementNode + | ModelStatementNode + | ScalarStatementNode + | NamespaceStatementNode + | InterfaceStatementNode + | UnionStatementNode + | UsingStatementNode + | EnumStatementNode + | AliasStatementNode + | OperationStatementNode + | DecoratorDeclarationStatementNode + | FunctionDeclarationStatementNode + | AugmentDecoratorStatementNode + | EmptyStatementNode + | InvalidStatementNode + | ProjectionStatementNode; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/StdTypeName.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/StdTypeName.md new file mode 100644 index 0000000000..34bdd549ab --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/StdTypeName.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] StdTypeName" + +--- +```ts +type StdTypeName: keyof StdTypes; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/StdTypes.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/StdTypes.md new file mode 100644 index 0000000000..be0108f4eb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/StdTypes.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] StdTypes" + +--- +```ts +type StdTypes: object & Record; +``` + +## Type declaration + +| Member | Type | Description | +| :------ | :------ | :------ | +| `Array` | [`Model`](../interfaces/Model.md) | - | +| `Record` | [`Model`](../interfaces/Model.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TemplateableNode.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TemplateableNode.md new file mode 100644 index 0000000000..238c8df672 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TemplateableNode.md @@ -0,0 +1,16 @@ +--- +jsApi: true +title: "[T] TemplateableNode" + +--- +```ts +type TemplateableNode: + | ModelStatementNode + | ScalarStatementNode + | AliasStatementNode + | InterfaceStatementNode + | OperationStatementNode + | UnionStatementNode; +``` + +Node that can be used as template diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TemplatedType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TemplatedType.md new file mode 100644 index 0000000000..bdd12a15b4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TemplatedType.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] TemplatedType" + +--- +```ts +type TemplatedType: Model | Operation | Interface | Union; +``` + +Union of all the types that implement TemplatedTypeBase diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TrackableType.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TrackableType.md new file mode 100644 index 0000000000..2d33af62e6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TrackableType.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] TrackableType" + +--- +```ts +type TrackableType: Model | Enum | Union | Tuple; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Type.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Type.md new file mode 100644 index 0000000000..7a0d78772b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/Type.md @@ -0,0 +1,29 @@ +--- +jsApi: true +title: "[T] Type" + +--- +```ts +type Type: + | Model + | ModelProperty + | Scalar + | Interface + | Enum + | EnumMember + | TemplateParameter + | Namespace + | Operation + | StringLiteral + | NumericLiteral + | BooleanLiteral + | Tuple + | Union + | UnionVariant + | IntrinsicType + | FunctionType + | Decorator + | FunctionParameter + | ObjectType + | Projection; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeKind.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeKind.md new file mode 100644 index 0000000000..47f3dbd39e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeKind.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] TypeKind" + +--- +```ts +type TypeKind: Type["kind"] | "Any"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeListeners.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeListeners.md new file mode 100644 index 0000000000..48751a2117 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeListeners.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] TypeListeners" + +--- +```ts +type TypeListeners: UnionToIntersection>; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeOfDiagnostics.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeOfDiagnostics.md new file mode 100644 index 0000000000..60f8ed84bc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeOfDiagnostics.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] TypeOfDiagnostics" + +--- +```ts +type TypeOfDiagnostics: T extends DiagnosticMap ? D : never; +``` + +## Type parameters + +| Parameter | +| :------ | +| `T` extends [`DiagnosticMap`](DiagnosticMap.md)<`any`\> | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeOrReturnRecord.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeOrReturnRecord.md new file mode 100644 index 0000000000..77849b7f48 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeOrReturnRecord.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] TypeOrReturnRecord" + +--- +```ts +type TypeOrReturnRecord: Type | ReturnRecord; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeSpecDiagnosticTarget.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeSpecDiagnosticTarget.md new file mode 100644 index 0000000000..d33434f295 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeSpecDiagnosticTarget.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[T] TypeSpecDiagnosticTarget" + +--- +```ts +type TypeSpecDiagnosticTarget: Node | Type | Sym; +``` + +Diagnostic target that can be used when working with TypeSpec types. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeSpecValue.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeSpecValue.md new file mode 100644 index 0000000000..09800df195 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/TypeSpecValue.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[T] TypeSpecValue" + +--- +```ts +type TypeSpecValue: Type | string | number | boolean; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/WriteLine.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/WriteLine.md new file mode 100644 index 0000000000..359c880693 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/type-aliases/WriteLine.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[T] WriteLine" + +--- +```ts +type WriteLine: (text?) => void; +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `text`? | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/CadlPrettierPlugin.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/CadlPrettierPlugin.md new file mode 100644 index 0000000000..56a2802bcd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/CadlPrettierPlugin.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[V] CadlPrettierPlugin" + +--- +```ts +const CadlPrettierPlugin: __module = TypeSpecPrettierPlugin; +``` + +## Deprecated + +Use TypeSpecPrettierPlugin diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/MANIFEST.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/MANIFEST.md new file mode 100644 index 0000000000..66e2bed0a2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/MANIFEST.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] MANIFEST" + +--- +```ts +const MANIFEST: TypeSpecManifest = manifest; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/NoTarget.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/NoTarget.md new file mode 100644 index 0000000000..bdfc6f2016 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/NoTarget.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[V] NoTarget" + +--- +```ts +const NoTarget: *typeof* NoTarget; +``` + +Used to explicitly specify that a diagnostic has no target. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/NodeHost.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/NodeHost.md new file mode 100644 index 0000000000..7c3a174ffc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/NodeHost.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[V] NodeHost" + +--- +```ts +const NodeHost: CompilerHost; +``` + +Implementation of the + +## See + +CompilerHost using the real file system. +This is the the CompilerHost used by TypeSpec CLI. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/TypeSpecPrettierPlugin.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/TypeSpecPrettierPlugin.md new file mode 100644 index 0000000000..141b137e60 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/TypeSpecPrettierPlugin.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] TypeSpecPrettierPlugin" + +--- +```ts +const TypeSpecPrettierPlugin: __module = formatter; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/altDirectorySeparator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/altDirectorySeparator.md new file mode 100644 index 0000000000..07ee28a1cb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/altDirectorySeparator.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] altDirectorySeparator" + +--- +```ts +const altDirectorySeparator: "\\" = "\\"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/cadlVersion.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/cadlVersion.md new file mode 100644 index 0000000000..f72ab444e2 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/cadlVersion.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[V] cadlVersion" + +--- +```ts +const cadlVersion: any = typespecVersion; +``` + +## Deprecated + +Use typespecVersion diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/directorySeparator.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/directorySeparator.md new file mode 100644 index 0000000000..52fa3817c9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/directorySeparator.md @@ -0,0 +1,12 @@ +--- +jsApi: true +title: "[V] directorySeparator" + +--- +```ts +const directorySeparator: "/" = "/"; +``` + +Internally, we represent paths as strings with '/' as the directory separator. +When we make system calls (eg: LanguageServiceHost.getDirectory()), +we expect the host to correctly handle paths in our specified format. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..4868929ecc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec" = "TypeSpec"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/typespecVersion.md b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/typespecVersion.md new file mode 100644 index 0000000000..3039c72099 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/reference/js-api/variables/typespecVersion.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] typespecVersion" + +--- +```ts +const typespecVersion: any = manifest.version; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/cheat-sheet.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/cheat-sheet.md new file mode 100644 index 0000000000..6640604aee --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/cheat-sheet.md @@ -0,0 +1,12 @@ +--- +title: Cheat sheet +--- + +## Resource Routing + +_Details: [Resource Routing](./resource-routing.md)_ + +| Feature | Example | Resolved Route | +| ------------------------ | ----------------------------------------------------------------------------------- | -------------- | +| Auto route | `@autoRoute op get(@segment("pets") @path id: string): void` | `/pets/{id}` | +| Custom segment seperator | `@autoRoute op get(@segment("pets") @path @segmentSeparator(":") id: string): void` | `:pets/{id}` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/data-types.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/data-types.md new file mode 100644 index 0000000000..5db8bbc42d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/data-types.md @@ -0,0 +1,149 @@ +--- +title: "Data types" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Data types + +## TypeSpec.Rest + +### `ResourceLocation` {#TypeSpec.Rest.ResourceLocation} + +A URL that points to a resource. + +```typespec +scalar TypeSpec.Rest.ResourceLocation +``` + +## TypeSpec.Rest.Resource + +### `CollectionWithNextLink` {#TypeSpec.Rest.Resource.CollectionWithNextLink} + +Structure for a paging response using `value` and `nextLink` to represent pagination. +This only provides the model structure and not actual pagination support. +See https://github.com/microsoft/typespec/issues/705 for general paging support. + +```typespec +model TypeSpec.Rest.Resource.CollectionWithNextLink +``` + +#### Template Parameters + +| Name | Description | +| ---- | ------------------------------------ | +| T | The resource type of the collection. | + +### `KeysOf` {#TypeSpec.Rest.Resource.KeysOf} + +Dynamically gathers keys of the model type T. + +```typespec +model TypeSpec.Rest.Resource.KeysOf +``` + +#### Template Parameters + +| Name | Description | +| ---- | ----------------- | +| T | The target model. | + +### `ParentKeysOf` {#TypeSpec.Rest.Resource.ParentKeysOf} + +Dynamically gathers parent keys of the model type T. + +```typespec +model TypeSpec.Rest.Resource.ParentKeysOf +``` + +#### Template Parameters + +| Name | Description | +| ---- | ----------------- | +| T | The target model. | + +### `ResourceCollectionParameters` {#TypeSpec.Rest.Resource.ResourceCollectionParameters} + +Represents collection operation parameters for resource TResource. + +```typespec +model TypeSpec.Rest.Resource.ResourceCollectionParameters +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | + +### `ResourceCreatedResponse` {#TypeSpec.Rest.Resource.ResourceCreatedResponse} + +Resource create operation completed successfully. + +```typespec +model TypeSpec.Rest.Resource.ResourceCreatedResponse +``` + +#### Template Parameters + +| Name | Description | +| ---- | ------------------------------------ | +| T | The resource model that was created. | + +### `ResourceCreateModel` {#TypeSpec.Rest.Resource.ResourceCreateModel} + +Resource create operation model. + +```typespec +model TypeSpec.Rest.Resource.ResourceCreateModel +``` + +#### Template Parameters + +| Name | Description | +| --------- | ----------------------------- | +| TResource | The resource model to create. | + +### `ResourceCreateOrUpdateModel` {#TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel} + +Resource create or update operation model. + +```typespec +model TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel +``` + +#### Template Parameters + +| Name | Description | +| --------- | --------------------------------------- | +| TResource | The resource model to create or update. | + +### `ResourceDeletedResponse` {#TypeSpec.Rest.Resource.ResourceDeletedResponse} + +Resource deleted successfully. + +```typespec +model TypeSpec.Rest.Resource.ResourceDeletedResponse +``` + +### `ResourceError` {#TypeSpec.Rest.Resource.ResourceError} + +The default error response for resource operations. + +```typespec +model TypeSpec.Rest.Resource.ResourceError +``` + +### `ResourceParameters` {#TypeSpec.Rest.Resource.ResourceParameters} + +Represents operation parameters for resource TResource. + +```typespec +model TypeSpec.Rest.Resource.ResourceParameters +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/decorators.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/decorators.md new file mode 100644 index 0000000000..5163353f55 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/decorators.md @@ -0,0 +1,307 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.Rest + +### `@action` {#@TypeSpec.Rest.action} + +Specify this operation is an action. (Scoped to a resource item /pets/{petId}/my-action) + +```typespec +@TypeSpec.Rest.action(name?: valueof string) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ---- | ----------------------- | ----------------------------------------------------------------------------- | +| name | `valueof scalar string` | Name of the action. If not specified, the name of the operation will be used. | + +### `@actionSeparator` {#@TypeSpec.Rest.actionSeparator} + +Defines the separator string that is inserted before the action name in auto-generated routes for actions. + +```typespec +@TypeSpec.Rest.actionSeparator(seperator: valueof / | : | /:) +``` + +#### Target + +`union Model | ModelProperty | Operation` + +#### Parameters + +| Name | Type | Description | +| --------- | ---------------------------- | ---------------------------------------------------------------- | +| seperator | `valueof union / \| : \| /:` | Seperator seperating the action segment from the rest of the url | + +### `@autoRoute` {#@TypeSpec.Rest.autoRoute} + +This interface or operation should resolve its route automatically. To be used with resource types where the route segments area defined on the models. + +```typespec +@TypeSpec.Rest.autoRoute +``` + +#### Target + +`union Interface | Operation` + +#### Parameters + +None + +#### Examples + +```typespec +@autoRoute +interface Pets { + get(@segment("pets") @path id: string): void; //-> route: /pets/{id} +} +``` + +### `@collectionAction` {#@TypeSpec.Rest.collectionAction} + +Specify this operation is a collection action. (Scopped to a resource, /pets/my-action) + +```typespec +@TypeSpec.Rest.collectionAction(resourceType: Model, name?: valueof string) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ----------------------- | ----------------------------------------------------------------------------- | +| resourceType | `Model` | Resource marked with | +| name | `valueof scalar string` | Name of the action. If not specified, the name of the operation will be used. | + +### `@copyResourceKeyParameters` {#@TypeSpec.Rest.copyResourceKeyParameters} + +Copy the resource key parameters on the model + +```typespec +@TypeSpec.Rest.copyResourceKeyParameters(filter?: valueof string) +``` + +#### Target + +`Model` + +#### Parameters + +| Name | Type | Description | +| ------ | ----------------------- | ------------------------------------- | +| filter | `valueof scalar string` | Filter to exclude certain properties. | + +### `@createsOrReplacesResource` {#@TypeSpec.Rest.createsOrReplacesResource} + +Specify that this is a CreateOrReplace operation for a given resource. + +```typespec +@TypeSpec.Rest.createsOrReplacesResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@createsOrUpdatesResource` {#@TypeSpec.Rest.createsOrUpdatesResource} + +Specify that this is a CreatesOrUpdate operation for a given resource. + +```typespec +@TypeSpec.Rest.createsOrUpdatesResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@createsResource` {#@TypeSpec.Rest.createsResource} + +Specify that this is a Create operation for a given resource. + +```typespec +@TypeSpec.Rest.createsResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@deletesResource` {#@TypeSpec.Rest.deletesResource} + +Specify that this is a Delete operation for a given resource. + +```typespec +@TypeSpec.Rest.deletesResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@listsResource` {#@TypeSpec.Rest.listsResource} + +Specify that this is a List operation for a given resource. + +```typespec +@TypeSpec.Rest.listsResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@parentResource` {#@TypeSpec.Rest.parentResource} + +Mark model as a child of the given parent resource. + +```typespec +@TypeSpec.Rest.parentResource(parent: Model) +``` + +#### Target + +`Model` + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------- | +| parent | `Model` | Parent model. | + +### `@readsResource` {#@TypeSpec.Rest.readsResource} + +Specify that this is a Read operation for a given resource. + +```typespec +@TypeSpec.Rest.readsResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | + +### `@resource` {#@TypeSpec.Rest.resource} + +Mark this model as a resource type with a name. + +```typespec +@TypeSpec.Rest.resource(collectionName: valueof string) +``` + +#### Target + +`Model` + +#### Parameters + +| Name | Type | Description | +| -------------- | ----------------------- | ---------------------- | +| collectionName | `valueof scalar string` | type's collection name | + +### `@segment` {#@TypeSpec.Rest.segment} + +Defines the preceding path segment for a + +```typespec +@TypeSpec.Rest.segment(name: valueof string) +``` + +#### Target + +`union Model | ModelProperty | Operation` + +#### Parameters + +| Name | Type | Description | +| ---- | ----------------------- | ---------------------------------------------------------------------------------------------- | +| name | `valueof scalar string` | Segment that will be inserted into the operation route before the path parameter's name field. | + +#### Examples + +### `@segmentOf` {#@TypeSpec.Rest.segmentOf} + +Returns the URL segment of a given model if it has `@segment` and `@key` decorator. + +```typespec +@TypeSpec.Rest.segmentOf(type: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ------------ | +| type | `Model` | Target model | + +### `@updatesResource` {#@TypeSpec.Rest.updatesResource} + +Specify that this is a Update operation for a given resource. + +```typespec +@TypeSpec.Rest.updatesResource(resourceType: Model) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------- | +| resourceType | `Model` | Resource marked with | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/index.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/index.md new file mode 100644 index 0000000000..158097c6d3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/index.md @@ -0,0 +1,93 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec REST protocol binding + +## Install + + + + +```bash +npm install @typespec/rest +``` + + + + +```bash +npm install --save-peer @typespec/rest +``` + + + + +## TypeSpec.Rest + +### Decorators + +- [`@action`](./decorators.md#@TypeSpec.Rest.action) +- [`@actionSeparator`](./decorators.md#@TypeSpec.Rest.actionSeparator) +- [`@autoRoute`](./decorators.md#@TypeSpec.Rest.autoRoute) +- [`@collectionAction`](./decorators.md#@TypeSpec.Rest.collectionAction) +- [`@copyResourceKeyParameters`](./decorators.md#@TypeSpec.Rest.copyResourceKeyParameters) +- [`@createsOrReplacesResource`](./decorators.md#@TypeSpec.Rest.createsOrReplacesResource) +- [`@createsOrUpdatesResource`](./decorators.md#@TypeSpec.Rest.createsOrUpdatesResource) +- [`@createsResource`](./decorators.md#@TypeSpec.Rest.createsResource) +- [`@deletesResource`](./decorators.md#@TypeSpec.Rest.deletesResource) +- [`@listsResource`](./decorators.md#@TypeSpec.Rest.listsResource) +- [`@parentResource`](./decorators.md#@TypeSpec.Rest.parentResource) +- [`@readsResource`](./decorators.md#@TypeSpec.Rest.readsResource) +- [`@resource`](./decorators.md#@TypeSpec.Rest.resource) +- [`@segment`](./decorators.md#@TypeSpec.Rest.segment) +- [`@segmentOf`](./decorators.md#@TypeSpec.Rest.segmentOf) +- [`@updatesResource`](./decorators.md#@TypeSpec.Rest.updatesResource) + +## TypeSpec.Rest.Resource + +### Interfaces + +- [`ExtensionResourceCollectionOperations`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations) +- [`ExtensionResourceCreate`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceCreate) +- [`ExtensionResourceCreateOrUpdate`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceCreateOrUpdate) +- [`ExtensionResourceDelete`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceDelete) +- [`ExtensionResourceInstanceOperations`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations) +- [`ExtensionResourceList`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceList) +- [`ExtensionResourceOperations`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceOperations) +- [`ExtensionResourceRead`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceRead) +- [`ExtensionResourceUpdate`](./interfaces.md#TypeSpec.Rest.Resource.ExtensionResourceUpdate) +- [`ResourceCollectionOperations`](./interfaces.md#TypeSpec.Rest.Resource.ResourceCollectionOperations) +- [`ResourceCreate`](./interfaces.md#TypeSpec.Rest.Resource.ResourceCreate) +- [`ResourceCreateOrReplace`](./interfaces.md#TypeSpec.Rest.Resource.ResourceCreateOrReplace) +- [`ResourceCreateOrUpdate`](./interfaces.md#TypeSpec.Rest.Resource.ResourceCreateOrUpdate) +- [`ResourceDelete`](./interfaces.md#TypeSpec.Rest.Resource.ResourceDelete) +- [`ResourceInstanceOperations`](./interfaces.md#TypeSpec.Rest.Resource.ResourceInstanceOperations) +- [`ResourceList`](./interfaces.md#TypeSpec.Rest.Resource.ResourceList) +- [`ResourceOperations`](./interfaces.md#TypeSpec.Rest.Resource.ResourceOperations) +- [`ResourceRead`](./interfaces.md#TypeSpec.Rest.Resource.ResourceRead) +- [`ResourceUpdate`](./interfaces.md#TypeSpec.Rest.Resource.ResourceUpdate) +- [`SingletonResourceOperations`](./interfaces.md#TypeSpec.Rest.Resource.SingletonResourceOperations) +- [`SingletonResourceRead`](./interfaces.md#TypeSpec.Rest.Resource.SingletonResourceRead) +- [`SingletonResourceUpdate`](./interfaces.md#TypeSpec.Rest.Resource.SingletonResourceUpdate) + +### Models + +- [`CollectionWithNextLink`](./data-types.md#TypeSpec.Rest.Resource.CollectionWithNextLink) +- [`KeysOf`](./data-types.md#TypeSpec.Rest.Resource.KeysOf) +- [`ParentKeysOf`](./data-types.md#TypeSpec.Rest.Resource.ParentKeysOf) +- [`ResourceCollectionParameters`](./data-types.md#TypeSpec.Rest.Resource.ResourceCollectionParameters) +- [`ResourceCreatedResponse`](./data-types.md#TypeSpec.Rest.Resource.ResourceCreatedResponse) +- [`ResourceCreateModel`](./data-types.md#TypeSpec.Rest.Resource.ResourceCreateModel) +- [`ResourceCreateOrUpdateModel`](./data-types.md#TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel) +- [`ResourceDeletedResponse`](./data-types.md#TypeSpec.Rest.Resource.ResourceDeletedResponse) +- [`ResourceError`](./data-types.md#TypeSpec.Rest.Resource.ResourceError) +- [`ResourceParameters`](./data-types.md#TypeSpec.Rest.Resource.ResourceParameters) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/interfaces.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/interfaces.md new file mode 100644 index 0000000000..ba064c720b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/interfaces.md @@ -0,0 +1,647 @@ +--- +title: "Interfaces and Operations" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Interfaces and Operations + +## TypeSpec.Rest.Resource + +### `ExtensionResourceCollectionOperations` {#TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations} + +Extension resource operation templates for extension resource collections. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceCollectionOperations.create` {#TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.create} + +Creates a new instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TExtension | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +#### `ExtensionResourceCollectionOperations.list` {#TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.list} + +Lists all instances of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceCollectionOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ExtensionResourceCreate` {#TypeSpec.Rest.Resource.ExtensionResourceCreate} + +Extension resource create operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceCreate +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceCreate.create` {#TypeSpec.Rest.Resource.ExtensionResourceCreate.create} + +Creates a new instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceCreate.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TExtension | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +### `ExtensionResourceCreateOrUpdate` {#TypeSpec.Rest.Resource.ExtensionResourceCreateOrUpdate} + +Extension resource create or update operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceCreateOrUpdate +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceCreateOrUpdate.createOrUpdate` {#TypeSpec.Rest.Resource.ExtensionResourceCreateOrUpdate.createOrUpdate} + +Creates or update an instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceCreateOrUpdate.createOrUpdate(resource: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TExtension | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +### `ExtensionResourceDelete` {#TypeSpec.Rest.Resource.ExtensionResourceDelete} + +Extension resource delete operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceDelete +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceDelete.delete` {#TypeSpec.Rest.Resource.ExtensionResourceDelete.delete} + +Deletes an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceDelete.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +### `ExtensionResourceInstanceOperations` {#TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations} + +Extension resource operation templates for extension resource instances. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceInstanceOperations.get` {#TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.get} + +Gets an instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.get(): TExtension | TError +``` + +#### `ExtensionResourceInstanceOperations.update` {#TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.update} + +Updates an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TExtension | TError +``` + +#### `ExtensionResourceInstanceOperations.delete` {#TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.delete} + +Deletes an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceInstanceOperations.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +### `ExtensionResourceList` {#TypeSpec.Rest.Resource.ExtensionResourceList} + +Extension resource list operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceList +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceList.list` {#TypeSpec.Rest.Resource.ExtensionResourceList.list} + +Lists all instances of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceList.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ExtensionResourceOperations` {#TypeSpec.Rest.Resource.ExtensionResourceOperations} + +Extension resource operation templates for extension resource instances and collections. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceOperations +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceOperations.get` {#TypeSpec.Rest.Resource.ExtensionResourceOperations.get} + +Gets an instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceOperations.get(): TExtension | TError +``` + +#### `ExtensionResourceOperations.update` {#TypeSpec.Rest.Resource.ExtensionResourceOperations.update} + +Updates an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceOperations.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TExtension | TError +``` + +#### `ExtensionResourceOperations.delete` {#TypeSpec.Rest.Resource.ExtensionResourceOperations.delete} + +Deletes an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceOperations.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +#### `ExtensionResourceOperations.create` {#TypeSpec.Rest.Resource.ExtensionResourceOperations.create} + +Creates a new instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceOperations.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TExtension | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +#### `ExtensionResourceOperations.list` {#TypeSpec.Rest.Resource.ExtensionResourceOperations.list} + +Lists all instances of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ExtensionResourceRead` {#TypeSpec.Rest.Resource.ExtensionResourceRead} + +Extension resource read operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceRead +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceRead.get` {#TypeSpec.Rest.Resource.ExtensionResourceRead.get} + +Gets an instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceRead.get(): TExtension | TError +``` + +### `ExtensionResourceUpdate` {#TypeSpec.Rest.Resource.ExtensionResourceUpdate} + +Extension resource update operation template. + +```typespec +interface TypeSpec.Rest.Resource.ExtensionResourceUpdate +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TExtension | The extension resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `ExtensionResourceUpdate.update` {#TypeSpec.Rest.Resource.ExtensionResourceUpdate.update} + +Updates an existing instance of the extension resource. + +```typespec +op TypeSpec.Rest.Resource.ExtensionResourceUpdate.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TExtension | TError +``` + +### `ResourceCollectionOperations` {#TypeSpec.Rest.Resource.ResourceCollectionOperations} + +Resource operation templates for resource collections. + +```typespec +interface TypeSpec.Rest.Resource.ResourceCollectionOperations +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | +| TError | The error response. | + +#### `ResourceCollectionOperations.create` {#TypeSpec.Rest.Resource.ResourceCollectionOperations.create} + +Creates a new instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceCollectionOperations.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TResource | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +#### `ResourceCollectionOperations.list` {#TypeSpec.Rest.Resource.ResourceCollectionOperations.list} + +Lists all instances of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceCollectionOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ResourceCreate` {#TypeSpec.Rest.Resource.ResourceCreate} + +Resource create operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceCreate +``` + +#### Template Parameters + +| Name | Description | +| --------- | ----------------------------- | +| TResource | The resource model to create. | +| TError | The error response. | + +#### `ResourceCreate.create` {#TypeSpec.Rest.Resource.ResourceCreate.create} + +Creates a new instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceCreate.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TResource | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +### `ResourceCreateOrReplace` {#TypeSpec.Rest.Resource.ResourceCreateOrReplace} + +Resource create or replace operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceCreateOrReplace +``` + +#### Template Parameters + +| Name | Description | +| --------- | ---------------------------------------- | +| TResource | The resource model to create or replace. | +| TError | The error response. | + +#### `ResourceCreateOrReplace.createOrReplace` {#TypeSpec.Rest.Resource.ResourceCreateOrReplace.createOrReplace} + +Creates or replaces a instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceCreateOrReplace.createOrReplace(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TResource | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +### `ResourceCreateOrUpdate` {#TypeSpec.Rest.Resource.ResourceCreateOrUpdate} + +Resource create or update operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceCreateOrUpdate +``` + +#### Template Parameters + +| Name | Description | +| --------- | --------------------------------------- | +| TResource | The resource model to create or update. | +| TError | The error response. | + +#### `ResourceCreateOrUpdate.createOrUpdate` {#TypeSpec.Rest.Resource.ResourceCreateOrUpdate.createOrUpdate} + +Creates or update an instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceCreateOrUpdate.createOrUpdate(resource: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TResource | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +### `ResourceDelete` {#TypeSpec.Rest.Resource.ResourceDelete} + +Resource delete operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceDelete +``` + +#### Template Parameters + +| Name | Description | +| --------- | ----------------------------- | +| TResource | The resource model to delete. | +| TError | The error response. | + +#### `ResourceDelete.delete` {#TypeSpec.Rest.Resource.ResourceDelete.delete} + +Deletes an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceDelete.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +### `ResourceInstanceOperations` {#TypeSpec.Rest.Resource.ResourceInstanceOperations} + +Resource operation templates for resource instances. + +```typespec +interface TypeSpec.Rest.Resource.ResourceInstanceOperations +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | +| TError | The error response. | + +#### `ResourceInstanceOperations.get` {#TypeSpec.Rest.Resource.ResourceInstanceOperations.get} + +Gets an instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceInstanceOperations.get(): TResource | TError +``` + +#### `ResourceInstanceOperations.update` {#TypeSpec.Rest.Resource.ResourceInstanceOperations.update} + +Updates an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceInstanceOperations.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TResource | TError +``` + +#### `ResourceInstanceOperations.delete` {#TypeSpec.Rest.Resource.ResourceInstanceOperations.delete} + +Deletes an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceInstanceOperations.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +### `ResourceList` {#TypeSpec.Rest.Resource.ResourceList} + +Resource list operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceList +``` + +#### Template Parameters + +| Name | Description | +| --------- | --------------------------- | +| TResource | The resource model to list. | +| TError | The error response. | + +#### `ResourceList.list` {#TypeSpec.Rest.Resource.ResourceList.list} + +Lists all instances of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceList.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ResourceOperations` {#TypeSpec.Rest.Resource.ResourceOperations} + +Resource operation templates for resources. + +```typespec +interface TypeSpec.Rest.Resource.ResourceOperations +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | +| TError | The error response. | + +#### `ResourceOperations.get` {#TypeSpec.Rest.Resource.ResourceOperations.get} + +Gets an instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceOperations.get(): TResource | TError +``` + +#### `ResourceOperations.update` {#TypeSpec.Rest.Resource.ResourceOperations.update} + +Updates an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceOperations.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TResource | TError +``` + +#### `ResourceOperations.delete` {#TypeSpec.Rest.Resource.ResourceOperations.delete} + +Deletes an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceOperations.delete(): TypeSpec.Rest.Resource.ResourceDeletedResponse | TError +``` + +#### `ResourceOperations.create` {#TypeSpec.Rest.Resource.ResourceOperations.create} + +Creates a new instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceOperations.create(resource: TypeSpec.Rest.Resource.ResourceCreateModel): TResource | TypeSpec.Rest.Resource.ResourceCreatedResponse | TError +``` + +#### `ResourceOperations.list` {#TypeSpec.Rest.Resource.ResourceOperations.list} + +Lists all instances of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceOperations.list(): TypeSpec.Rest.Resource.CollectionWithNextLink | TError +``` + +### `ResourceRead` {#TypeSpec.Rest.Resource.ResourceRead} + +Represent the resource GET operation. + +```typespec +interface TypeSpec.Rest.Resource.ResourceRead +``` + +#### Template Parameters + +| Name | Description | +| --------- | ------------------- | +| TResource | The resource model. | +| TError | The error response. | + +#### `ResourceRead.get` {#TypeSpec.Rest.Resource.ResourceRead.get} + +Gets an instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceRead.get(): TResource | TError +``` + +### `ResourceUpdate` {#TypeSpec.Rest.Resource.ResourceUpdate} + +Resource update operation template. + +```typespec +interface TypeSpec.Rest.Resource.ResourceUpdate +``` + +#### Template Parameters + +| Name | Description | +| --------- | ----------------------------- | +| TResource | The resource model to update. | +| TError | The error response. | + +#### `ResourceUpdate.update` {#TypeSpec.Rest.Resource.ResourceUpdate.update} + +Updates an existing instance of the resource. + +```typespec +op TypeSpec.Rest.Resource.ResourceUpdate.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TResource | TError +``` + +### `SingletonResourceOperations` {#TypeSpec.Rest.Resource.SingletonResourceOperations} + +Singleton resource operation templates for singleton resource instances. + +```typespec +interface TypeSpec.Rest.Resource.SingletonResourceOperations +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TSingleton | The singleton resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `SingletonResourceOperations.get` {#TypeSpec.Rest.Resource.SingletonResourceOperations.get} + +Gets the singleton resource. + +```typespec +op TypeSpec.Rest.Resource.SingletonResourceOperations.get(): TSingleton | TError +``` + +#### `SingletonResourceOperations.update` {#TypeSpec.Rest.Resource.SingletonResourceOperations.update} + +Updates the singleton resource. + +```typespec +op TypeSpec.Rest.Resource.SingletonResourceOperations.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TSingleton | TError +``` + +### `SingletonResourceRead` {#TypeSpec.Rest.Resource.SingletonResourceRead} + +Singleton resource read operation template. + +```typespec +interface TypeSpec.Rest.Resource.SingletonResourceRead +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TSingleton | The singleton resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `SingletonResourceRead.get` {#TypeSpec.Rest.Resource.SingletonResourceRead.get} + +Gets the singleton resource. + +```typespec +op TypeSpec.Rest.Resource.SingletonResourceRead.get(): TSingleton | TError +``` + +### `SingletonResourceUpdate` {#TypeSpec.Rest.Resource.SingletonResourceUpdate} + +Singleton resource update operation template. + +```typespec +interface TypeSpec.Rest.Resource.SingletonResourceUpdate +``` + +#### Template Parameters + +| Name | Description | +| ---------- | ----------------------------- | +| TSingleton | The singleton resource model. | +| TResource | The resource model. | +| TError | The error response. | + +#### `SingletonResourceUpdate.update` {#TypeSpec.Rest.Resource.SingletonResourceUpdate.update} + +Updates the singleton resource. + +```typespec +op TypeSpec.Rest.Resource.SingletonResourceUpdate.update(properties: TypeSpec.Rest.Resource.ResourceCreateOrUpdateModel): TSingleton | TError +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$action.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$action.md new file mode 100644 index 0000000000..b8c79cde6b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$action.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $action" + +--- +```ts +$action( + context, + entity, + name?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `name`? | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$actionSegment.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$actionSegment.md new file mode 100644 index 0000000000..608e9a438b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$actionSegment.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $actionSegment" + +--- +```ts +$actionSegment( + context, + entity, + name): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `name` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$actionSeparator.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$actionSeparator.md new file mode 100644 index 0000000000..2a8cb0f621 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$actionSeparator.md @@ -0,0 +1,24 @@ +--- +jsApi: true +title: "[F] $actionSeparator" + +--- +```ts +$actionSeparator( + context, + entity, + separator): void +``` + +`@actionSeparator` defines the separator string that is used to precede the action name + in auto-generated actions. + +`@actionSeparator` can only be applied to model properties, operation parameters, or operations. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` \| `ModelProperty` \| `Operation` | +| `separator` | `"/"` \| `":"` \| `"/:"` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$autoRoute.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$autoRoute.md new file mode 100644 index 0000000000..f379e56a4c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$autoRoute.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $autoRoute" + +--- +```ts +$autoRoute(context, entity): void +``` + +`@autoRoute` enables automatic route generation for an operation or interface. + +When applied to an operation, it automatically generates the operation's route based on path parameter +metadata. When applied to an interface, it causes all operations under that scope to have +auto-generated routes. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Interface` \| `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$collectionAction.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$collectionAction.md new file mode 100644 index 0000000000..a078bb5423 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$collectionAction.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $collectionAction" + +--- +```ts +$collectionAction( + context, + entity, + resourceType, + name?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | +| `name`? | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$copyResourceKeyParameters.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$copyResourceKeyParameters.md new file mode 100644 index 0000000000..1d28121be9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$copyResourceKeyParameters.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $copyResourceKeyParameters" + +--- +```ts +$copyResourceKeyParameters( + context, + entity, + filter?): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` | +| `filter`? | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$createsOrReplacesResource.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$createsOrReplacesResource.md new file mode 100644 index 0000000000..aa1451cc01 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$createsOrReplacesResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $createsOrReplacesResource" + +--- +```ts +$createsOrReplacesResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$createsOrUpdatesResource.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$createsOrUpdatesResource.md new file mode 100644 index 0000000000..836b143410 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$createsOrUpdatesResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $createsOrUpdatesResource" + +--- +```ts +$createsOrUpdatesResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$createsResource.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$createsResource.md new file mode 100644 index 0000000000..24c285285c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$createsResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $createsResource" + +--- +```ts +$createsResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$deletesResource.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$deletesResource.md new file mode 100644 index 0000000000..ad1a79193d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$deletesResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $deletesResource" + +--- +```ts +$deletesResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$listsResource.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$listsResource.md new file mode 100644 index 0000000000..27e48d0d07 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$listsResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $listsResource" + +--- +```ts +$listsResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$onValidate.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$onValidate.md new file mode 100644 index 0000000000..df5dda0051 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$onValidate.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] $onValidate" + +--- +```ts +$onValidate(program): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$parentResource.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$parentResource.md new file mode 100644 index 0000000000..e57db3d602 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$parentResource.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] $parentResource" + +--- +```ts +$parentResource( + context, + entity, + parentType): void +``` + +`@parentResource` marks a model with a reference to its parent resource type + +The first argument should be a reference to a model type which will be treated as the parent +type of the target model type. This will cause the `@key` properties of all parent types of +the target type to show up in operations of the `Resource*` interfaces defined in this library. + +`@parentResource` can only be applied to models. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Type` | +| `parentType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$readsResource.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$readsResource.md new file mode 100644 index 0000000000..670763f28f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$readsResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $readsResource" + +--- +```ts +$readsResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$resource.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$resource.md new file mode 100644 index 0000000000..c79bb590b5 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$resource.md @@ -0,0 +1,27 @@ +--- +jsApi: true +title: "[F] $resource" + +--- +```ts +$resource( + context, + entity, + collectionName): void +``` + +`@resource` marks a model as a resource type. + +The first argument should be the name of the collection that the resources +belong to. For example, a resource type `Widget` might have a collection +name of `widgets`. + +`@resource` can only be applied to models. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` | +| `collectionName` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$resourceLocation.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$resourceLocation.md new file mode 100644 index 0000000000..008d4f2697 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$resourceLocation.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $resourceLocation" + +--- +```ts +$resourceLocation( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$resourceTypeForKeyParam.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$resourceTypeForKeyParam.md new file mode 100644 index 0000000000..8aa67e2a52 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$resourceTypeForKeyParam.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $resourceTypeForKeyParam" + +--- +```ts +$resourceTypeForKeyParam( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Type` | +| `resourceType` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$segment.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$segment.md new file mode 100644 index 0000000000..46b4a3f89c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$segment.md @@ -0,0 +1,26 @@ +--- +jsApi: true +title: "[F] $segment" + +--- +```ts +$segment( + context, + entity, + name): void +``` + +`@segment` defines the preceding path segment for a `@path` parameter in auto-generated routes + +The first argument should be a string that will be inserted into the operation route before the +path parameter's name field. + +`@segment` can only be applied to model properties, operation parameters, or operations. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Model` \| `ModelProperty` \| `Operation` | +| `name` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$segmentOf.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$segmentOf.md new file mode 100644 index 0000000000..63972a9f8f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$segmentOf.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $segmentOf" + +--- +```ts +$segmentOf( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$updatesResource.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$updatesResource.md new file mode 100644 index 0000000000..c81d7bd331 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/$updatesResource.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $updatesResource" + +--- +```ts +$updatesResource( + context, + entity, + resourceType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getAction.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getAction.md new file mode 100644 index 0000000000..094e46508c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getAction.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getAction" + +--- +```ts +getAction(program, operation): string | null | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | + +## Returns + +## Deprecated + +Use getActionDetails instead. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getActionDetails.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getActionDetails.md new file mode 100644 index 0000000000..e7514c1146 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getActionDetails.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getActionDetails" + +--- +```ts +getActionDetails(program, operation): ActionDetails | undefined +``` + +Gets the ActionDetails for the specified operation if it has previously been marked with @action. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getActionSegment.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getActionSegment.md new file mode 100644 index 0000000000..697444b0bc --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getActionSegment.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getActionSegment" + +--- +```ts +getActionSegment(program, entity): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getActionSeparator.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getActionSeparator.md new file mode 100644 index 0000000000..696b47f937 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getActionSeparator.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getActionSeparator" + +--- +```ts +getActionSeparator(program, entity): string | undefined +``` + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | the TypeSpec program | +| `entity` | `Type` | the target entity | + +## Returns + +the action separator string diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getCollectionAction.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getCollectionAction.md new file mode 100644 index 0000000000..875637d6c6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getCollectionAction.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getCollectionAction" + +--- +```ts +getCollectionAction(program, operation): string | null | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | + +## Returns + +## Deprecated + +Use getCollectionActionDetails instead. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getCollectionActionDetails.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getCollectionActionDetails.md new file mode 100644 index 0000000000..f5ff439bf0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getCollectionActionDetails.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getCollectionActionDetails" + +--- +```ts +getCollectionActionDetails(program, operation): ActionDetails | undefined +``` + +Gets the ActionDetails for the specified operation if it has previously been marked with @collectionAction. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `operation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getParentResource.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getParentResource.md new file mode 100644 index 0000000000..3cec874c50 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getParentResource.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getParentResource" + +--- +```ts +getParentResource(program, resourceType): Model | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceLocationType.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceLocationType.md new file mode 100644 index 0000000000..59d4ad5148 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceLocationType.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getResourceLocationType" + +--- +```ts +getResourceLocationType(program, entity): Model | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Scalar` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceOperation.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceOperation.md new file mode 100644 index 0000000000..cd7f24bd49 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceOperation.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getResourceOperation" + +--- +```ts +getResourceOperation(program, typespecOperation): ResourceOperation | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `typespecOperation` | `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceTypeForKeyParam.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceTypeForKeyParam.md new file mode 100644 index 0000000000..2c4ecf6200 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceTypeForKeyParam.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getResourceTypeForKeyParam" + +--- +```ts +getResourceTypeForKeyParam(program, param): Model | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `param` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceTypeKey.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceTypeKey.md new file mode 100644 index 0000000000..899bb55b59 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getResourceTypeKey.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getResourceTypeKey" + +--- +```ts +getResourceTypeKey(program, resourceType): ResourceKey | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `resourceType` | `Model` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getSegment.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getSegment.md new file mode 100644 index 0000000000..53465e3684 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/getSegment.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getSegment" + +--- +```ts +getSegment(program, entity): string | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/isAutoRoute.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/isAutoRoute.md new file mode 100644 index 0000000000..8805220b75 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/isAutoRoute.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] isAutoRoute" + +--- +```ts +isAutoRoute(program, entity): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `entity` | `Interface` \| `Operation` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/isListOperation.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/isListOperation.md new file mode 100644 index 0000000000..5879329c16 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/isListOperation.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] isListOperation" + +--- +```ts +isListOperation(program, target): boolean +``` + +Returns `true` if the given operation is marked as a list operation. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | the TypeSpec program | +| `target` | `Operation` | the target operation | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/setResourceOperation.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/setResourceOperation.md new file mode 100644 index 0000000000..35e6b99a80 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/setResourceOperation.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] setResourceOperation" + +--- +```ts +setResourceOperation( + context, + entity, + resourceType, + operation): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `entity` | `Operation` | +| `resourceType` | `Model` | +| `operation` | [`ResourceOperations`](../type-aliases/ResourceOperations.md) | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/setResourceTypeKey.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/setResourceTypeKey.md new file mode 100644 index 0000000000..455af87b5e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/functions/setResourceTypeKey.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] setResourceTypeKey" + +--- +```ts +setResourceTypeKey( + program, + resourceType, + keyProperty): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `resourceType` | `Model` | +| `keyProperty` | `ModelProperty` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/index.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/index.md new file mode 100644 index 0000000000..63e09fe11a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/index.md @@ -0,0 +1,61 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Interfaces + +- [ActionDetails](interfaces/ActionDetails.md) +- [AutoRouteOptions](interfaces/AutoRouteOptions.md) +- [FilteredRouteParam](interfaces/FilteredRouteParam.md) +- [ResourceKey](interfaces/ResourceKey.md) +- [ResourceOperation](interfaces/ResourceOperation.md) + +### Type Aliases + +- [ResourceOperations](type-aliases/ResourceOperations.md) + +### Variables + +- [namespace](variables/namespace.md) + +### Functions + +- [$action](functions/$action.md) +- [$actionSegment](functions/$actionSegment.md) +- [$actionSeparator](functions/$actionSeparator.md) +- [$autoRoute](functions/$autoRoute.md) +- [$collectionAction](functions/$collectionAction.md) +- [$copyResourceKeyParameters](functions/$copyResourceKeyParameters.md) +- [$createsOrReplacesResource](functions/$createsOrReplacesResource.md) +- [$createsOrUpdatesResource](functions/$createsOrUpdatesResource.md) +- [$createsResource](functions/$createsResource.md) +- [$deletesResource](functions/$deletesResource.md) +- [$listsResource](functions/$listsResource.md) +- [$onValidate](functions/$onValidate.md) +- [$parentResource](functions/$parentResource.md) +- [$readsResource](functions/$readsResource.md) +- [$resource](functions/$resource.md) +- [$resourceLocation](functions/$resourceLocation.md) +- [$resourceTypeForKeyParam](functions/$resourceTypeForKeyParam.md) +- [$segment](functions/$segment.md) +- [$segmentOf](functions/$segmentOf.md) +- [$updatesResource](functions/$updatesResource.md) +- [getAction](functions/getAction.md) +- [getActionDetails](functions/getActionDetails.md) +- [getActionSegment](functions/getActionSegment.md) +- [getActionSeparator](functions/getActionSeparator.md) +- [getCollectionAction](functions/getCollectionAction.md) +- [getCollectionActionDetails](functions/getCollectionActionDetails.md) +- [getParentResource](functions/getParentResource.md) +- [getResourceLocationType](functions/getResourceLocationType.md) +- [getResourceOperation](functions/getResourceOperation.md) +- [getResourceTypeForKeyParam](functions/getResourceTypeForKeyParam.md) +- [getResourceTypeKey](functions/getResourceTypeKey.md) +- [getSegment](functions/getSegment.md) +- [isAutoRoute](functions/isAutoRoute.md) +- [isListOperation](functions/isListOperation.md) +- [setResourceOperation](functions/setResourceOperation.md) +- [setResourceTypeKey](functions/setResourceTypeKey.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/ActionDetails.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/ActionDetails.md new file mode 100644 index 0000000000..449ba33cf4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/ActionDetails.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[I] ActionDetails" + +--- +Provides details about an action or collection action. + +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `kind` | `"automatic"` \| `"specified"` | Identifies whether the action's name was generated from the original
operation name or if it was explicitly specified. | +| `name` | `string` | The name of the action | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/AutoRouteOptions.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/AutoRouteOptions.md new file mode 100644 index 0000000000..b7d977cb6b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/AutoRouteOptions.md @@ -0,0 +1,10 @@ +--- +jsApi: true +title: "[I] AutoRouteOptions" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `routeParamFilter?` | (`op`, `param`) => `undefined` \| [`FilteredRouteParam`](FilteredRouteParam.md) | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/FilteredRouteParam.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/FilteredRouteParam.md new file mode 100644 index 0000000000..5fc5a97d34 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/FilteredRouteParam.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] FilteredRouteParam" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `excludeFromOperationParams?` | `boolean` | - | +| `routeParamString?` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/ResourceKey.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/ResourceKey.md new file mode 100644 index 0000000000..7e1ed93dd0 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/ResourceKey.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ResourceKey" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `keyProperty` | `ModelProperty` | - | +| `resourceType` | `Model` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/ResourceOperation.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/ResourceOperation.md new file mode 100644 index 0000000000..87e7f1cfe7 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/interfaces/ResourceOperation.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] ResourceOperation" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `operation` | `string` | - | +| `resourceType` | `Model` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/type-aliases/ResourceOperations.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/type-aliases/ResourceOperations.md new file mode 100644 index 0000000000..e8588cc52a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/type-aliases/ResourceOperations.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[T] ResourceOperations" + +--- +```ts +type ResourceOperations: + | "read" + | "create" + | "createOrReplace" + | "createOrUpdate" + | "update" + | "delete" + | "list"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..014e97e58f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.Rest" = "TypeSpec.Rest"; +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/rest/resource-routing.md b/packages/website-astro/src/content/docs/latest/standard-library/rest/resource-routing.md new file mode 100644 index 0000000000..a76d4b6070 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/rest/resource-routing.md @@ -0,0 +1,102 @@ +--- +title: Resource and routes +--- + +# Resources & routes + +Resources are operations that are grouped in a namespace. You declare such a namespace by adding the `@route` decorator to provide the path to that resource: + +```typespec +using TypeSpec.Http; + +@route("/pets") +namespace Pets { + +} +``` + +To define an operation on this resource, you need to provide the HTTP verb for the route using the `@get`, `@head` `@post`, `@put`, `@patch`, or `@delete` decorators. If an HTTP method decorator is not specified then the default is post if there is a body and get otherwise. Lets add an operation to our `Pets` resource: + +```typespec +@route("/pets") +namespace Pets { + op list(): Pet[]; + + // or you could also use + @get op listPets(): Pet[]; +} +``` + +If `@route` is applied to an interface, that route is not "portable". It will be applied to that interface but will not carry over if another interface extends it. + +```typespec +// Operations prepended with /pets +@route("/pets") +interface PetOps { + list(): Pet[] +} + +// Operations will *not* be prepended with /pets +interface MyPetOps extends PetOps { + ... +} +``` + +### Automatic route generation + +Instead of manually specifying routes using the `@route` decorator, you automatically generate routes from operation parameters by applying the `@autoRoute` decorator to an operation or interface containing operations. + +For this to work, an operation's path parameters (those marked with `@path`) must also be marked with +the `@segment` decorator to define the preceding path segment. + +This is especially useful when reusing common parameter sets defined as model types. + +For example: + +```typespec +model CommonParameters { + @path + @segment("tenants") + tenantId: string; + + @path + @segment("users") + userName: string; +} + +@autoRoute +interface UserOperations { + @get + getUser(...CommonParameters): User | Error; + + @put + updateUser(...CommonParameters, user: User): User | Error; +} +``` + +This will result in the following route for both operations + +```text +/tenants/{tenantId}/users/{userName} +``` + +If `@autoRoute` is applied to an interface, it is not "portable". It will be applied to that interface but will not carry over if another interface extends it. + +```typespec +// Operations prepended with /pets +@autoRoute +interface PetOps { + action(@path @segment("pets") id: string): void; +} + +// Operations will *not* be prepended with /pets +interface MyPetOps extends PetOps { + ... +} +``` + +### Customizing Automatic Route Generation + +Instead of manually specifying routes using the `@route` decorator, you automatically generate +routes from operation parameters by applying the `@autoRoute` decorator to an operation, namespace, +or interface containing operations. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/guide.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/guide.md new file mode 100644 index 0000000000..d3347cd379 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/guide.md @@ -0,0 +1,184 @@ +--- +title: Guide +--- + +## Creating Versioned APIs + +The primary purpose of the TypeSpec.Versioning library is to provide a way to version APIs. Let's start with an unversioned API. + +```typespec +@service({ + title: "Contoso Widget Manager", +}) +namespace Contoso.WidgetManager; +``` + +To make this API versioned, we need to add the `@versioned` decorator to the namespace and declare an enum that identifies the supported versions. + +```typespec +@service({ + title: "Contoso Widget Manager", +}) +@versioned(Contoso.WidgetManager.Versions) +namespace Contoso.WidgetManager; + +enum Versions { + v1, +} +``` + +## Declaring Versioned Dependencies + +Both versioned and unversioned services can declare their dependency on versioned TypeSpec libraries. To declare a dependency on a versioned library, use the `@useDependency` decorator. For unversioned services, this will be declared on the namespace. For versioned services, this will be declared on the versioned enum. + +For example, if our unversioned WidgetManager service has a dependency on the Azure.Core library, we would declare it like this: + +```typespec +@service({ + title: "Contoso Widget Manager Unversioned", +}) +@useDependency(Azure.Core.v1_0_Preview_1) +namespace Contoso.WidgetManager.Unversioned; +``` + +If our versioned WidgetManager service has a dependency on the Azure.Core library, we would declare it like this: + +```typespec +@service({ + title: "Contoso Widget Manager", +}) +@versioned(Contoso.WidgetManager.Versions) +namespace Contoso.WidgetManager; + +enum Versions { + @useDependency(Azure.Core.v1_0_Preview_1) + v1, +} +``` + +Let's assume we add a new version to our service, and it takes advantage of features in a newer version of the Azure.Core library. We can declare that dependency like this: + +```typespec +@service({ + title: "Contoso Widget Manager", +}) +@versioned(Contoso.WidgetManager.Versions) +namespace Contoso.WidgetManager; + +enum Versions { + @useDependency(Azure.Core.v1_0_Preview_1) + v1, + + @useDependency(Azure.Core.v1_0_Preview_2) + v2, +} +``` + +## Versioning APIs + +The versioning library makes it easy to version APIs. Let's start with a simple example. Let's say we have a service that has a single API that returns a list of widgets. We can declare that API like this: + +```typespec +using TypeSpec.Versioning; +using TypeSpec.Rest; +using TypeSpec.Http; + +@service({ + title: "Contoso Widget Manager", +}) +@versioned(Contoso.WidgetManager.Versions) +namespace Contoso.WidgetManager; + +enum Versions { + v1, +} + +@error +model Error { + code: string; + message?: string; +} + +model Widget { + @key + id: string; + + name: string; +} + +op list(): Widget[] | Error; +``` + +Now let's say that in version 2 of the service, we add a get operation to retrieve a single widget. We can add that like this: + +```typespec +enum Versions { + v1, + v2, +} + +model Widget { + @key + id: string; + + name: string; +} + +@route("/widget") +op list(): Widget[] | Error; + +@added(Versions.v2) +@route("/widget/{id}") +op get(...Resource.KeysOf): Widget | Error; +``` + +Now let's say that in version 3 of the service, we realize that `name` is inaccurate and that this field should be called `description`. Also, you +don't always have a description, so you decide it should be optional, not required. We can make these changes like this: + +```typespec +model Widget { + @key + widgetId: string; + + @renamedFrom(Versions.v3, "name") + @madeOptional(Versions.v3) + description?: string; +} +``` + +You can see that we made the change to the actual model property so that it now reflects the correct name and optional nature of the property. Both the +`@renamedFrom` and `@madeOptional` decorators identify the version in which the change was made, and the `@renamedFrom` decorator also identifies the +previous name of the property. This allows us to generate code that is aware of the change and can handle it appropriately. + +The OpenAPI defintion of `Widget` for version 3 reflects the change: + +```yaml +Widget: + type: object + properties: + id: + type: string + description: + type: string + required: + - id +``` + +But the OpenAPI definition for versions 1 and 2 still reflect the original name and required nature of the property: + +```yaml +Widget: + type: object + properties: + id: + type: string + name: + type: string + required: + - id + - name +``` + +This is the common pattern with the versioning decorators. The TypeSpec should reflect the _current state_ of the API. The decorators identify the +version at which this definition became true and, depending on the decorator, the other parameters reflect the preview values in order to preserve +that information. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/decorators.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/decorators.md new file mode 100644 index 0000000000..a9e9040218 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/decorators.md @@ -0,0 +1,244 @@ +--- +title: "Decorators" +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +# Decorators + +## TypeSpec.Versioning + +### `@added` {#@TypeSpec.Versioning.added} + +Identifies when the target was added. + +```typespec +@TypeSpec.Versioning.added(version: EnumMember) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | ------------ | ----------------------------------------- | +| version | `EnumMember` | The version that the target was added in. | + +#### Examples + +```tsp +@added(Versions.v2) +op addedInV2(): void; + +@added(Versions.v2) +model AlsoAddedInV2 {} + +model Foo { + name: string; + + @added(Versions.v3) + addedInV3: string; +} +``` + +### `@madeOptional` {#@TypeSpec.Versioning.madeOptional} + +Identifies when a target was made optional. + +```typespec +@TypeSpec.Versioning.madeOptional(version: EnumMember) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | ------------ | ------------------------------------------------- | +| version | `EnumMember` | The version that the target was made optional in. | + +#### Examples + +```tsp +model Foo { + name: string; + + @madeOptional(Versions.v2) + nickname: string; +} +``` + +### `@removed` {#@TypeSpec.Versioning.removed} + +Identifies when the target was removed. + +```typespec +@TypeSpec.Versioning.removed(version: EnumMember) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | ------------ | ------------------------------------------- | +| version | `EnumMember` | The version that the target was removed in. | + +#### Examples + +```tsp +@removed(Versions.v2) +op removedInV2(): void; + +@removed(Versions.v2) +model AlsoRemovedInV2 {} + +model Foo { + name: string; + + @removed(Versions.v3) + removedInV3: string; +} +``` + +### `@renamedFrom` {#@TypeSpec.Versioning.renamedFrom} + +Identifies when the target has been renamed. + +```typespec +@TypeSpec.Versioning.renamedFrom(version: EnumMember, oldName: valueof string) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | ----------------------- | ------------------------------------------- | +| version | `EnumMember` | The version that the target was renamed in. | +| oldName | `valueof scalar string` | The previous name of the target. | + +#### Examples + +```tsp +@renamedFrom(Versions.v2, "oldName") +op newName(): void; +``` + +### `@returnTypeChangedFrom` {#@TypeSpec.Versioning.returnTypeChangedFrom} + +Identifies when the target type changed. + +```typespec +@TypeSpec.Versioning.returnTypeChangedFrom(version: EnumMember, oldType: unknown) +``` + +#### Target + +`Operation` + +#### Parameters + +| Name | Type | Description | +| ------- | --------------------- | -------------------------------------------- | +| version | `EnumMember` | The version that the target type changed in. | +| oldType | `(intrinsic) unknown` | The previous type of the target. | + +### `@typeChangedFrom` {#@TypeSpec.Versioning.typeChangedFrom} + +Identifies when the target type changed. + +```typespec +@TypeSpec.Versioning.typeChangedFrom(version: EnumMember, oldType: unknown) +``` + +#### Target + +`(intrinsic) unknown` + +#### Parameters + +| Name | Type | Description | +| ------- | --------------------- | -------------------------------------------- | +| version | `EnumMember` | The version that the target type changed in. | +| oldType | `(intrinsic) unknown` | The previous type of the target. | + +### `@useDependency` {#@TypeSpec.Versioning.useDependency} + +Identifies that a namespace or a given versioning enum member relies upon a versioned package. + +```typespec +@TypeSpec.Versioning.useDependency(...versionRecords: EnumMember[]) +``` + +#### Target + +`union EnumMember | Namespace` + +#### Parameters + +| Name | Type | Description | +| -------------- | -------------------- | --------------------------------------------------------------------- | +| versionRecords | `model EnumMember[]` | The dependent library version(s) for the target namespace or version. | + +#### Examples + +##### Select a single version of `MyLib` to use + +```tsp +@useDependency(MyLib.Versions.v1_1) +namespace NonVersionedService; +``` + +##### Select which version of the library match to which version of the service. + +```tsp +@versioned(Versions) +namespace MyService1; +enum Version { + @useDependency(MyLib.Versions.v1_1) // V1 use lib v1_1 + v1, + @useDependency(MyLib.Versions.v1_1) // V2 use lib v1_1 + v2, + @useDependency(MyLib.Versions.v2) // V3 use lib v2 + v3, +} +``` + +### `@versioned` {#@TypeSpec.Versioning.versioned} + +Identifies that the decorated namespace is versioned by the provided enum. + +```typespec +@TypeSpec.Versioning.versioned(versions: Enum) +``` + +#### Target + +`Namespace` + +#### Parameters + +| Name | Type | Description | +| -------- | ------ | ----------------------------------------------- | +| versions | `Enum` | The enum that describes the supported versions. | + +#### Examples + +```tsp +@versioned(Versions) +namespace MyService; +enum Versions { + v1, + v2, + v3, +} +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/index.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/index.md new file mode 100644 index 0000000000..c5bc25693d --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/index.md @@ -0,0 +1,45 @@ +--- +title: Overview +sidebar_position: 0 +toc_min_heading_level: 2 +toc_max_heading_level: 3 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Overview + +TypeSpec library for declaring and emitting versioned APIs + +## Install + + + + +```bash +npm install @typespec/versioning +``` + + + + +```bash +npm install --save-peer @typespec/versioning +``` + + + + +## TypeSpec.Versioning + +### Decorators + +- [`@added`](./decorators.md#@TypeSpec.Versioning.added) +- [`@madeOptional`](./decorators.md#@TypeSpec.Versioning.madeOptional) +- [`@removed`](./decorators.md#@TypeSpec.Versioning.removed) +- [`@renamedFrom`](./decorators.md#@TypeSpec.Versioning.renamedFrom) +- [`@returnTypeChangedFrom`](./decorators.md#@TypeSpec.Versioning.returnTypeChangedFrom) +- [`@typeChangedFrom`](./decorators.md#@TypeSpec.Versioning.typeChangedFrom) +- [`@useDependency`](./decorators.md#@TypeSpec.Versioning.useDependency) +- [`@versioned`](./decorators.md#@TypeSpec.Versioning.versioned) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/_category_.json b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/_category_.json new file mode 100644 index 0000000000..eb101a8378 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/_category_.json @@ -0,0 +1 @@ +{"label":"JS Api","link":{"type":"doc","id":"index"}} \ No newline at end of file diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/classes/VersionMap.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/classes/VersionMap.md new file mode 100644 index 0000000000..b026409955 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/classes/VersionMap.md @@ -0,0 +1,55 @@ +--- +jsApi: true +title: "[C] VersionMap" + +--- +## Constructors + +### new VersionMap(namespace, enumType) + +```ts +new VersionMap(namespace, enumType): VersionMap +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `namespace` | `Namespace` | +| `enumType` | `Enum` | + +## Properties + +| Modifier | Property | Type | Description | +| :------ | :------ | :------ | :------ | +| `private` | `map` | `Map`<`EnumMember`, [`Version`](../interfaces/Version.md)\> | - | + +## Accessors + +### size + +```ts +get size(): number +``` + +## Methods + +### getVersionForEnumMember() + +```ts +getVersionForEnumMember(member): undefined | Version +``` + +#### Parameters + +| Parameter | Type | +| :------ | :------ | +| `member` | `EnumMember` | + +*** + +### getVersions() + +```ts +getVersions(): Version[] +``` diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/enumerations/Availability.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/enumerations/Availability.md new file mode 100644 index 0000000000..464521f3b6 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/enumerations/Availability.md @@ -0,0 +1,13 @@ +--- +jsApi: true +title: "[E] Availability" + +--- +## Enumeration Members + +| Member | Value | +| :------ | :------ | +| `Added` | `"Added"` | +| `Available` | `"Available"` | +| `Removed` | `"Removed"` | +| `Unavailable` | `"Unavailable"` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$added.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$added.md new file mode 100644 index 0000000000..1fdad62384 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$added.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $added" + +--- +```ts +$added( + context, + t, + v): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `t` | `Type` | +| `v` | `EnumMember` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$madeOptional.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$madeOptional.md new file mode 100644 index 0000000000..7decbe579a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$madeOptional.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $madeOptional" + +--- +```ts +$madeOptional( + context, + t, + v): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `t` | `ModelProperty` | +| `v` | `EnumMember` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$onValidate.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$onValidate.md new file mode 100644 index 0000000000..df5dda0051 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$onValidate.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[F] $onValidate" + +--- +```ts +$onValidate(program): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$removed.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$removed.md new file mode 100644 index 0000000000..a7a031f468 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$removed.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $removed" + +--- +```ts +$removed( + context, + t, + v): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `t` | `Type` | +| `v` | `EnumMember` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$renamedFrom.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$renamedFrom.md new file mode 100644 index 0000000000..363443640e --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$renamedFrom.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $renamedFrom" + +--- +```ts +$renamedFrom( + context, + t, + v, + oldName): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `t` | `Type` | +| `v` | `EnumMember` | +| `oldName` | `string` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$returnTypeChangedFrom.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$returnTypeChangedFrom.md new file mode 100644 index 0000000000..ef23d3f31a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$returnTypeChangedFrom.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $returnTypeChangedFrom" + +--- +```ts +$returnTypeChangedFrom( + context, + op, + v, + oldReturnType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `op` | `Operation` | +| `v` | `EnumMember` | +| `oldReturnType` | `any` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$typeChangedFrom.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$typeChangedFrom.md new file mode 100644 index 0000000000..24b4e25952 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$typeChangedFrom.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] $typeChangedFrom" + +--- +```ts +$typeChangedFrom( + context, + prop, + v, + oldType): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `prop` | `ModelProperty` | +| `v` | `EnumMember` | +| `oldType` | `any` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$useDependency.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$useDependency.md new file mode 100644 index 0000000000..fc0546cc72 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$useDependency.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $useDependency" + +--- +```ts +$useDependency( + context, + target, ... + versionRecords): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `target` | `EnumMember` \| `Namespace` | +| ...`versionRecords` | `EnumMember`[] | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$versioned.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$versioned.md new file mode 100644 index 0000000000..1a260ccab4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/$versioned.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] $versioned" + +--- +```ts +$versioned( + context, + t, + versions): void +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `context` | `DecoratorContext` | +| `t` | `Namespace` | +| `versions` | `Enum` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/buildVersionProjections.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/buildVersionProjections.md new file mode 100644 index 0000000000..cd8a640c27 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/buildVersionProjections.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] buildVersionProjections" + +--- +```ts +buildVersionProjections(program, rootNs): VersionProjections[] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `rootNs` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/existsAtVersion.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/existsAtVersion.md new file mode 100644 index 0000000000..0e98a7e3a3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/existsAtVersion.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] existsAtVersion" + +--- +```ts +existsAtVersion( + p, + type, + versionKey): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `type` | `Type` | +| `versionKey` | `ObjectType` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/findVersionedNamespace.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/findVersionedNamespace.md new file mode 100644 index 0000000000..fdf0acd7c1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/findVersionedNamespace.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] findVersionedNamespace" + +--- +```ts +findVersionedNamespace(program, namespace): Namespace | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getAddedOnVersions.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getAddedOnVersions.md new file mode 100644 index 0000000000..9655c1964b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getAddedOnVersions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getAddedOnVersions" + +--- +```ts +getAddedOnVersions(p, t): Version[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getAvailabilityMap.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getAvailabilityMap.md new file mode 100644 index 0000000000..7f972bc15f --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getAvailabilityMap.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getAvailabilityMap" + +--- +```ts +getAvailabilityMap(program, type): Map | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getAvailabilityMapInTimeline.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getAvailabilityMapInTimeline.md new file mode 100644 index 0000000000..9802f6339c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getAvailabilityMapInTimeline.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getAvailabilityMapInTimeline" + +--- +```ts +getAvailabilityMapInTimeline( + program, + type, + timeline): Map | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | +| `timeline` | `VersioningTimeline` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getMadeOptionalOn.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getMadeOptionalOn.md new file mode 100644 index 0000000000..24d90d946c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getMadeOptionalOn.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getMadeOptionalOn" + +--- +```ts +getMadeOptionalOn(p, t): Version | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | + +## Returns + +version when the given type was made optional if applicable. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getNameAtVersion.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getNameAtVersion.md new file mode 100644 index 0000000000..d170922f5b --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getNameAtVersion.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getNameAtVersion" + +--- +```ts +getNameAtVersion( + p, + t, + versionKey): string +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | +| `versionKey` | `ObjectType` | + +## Returns + +get old name if applicable. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getRemovedOnVersions.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getRemovedOnVersions.md new file mode 100644 index 0000000000..12ed5476db --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getRemovedOnVersions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getRemovedOnVersions" + +--- +```ts +getRemovedOnVersions(p, t): Version[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getRenamedFrom.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getRenamedFrom.md new file mode 100644 index 0000000000..3d53fc7ce9 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getRenamedFrom.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getRenamedFrom" + +--- +```ts +getRenamedFrom(p, t): RenamedFrom[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | + +## Returns + +the array of RenamedFrom metadata if applicable. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getRenamedFromVersions.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getRenamedFromVersions.md new file mode 100644 index 0000000000..1da63f3937 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getRenamedFromVersions.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getRenamedFromVersions" + +--- +```ts +getRenamedFromVersions(p, t): Version[] | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | + +## Returns + +the list of versions for which this decorator has been applied diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getReturnTypeBeforeVersion.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getReturnTypeBeforeVersion.md new file mode 100644 index 0000000000..abfe677663 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getReturnTypeBeforeVersion.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getReturnTypeBeforeVersion" + +--- +```ts +getReturnTypeBeforeVersion( + p, + t, + versionKey): any +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | +| `versionKey` | `ObjectType` | + +## Returns + +get old type if applicable. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getReturnTypeChangedFrom.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getReturnTypeChangedFrom.md new file mode 100644 index 0000000000..aca2124e35 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getReturnTypeChangedFrom.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getReturnTypeChangedFrom" + +--- +```ts +getReturnTypeChangedFrom(p, t): Map | undefined +``` + +Returns the mapping of versions to old return type values, if applicable + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `p` | `Program` | TypeSpec program | +| `t` | `Type` | type to query | + +## Returns + +Map of versions to old types, if any diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getTypeBeforeVersion.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getTypeBeforeVersion.md new file mode 100644 index 0000000000..2be8a03bba --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getTypeBeforeVersion.md @@ -0,0 +1,23 @@ +--- +jsApi: true +title: "[F] getTypeBeforeVersion" + +--- +```ts +getTypeBeforeVersion( + p, + t, + versionKey): Type | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | +| `versionKey` | `ObjectType` | + +## Returns + +get old type if applicable. diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getTypeChangedFrom.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getTypeChangedFrom.md new file mode 100644 index 0000000000..7039315ede --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getTypeChangedFrom.md @@ -0,0 +1,21 @@ +--- +jsApi: true +title: "[F] getTypeChangedFrom" + +--- +```ts +getTypeChangedFrom(p, t): Map | undefined +``` + +Returns the mapping of versions to old type values, if applicable + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `p` | `Program` | TypeSpec program | +| `t` | `Type` | type to query | + +## Returns + +Map of versions to old types, if any diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getUseDependencies.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getUseDependencies.md new file mode 100644 index 0000000000..6fc9813ab1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getUseDependencies.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] getUseDependencies" + +--- +```ts +getUseDependencies( + program, + target, + searchEnum): Map | Version> | undefined +``` + +## Parameters + +| Parameter | Type | Default value | +| :------ | :------ | :------ | +| `program` | `Program` | `undefined` | +| `target` | `Enum` \| `Namespace` | `undefined` | +| `searchEnum` | `boolean` | `true` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersion.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersion.md new file mode 100644 index 0000000000..7ba5549b34 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersion.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] getVersion" + +--- +```ts +getVersion(program, namespace): VersionMap | undefined +``` + +Get the version map of the namespace. + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersionDependencies.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersionDependencies.md new file mode 100644 index 0000000000..60f81f8d17 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersionDependencies.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getVersionDependencies" + +--- +```ts +getVersionDependencies(program, namespace): Map | Version> | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `namespace` | `Namespace` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersionForEnumMember.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersionForEnumMember.md new file mode 100644 index 0000000000..124598d405 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersionForEnumMember.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getVersionForEnumMember" + +--- +```ts +getVersionForEnumMember(program, member): Version | undefined +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `member` | `EnumMember` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersions.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersions.md new file mode 100644 index 0000000000..c728ea66a4 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersions.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getVersions" + +--- +```ts +getVersions(p, t): [Namespace, VersionMap] | [] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `t` | `Type` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersionsForEnum.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersionsForEnum.md new file mode 100644 index 0000000000..f1d43817dd --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/getVersionsForEnum.md @@ -0,0 +1,15 @@ +--- +jsApi: true +title: "[F] getVersionsForEnum" + +--- +```ts +getVersionsForEnum(program, en): [Namespace, VersionMap] | [] +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `en` | `Enum` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/hasDifferentNameAtVersion.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/hasDifferentNameAtVersion.md new file mode 100644 index 0000000000..8c00bdee96 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/hasDifferentNameAtVersion.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] hasDifferentNameAtVersion" + +--- +```ts +hasDifferentNameAtVersion( + p, + type, + version): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `type` | `Type` | +| `version` | `ObjectType` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/hasDifferentReturnTypeAtVersion.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/hasDifferentReturnTypeAtVersion.md new file mode 100644 index 0000000000..5621b96796 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/hasDifferentReturnTypeAtVersion.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] hasDifferentReturnTypeAtVersion" + +--- +```ts +hasDifferentReturnTypeAtVersion( + p, + type, + version): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `type` | `Type` | +| `version` | `ObjectType` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/hasDifferentTypeAtVersion.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/hasDifferentTypeAtVersion.md new file mode 100644 index 0000000000..18fcdb6065 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/hasDifferentTypeAtVersion.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] hasDifferentTypeAtVersion" + +--- +```ts +hasDifferentTypeAtVersion( + p, + type, + version): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `p` | `Program` | +| `type` | `Type` | +| `version` | `ObjectType` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/madeOptionalAfter.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/madeOptionalAfter.md new file mode 100644 index 0000000000..6d79ee513c --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/madeOptionalAfter.md @@ -0,0 +1,19 @@ +--- +jsApi: true +title: "[F] madeOptionalAfter" + +--- +```ts +madeOptionalAfter( + program, + type, + versionKey): boolean +``` + +## Parameters + +| Parameter | Type | +| :------ | :------ | +| `program` | `Program` | +| `type` | `Type` | +| `versionKey` | `ObjectType` | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/resolveVersions.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/resolveVersions.md new file mode 100644 index 0000000000..20172beec1 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/functions/resolveVersions.md @@ -0,0 +1,17 @@ +--- +jsApi: true +title: "[F] resolveVersions" + +--- +```ts +resolveVersions(program, rootNs): VersionResolution[] +``` + +Resolve the version to use for all namespace for each of the root namespace versions. + +## Parameters + +| Parameter | Type | Description | +| :------ | :------ | :------ | +| `program` | `Program` | | +| `rootNs` | `Namespace` | Root namespace. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/index.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/index.md new file mode 100644 index 0000000000..4897908191 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/index.md @@ -0,0 +1,61 @@ +--- +jsApi: true +title: "[P] JS Api" + +--- +## Exports + +### Enumerations + +- [Availability](enumerations/Availability.md) + +### Classes + +- [VersionMap](classes/VersionMap.md) + +### Interfaces + +- [Version](interfaces/Version.md) +- [VersionResolution](interfaces/VersionResolution.md) + +### Variables + +- [namespace](variables/namespace.md) + +### Functions + +- [$added](functions/$added.md) +- [$madeOptional](functions/$madeOptional.md) +- [$onValidate](functions/$onValidate.md) +- [$removed](functions/$removed.md) +- [$renamedFrom](functions/$renamedFrom.md) +- [$returnTypeChangedFrom](functions/$returnTypeChangedFrom.md) +- [$typeChangedFrom](functions/$typeChangedFrom.md) +- [$useDependency](functions/$useDependency.md) +- [$versioned](functions/$versioned.md) +- [buildVersionProjections](functions/buildVersionProjections.md) +- [existsAtVersion](functions/existsAtVersion.md) +- [findVersionedNamespace](functions/findVersionedNamespace.md) +- [getAddedOnVersions](functions/getAddedOnVersions.md) +- [getAvailabilityMap](functions/getAvailabilityMap.md) +- [getAvailabilityMapInTimeline](functions/getAvailabilityMapInTimeline.md) +- [getMadeOptionalOn](functions/getMadeOptionalOn.md) +- [getNameAtVersion](functions/getNameAtVersion.md) +- [getRemovedOnVersions](functions/getRemovedOnVersions.md) +- [getRenamedFrom](functions/getRenamedFrom.md) +- [getRenamedFromVersions](functions/getRenamedFromVersions.md) +- [getReturnTypeBeforeVersion](functions/getReturnTypeBeforeVersion.md) +- [getReturnTypeChangedFrom](functions/getReturnTypeChangedFrom.md) +- [getTypeBeforeVersion](functions/getTypeBeforeVersion.md) +- [getTypeChangedFrom](functions/getTypeChangedFrom.md) +- [getUseDependencies](functions/getUseDependencies.md) +- [getVersion](functions/getVersion.md) +- [getVersionDependencies](functions/getVersionDependencies.md) +- [getVersionForEnumMember](functions/getVersionForEnumMember.md) +- [getVersions](functions/getVersions.md) +- [getVersionsForEnum](functions/getVersionsForEnum.md) +- [hasDifferentNameAtVersion](functions/hasDifferentNameAtVersion.md) +- [hasDifferentReturnTypeAtVersion](functions/hasDifferentReturnTypeAtVersion.md) +- [hasDifferentTypeAtVersion](functions/hasDifferentTypeAtVersion.md) +- [madeOptionalAfter](functions/madeOptionalAfter.md) +- [resolveVersions](functions/resolveVersions.md) diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/interfaces/Version.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/interfaces/Version.md new file mode 100644 index 0000000000..1832bccbeb --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/interfaces/Version.md @@ -0,0 +1,14 @@ +--- +jsApi: true +title: "[I] Version" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `enumMember` | `EnumMember` | - | +| `index` | `number` | - | +| `name` | `string` | - | +| `namespace` | `Namespace` | - | +| `value` | `string` | - | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/interfaces/VersionResolution.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/interfaces/VersionResolution.md new file mode 100644 index 0000000000..384e3f346a --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/interfaces/VersionResolution.md @@ -0,0 +1,11 @@ +--- +jsApi: true +title: "[I] VersionResolution" + +--- +## Properties + +| Property | Type | Description | +| :------ | :------ | :------ | +| `rootVersion` | `undefined` \| [`Version`](Version.md) | Version for the root namespace. `undefined` if not versioned. | +| `versions` | `Map`<`Namespace`, [`Version`](Version.md)\> | Resolved version for all the referenced namespaces. | diff --git a/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/variables/namespace.md b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/variables/namespace.md new file mode 100644 index 0000000000..9c54508ab3 --- /dev/null +++ b/packages/website-astro/src/content/docs/latest/standard-library/versioning/reference/js-api/variables/namespace.md @@ -0,0 +1,8 @@ +--- +jsApi: true +title: "[V] namespace" + +--- +```ts +const namespace: "TypeSpec.Versioning" = "TypeSpec.Versioning"; +``` diff --git a/packages/website-astro/src/env.d.ts b/packages/website-astro/src/env.d.ts new file mode 100644 index 0000000000..acef35f175 --- /dev/null +++ b/packages/website-astro/src/env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/packages/website-astro/tsconfig.json b/packages/website-astro/tsconfig.json new file mode 100644 index 0000000000..3b8a307e77 --- /dev/null +++ b/packages/website-astro/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../tsconfig.json", + "references": [{ "path": "../compiler/tsconfig.json" }], + "compilerOptions": { + "outDir": "dist", + "rootDir": ".", + "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo", + "types": ["node", "mocha"] + }, + "include": ["src/**/*.ts", "test/**/*.ts"] +} diff --git a/rush.json b/rush.json index ebe8974062..5d9875389a 100644 --- a/rush.json +++ b/rush.json @@ -180,6 +180,12 @@ "reviewCategory": "production", "shouldPublish": false }, + { + "packageName": "@typespec/website-astro", + "projectFolder": "packages/website-astro", + "reviewCategory": "production", + "shouldPublish": false + }, { "packageName": "@typespec/bundler", "projectFolder": "packages/bundler",