From 9835ce553443f035ce5cf7e296d9beff8c162ee3 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Fri, 20 Dec 2024 11:43:06 +1100 Subject: [PATCH 01/38] Add mermaid-mdx and basic sitewide config. --- docs/apis.mdx | 10 + package.json | 2 + src/components/mdx.tsx | 2 + src/mdx/remark.mjs | 23 +- yarn.lock | 1568 +++++++++++++++++++++++++++++++++++++++- 5 files changed, 1592 insertions(+), 13 deletions(-) diff --git a/docs/apis.mdx b/docs/apis.mdx index 25265206d..68c1eed9f 100644 --- a/docs/apis.mdx +++ b/docs/apis.mdx @@ -6,6 +6,16 @@ description: 'Building HTTP APIs with Nitric' Nitric has built-in support for web apps and HTTP API development. The `api` resource allows you to create APIs in your applications, including routing, middleware and request handlers. +## Architecture + +```mermaid +graph LR; + classDef default line-height:1.2; + + A[Api]-->B[Service A]; + A-->C[Service B]; +``` + ## Creating APIs Nitric allows you define named APIs, each with their own routes, middleware, handlers and security. diff --git a/package.json b/package.json index f188dce1f..4083031cd 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,8 @@ "lucide-react": "^0.445.0", "mdast-util-to-string": "^4.0.0", "mdx-annotations": "^0.1.1", + "mdx-mermaid": "^2.0.3", + "mermaid": "^11.4.1", "next": "^14.2.21", "next-contentlayer2": "^0.5.1", "next-themes": "^0.3.0", diff --git a/src/components/mdx.tsx b/src/components/mdx.tsx index ddb82dd38..c0138d3e6 100644 --- a/src/components/mdx.tsx +++ b/src/components/mdx.tsx @@ -108,4 +108,6 @@ export { Tabs, TabItem } from '@/components/tabs/Tabs' export { CodeTabs } from '@/components/code/CodeTabs' +export { Mermaid } from 'mdx-mermaid/Mermaid' + // see if we need to remove these diff --git a/src/mdx/remark.mjs b/src/mdx/remark.mjs index e523464b4..b366a6000 100644 --- a/src/mdx/remark.mjs +++ b/src/mdx/remark.mjs @@ -1,4 +1,25 @@ import { mdxAnnotations } from 'mdx-annotations' import remarkGfm from 'remark-gfm' +import mdxMermaid from 'mdx-mermaid' -export const remarkPlugins = [mdxAnnotations.remark, remarkGfm] +export const remarkPlugins = [ + mdxAnnotations.remark, + remarkGfm, + [ + mdxMermaid, + { + output: 'svg', + mermaid: { + theme: 'base', + themeVariables: { + primaryColor: '#ff0000', + secondaryColor: '#00ff00', + tertiaryColor: '#0000ff', + textColor: '#000000', + fontSize: '14px', + fontFamily: 'Fira Code, monospace', + }, + }, + }, + ], +] diff --git a/yarn.lock b/yarn.lock index ad0c6569f..a702138e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -175,6 +175,33 @@ resolved "https://registry.yarnpkg.com/@alloc/quick-lru/-/quick-lru-5.2.0.tgz#7bf68b20c0a350f936915fcae06f58e32007ce30" integrity sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw== +"@antfu/install-pkg@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@antfu/install-pkg/-/install-pkg-0.4.1.tgz#d1d7f3be96ecdb41581629cafe8626d1748c0cf1" + integrity sha512-T7yB5QNG29afhWVkVq7XeIMBa5U/vs9mX69YqayXypPRmYzUmzwnYltplHmPtZ4HPCn+sQKeXW8I47wCbuBOjw== + dependencies: + package-manager-detector "^0.2.0" + tinyexec "^0.3.0" + +"@antfu/utils@^0.7.10": + version "0.7.10" + resolved "https://registry.yarnpkg.com/@antfu/utils/-/utils-0.7.10.tgz#ae829f170158e297a9b6a28f161a8e487d00814d" + integrity sha512-+562v9k4aI80m1+VuMHehNJWLOFjBnXn3tdOitzD0il5b7smkSBal4+a3oKiQTbrwMmN/TBUMDvbdoWDehgOww== + +"@babel/code-frame@^7.0.0": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" + integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== + dependencies: + "@babel/helper-validator-identifier" "^7.25.9" + js-tokens "^4.0.0" + picocolors "^1.0.0" + +"@babel/helper-validator-identifier@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" + integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== + "@babel/runtime@^7.23.2": version "7.25.6" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.6.tgz#9afc3289f7184d8d7f98b099884c26317b9264d2" @@ -182,6 +209,43 @@ dependencies: regenerator-runtime "^0.14.0" +"@braintree/sanitize-url@^7.0.1": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-7.1.0.tgz#048e48aab4f1460e3121e22aa62459d16653dc85" + integrity sha512-o+UlMLt49RvtCASlOMW0AkHnabN9wR9rwCCherxO0yG4Npy34GkvrAqdXQvrhNs+jh+gkK8gB8Lf05qL/O7KWg== + +"@chevrotain/cst-dts-gen@11.0.3": + version "11.0.3" + resolved "https://registry.yarnpkg.com/@chevrotain/cst-dts-gen/-/cst-dts-gen-11.0.3.tgz#5e0863cc57dc45e204ccfee6303225d15d9d4783" + integrity sha512-BvIKpRLeS/8UbfxXxgC33xOumsacaeCKAjAeLyOn7Pcp95HiRbrpl14S+9vaZLolnbssPIUuiUd8IvgkRyt6NQ== + dependencies: + "@chevrotain/gast" "11.0.3" + "@chevrotain/types" "11.0.3" + lodash-es "4.17.21" + +"@chevrotain/gast@11.0.3": + version "11.0.3" + resolved "https://registry.yarnpkg.com/@chevrotain/gast/-/gast-11.0.3.tgz#e84d8880323fe8cbe792ef69ce3ffd43a936e818" + integrity sha512-+qNfcoNk70PyS/uxmj3li5NiECO+2YKZZQMbmjTqRI3Qchu8Hig/Q9vgkHpI3alNjr7M+a2St5pw5w5F6NL5/Q== + dependencies: + "@chevrotain/types" "11.0.3" + lodash-es "4.17.21" + +"@chevrotain/regexp-to-ast@11.0.3": + version "11.0.3" + resolved "https://registry.yarnpkg.com/@chevrotain/regexp-to-ast/-/regexp-to-ast-11.0.3.tgz#11429a81c74a8e6a829271ce02fc66166d56dcdb" + integrity sha512-1fMHaBZxLFvWI067AVbGJav1eRY7N8DDvYCTwGBiE/ytKBgP8azTdgyrKyWZ9Mfh09eHWb5PgTSO8wi7U824RA== + +"@chevrotain/types@11.0.3": + version "11.0.3" + resolved "https://registry.yarnpkg.com/@chevrotain/types/-/types-11.0.3.tgz#f8a03914f7b937f594f56eb89312b3b8f1c91848" + integrity sha512-gsiM3G8b58kZC2HaWR50gu6Y1440cHiJ+i3JUvcp/35JchYejb2+5MVeJK0iKThYpAa/P2PYFV4hoi44HD+aHQ== + +"@chevrotain/utils@11.0.3": + version "11.0.3" + resolved "https://registry.yarnpkg.com/@chevrotain/utils/-/utils-11.0.3.tgz#e39999307b102cff3645ec4f5b3665f5297a2224" + integrity sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ== + "@code-hike/lighter@1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@code-hike/lighter/-/lighter-1.0.0.tgz#05ab87127a060f325fff8ef61748bad19ac6cd30" @@ -630,6 +694,25 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== +"@iconify/types@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@iconify/types/-/types-2.0.0.tgz#ab0e9ea681d6c8a1214f30cd741fe3a20cc57f57" + integrity sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg== + +"@iconify/utils@^2.1.32": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@iconify/utils/-/utils-2.2.1.tgz#635b9bd8fd3e5e53742471bc0b5291f1570dda41" + integrity sha512-0/7J7hk4PqXmxo5PDBDxmnecw5PxklZJfNjIVG9FM0mEfVrvfudS22rYWsqVk6gR3UJ/mSYS90X4R3znXnqfNA== + dependencies: + "@antfu/install-pkg" "^0.4.1" + "@antfu/utils" "^0.7.10" + "@iconify/types" "^2.0.0" + debug "^4.4.0" + globals "^15.13.0" + kolorist "^1.8.0" + local-pkg "^0.5.1" + mlly "^1.7.3" + "@img/sharp-darwin-arm64@0.33.1": version "0.33.1" resolved "https://registry.yarnpkg.com/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.1.tgz#9d3cb0e4899b10b003608a018877b45b6db02861" @@ -874,6 +957,13 @@ dependencies: "@types/mdx" "^2.0.0" +"@mermaid-js/parser@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@mermaid-js/parser/-/parser-0.3.0.tgz#7a28714599f692f93df130b299fa1aadc9f9c8ab" + integrity sha512-HsvL6zgE5sUPGgkIDlmAWR1HTNHz2Iy11BAWPTa4Jjabkpguy4Ze2gzfLrg6pdRuBvFwgUYyxiaNqZwrEEXepA== + dependencies: + langium "3.0.0" + "@next/env@14.2.24": version "14.2.24" resolved "https://registry.yarnpkg.com/@next/env/-/env-14.2.24.tgz#49274c9ccbbb9d314d4a414a4ff2717756105ebc" @@ -1222,6 +1312,20 @@ resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== +"@puppeteer/browsers@2.3.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@puppeteer/browsers/-/browsers-2.3.0.tgz#791ea7d80450fea24eb19fb1d70c367ad4e08cae" + integrity sha512-ioXoq9gPxkss4MYhD+SFaU9p1IHFUX0ILAWFPyjGaBdjLsYAlZw6j1iLA0N/m12uVHLFDfSYNF7EQccjinIMDA== + dependencies: + debug "^4.3.5" + extract-zip "^2.0.1" + progress "^2.0.3" + proxy-agent "^6.4.0" + semver "^7.6.3" + tar-fs "^3.0.6" + unbzip2-stream "^1.4.3" + yargs "^17.7.2" + "@radix-ui/number@1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@radix-ui/number/-/number-1.1.0.tgz#1e95610461a09cdf8bb05c152e76ca1278d5da46" @@ -1719,6 +1823,11 @@ resolved "https://registry.yarnpkg.com/@tanstack/virtual-core/-/virtual-core-3.10.8.tgz#975446a667755222f62884c19e5c3c66d959b8b4" integrity sha512-PBu00mtt95jbKFi6Llk9aik8bnR3tR/oQP1o3TSi+iG//+Q2RTIzCEgKkHG8BB86kxMNW6O8wku+Lmi+QFR6jA== +"@tootallnate/quickjs-emscripten@^0.23.0": + version "0.23.0" + resolved "https://registry.yarnpkg.com/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz#db4ecfd499a9765ab24002c3b696d02e6d32a12c" + integrity sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA== + "@types/acorn@^4.0.0": version "4.0.6" resolved "https://registry.yarnpkg.com/@types/acorn/-/acorn-4.0.6.tgz#d61ca5480300ac41a7d973dd5b84d0a591154a22" @@ -1726,6 +1835,216 @@ dependencies: "@types/estree" "*" +"@types/d3-array@*": + version "3.2.1" + resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-3.2.1.tgz#1f6658e3d2006c4fceac53fde464166859f8b8c5" + integrity sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg== + +"@types/d3-axis@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-axis/-/d3-axis-3.0.6.tgz#e760e5765b8188b1defa32bc8bb6062f81e4c795" + integrity sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw== + dependencies: + "@types/d3-selection" "*" + +"@types/d3-brush@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-brush/-/d3-brush-3.0.6.tgz#c2f4362b045d472e1b186cdbec329ba52bdaee6c" + integrity sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A== + dependencies: + "@types/d3-selection" "*" + +"@types/d3-chord@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-chord/-/d3-chord-3.0.6.tgz#1706ca40cf7ea59a0add8f4456efff8f8775793d" + integrity sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg== + +"@types/d3-color@*": + version "3.1.3" + resolved "https://registry.yarnpkg.com/@types/d3-color/-/d3-color-3.1.3.tgz#368c961a18de721da8200e80bf3943fb53136af2" + integrity sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A== + +"@types/d3-contour@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-contour/-/d3-contour-3.0.6.tgz#9ada3fa9c4d00e3a5093fed0356c7ab929604231" + integrity sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg== + dependencies: + "@types/d3-array" "*" + "@types/geojson" "*" + +"@types/d3-delaunay@*": + version "6.0.4" + resolved "https://registry.yarnpkg.com/@types/d3-delaunay/-/d3-delaunay-6.0.4.tgz#185c1a80cc807fdda2a3fe960f7c11c4a27952e1" + integrity sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw== + +"@types/d3-dispatch@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-dispatch/-/d3-dispatch-3.0.6.tgz#096efdf55eb97480e3f5621ff9a8da552f0961e7" + integrity sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ== + +"@types/d3-drag@*": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@types/d3-drag/-/d3-drag-3.0.7.tgz#b13aba8b2442b4068c9a9e6d1d82f8bcea77fc02" + integrity sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ== + dependencies: + "@types/d3-selection" "*" + +"@types/d3-dsv@*": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@types/d3-dsv/-/d3-dsv-3.0.7.tgz#0a351f996dc99b37f4fa58b492c2d1c04e3dac17" + integrity sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g== + +"@types/d3-ease@*": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/d3-ease/-/d3-ease-3.0.2.tgz#e28db1bfbfa617076f7770dd1d9a48eaa3b6c51b" + integrity sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA== + +"@types/d3-fetch@*": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@types/d3-fetch/-/d3-fetch-3.0.7.tgz#c04a2b4f23181aa376f30af0283dbc7b3b569980" + integrity sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA== + dependencies: + "@types/d3-dsv" "*" + +"@types/d3-force@*": + version "3.0.10" + resolved "https://registry.yarnpkg.com/@types/d3-force/-/d3-force-3.0.10.tgz#6dc8fc6e1f35704f3b057090beeeb7ac674bff1a" + integrity sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw== + +"@types/d3-format@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/d3-format/-/d3-format-3.0.4.tgz#b1e4465644ddb3fdf3a263febb240a6cd616de90" + integrity sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g== + +"@types/d3-geo@*": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@types/d3-geo/-/d3-geo-3.1.0.tgz#b9e56a079449174f0a2c8684a9a4df3f60522440" + integrity sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ== + dependencies: + "@types/geojson" "*" + +"@types/d3-hierarchy@*": + version "3.1.7" + resolved "https://registry.yarnpkg.com/@types/d3-hierarchy/-/d3-hierarchy-3.1.7.tgz#6023fb3b2d463229f2d680f9ac4b47466f71f17b" + integrity sha512-tJFtNoYBtRtkNysX1Xq4sxtjK8YgoWUNpIiUee0/jHGRwqvzYxkq0hGVbbOGSz+JgFxxRu4K8nb3YpG3CMARtg== + +"@types/d3-interpolate@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz#412b90e84870285f2ff8a846c6eb60344f12a41c" + integrity sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA== + dependencies: + "@types/d3-color" "*" + +"@types/d3-path@*": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-3.1.0.tgz#2b907adce762a78e98828f0b438eaca339ae410a" + integrity sha512-P2dlU/q51fkOc/Gfl3Ul9kicV7l+ra934qBFXCFhrZMOL6du1TM0pm1ThYvENukyOn5h9v+yMJ9Fn5JK4QozrQ== + +"@types/d3-polygon@*": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/d3-polygon/-/d3-polygon-3.0.2.tgz#dfae54a6d35d19e76ac9565bcb32a8e54693189c" + integrity sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA== + +"@types/d3-quadtree@*": + version "3.0.6" + resolved "https://registry.yarnpkg.com/@types/d3-quadtree/-/d3-quadtree-3.0.6.tgz#d4740b0fe35b1c58b66e1488f4e7ed02952f570f" + integrity sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg== + +"@types/d3-random@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/d3-random/-/d3-random-3.0.3.tgz#ed995c71ecb15e0cd31e22d9d5d23942e3300cfb" + integrity sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ== + +"@types/d3-scale-chromatic@*": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz#dc6d4f9a98376f18ea50bad6c39537f1b5463c39" + integrity sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ== + +"@types/d3-scale@*": + version "4.0.8" + resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-4.0.8.tgz#d409b5f9dcf63074464bf8ddfb8ee5a1f95945bb" + integrity sha512-gkK1VVTr5iNiYJ7vWDI+yUFFlszhNMtVeneJ6lUTKPjprsvLLI9/tgEGiXJOnlINJA8FyA88gfnQsHbybVZrYQ== + dependencies: + "@types/d3-time" "*" + +"@types/d3-selection@*": + version "3.0.11" + resolved "https://registry.yarnpkg.com/@types/d3-selection/-/d3-selection-3.0.11.tgz#bd7a45fc0a8c3167a631675e61bc2ca2b058d4a3" + integrity sha512-bhAXu23DJWsrI45xafYpkQ4NtcKMwWnAC/vKrd2l+nxMFuvOT3XMYTIj2opv8vq8AO5Yh7Qac/nSeP/3zjTK0w== + +"@types/d3-shape@*": + version "3.1.6" + resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-3.1.6.tgz#65d40d5a548f0a023821773e39012805e6e31a72" + integrity sha512-5KKk5aKGu2I+O6SONMYSNflgiP0WfZIQvVUMan50wHsLG1G94JlxEVnCpQARfTtzytuY0p/9PXXZb3I7giofIA== + dependencies: + "@types/d3-path" "*" + +"@types/d3-time-format@*": + version "4.0.3" + resolved "https://registry.yarnpkg.com/@types/d3-time-format/-/d3-time-format-4.0.3.tgz#d6bc1e6b6a7db69cccfbbdd4c34b70632d9e9db2" + integrity sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg== + +"@types/d3-time@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-3.0.4.tgz#8472feecd639691450dd8000eb33edd444e1323f" + integrity sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g== + +"@types/d3-timer@*": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/d3-timer/-/d3-timer-3.0.2.tgz#70bbda77dc23aa727413e22e214afa3f0e852f70" + integrity sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw== + +"@types/d3-transition@*": + version "3.0.9" + resolved "https://registry.yarnpkg.com/@types/d3-transition/-/d3-transition-3.0.9.tgz#1136bc57e9ddb3c390dccc9b5ff3b7d2b8d94706" + integrity sha512-uZS5shfxzO3rGlu0cC3bjmMFKsXv+SmZZcgp0KD22ts4uGXp5EVYGzu/0YdwZeKmddhcAccYtREJKkPfXkZuCg== + dependencies: + "@types/d3-selection" "*" + +"@types/d3-zoom@*": + version "3.0.8" + resolved "https://registry.yarnpkg.com/@types/d3-zoom/-/d3-zoom-3.0.8.tgz#dccb32d1c56b1e1c6e0f1180d994896f038bc40b" + integrity sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw== + dependencies: + "@types/d3-interpolate" "*" + "@types/d3-selection" "*" + +"@types/d3@^7.4.3": + version "7.4.3" + resolved "https://registry.yarnpkg.com/@types/d3/-/d3-7.4.3.tgz#d4550a85d08f4978faf0a4c36b848c61eaac07e2" + integrity sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww== + dependencies: + "@types/d3-array" "*" + "@types/d3-axis" "*" + "@types/d3-brush" "*" + "@types/d3-chord" "*" + "@types/d3-color" "*" + "@types/d3-contour" "*" + "@types/d3-delaunay" "*" + "@types/d3-dispatch" "*" + "@types/d3-drag" "*" + "@types/d3-dsv" "*" + "@types/d3-ease" "*" + "@types/d3-fetch" "*" + "@types/d3-force" "*" + "@types/d3-format" "*" + "@types/d3-geo" "*" + "@types/d3-hierarchy" "*" + "@types/d3-interpolate" "*" + "@types/d3-path" "*" + "@types/d3-polygon" "*" + "@types/d3-quadtree" "*" + "@types/d3-random" "*" + "@types/d3-scale" "*" + "@types/d3-scale-chromatic" "*" + "@types/d3-selection" "*" + "@types/d3-shape" "*" + "@types/d3-time" "*" + "@types/d3-time-format" "*" + "@types/d3-timer" "*" + "@types/d3-transition" "*" + "@types/d3-zoom" "*" + "@types/debug@^4.0.0": version "4.1.12" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" @@ -1745,6 +2064,18 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== +"@types/geojson@*": + version "7946.0.15" + resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.15.tgz#f9d55fd5a0aa2de9dc80b1b04e437538b7298868" + integrity sha512-9oSxFzDCT2Rj6DfcHF8G++jxBKS7mBqXl5xrRW+Kbvjry6Uduya2iiwqHPhVXpasAVMBYKkEPGgKhd3+/HZ6xA== + +"@types/hast@^2.0.0": + version "2.3.10" + resolved "https://registry.yarnpkg.com/@types/hast/-/hast-2.3.10.tgz#5c9d9e0b304bbb8879b857225c5ebab2d81d7643" + integrity sha512-McWspRw8xx8J9HurkVBfYj0xKoE25tOFlHGdx4MJ5xORQrMGZNqJhVQWaIbm6Oyla5kYOXtDiopzKRJzEOkwJw== + dependencies: + "@types/unist" "^2" + "@types/hast@^3.0.0": version "3.0.4" resolved "https://registry.yarnpkg.com/@types/hast/-/hast-3.0.4.tgz#1d6b39993b82cea6ad783945b0508c25903e15aa" @@ -1844,6 +2175,11 @@ resolved "https://registry.yarnpkg.com/@types/sizzle/-/sizzle-2.3.8.tgz#518609aefb797da19bf222feb199e8f653ff7627" integrity sha512-0vWLNK2D5MT9dg0iOo8GlKguPAU02QjmZitPEsXRuJXU/OGIOt9vT9Fc26wtYuavLxtO45v9PGleoL9Z0k1LHg== +"@types/trusted-types@^2.0.7": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.7.tgz#baccb07a970b91707df3a3e8ba6896c57ead2d11" + integrity sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw== + "@types/unist@*", "@types/unist@^3.0.0": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/unist/-/unist-3.0.3.tgz#acaab0f919ce69cce629c2d4ed2eb4adc1b6c20c" @@ -1957,6 +2293,16 @@ acorn@^8.0.0, acorn@^8.8.1, acorn@^8.9.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== +acorn@^8.14.0: + version "8.14.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" + integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== + +agent-base@^7.1.0, agent-base@^7.1.2: + version "7.1.3" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.3.tgz#29435eb821bc4194633a5b89e5bc4703bafc25a1" + integrity sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw== + aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -2231,6 +2577,13 @@ ast-types-flow@^0.0.8: resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.8.tgz#0a85e1c92695769ac13a428bb653e7538bea27d6" integrity sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ== +ast-types@^0.13.4: + version "0.13.4" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.13.4.tgz#ee0d77b343263965ecc3fb62da16e7222b2b6782" + integrity sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w== + dependencies: + tslib "^2.0.1" + astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" @@ -2295,6 +2648,11 @@ axobject-query@^4.1.0: resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-4.1.0.tgz#28768c76d0e3cff21bc62a9e2d0b6ac30042a1ee" integrity sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ== +b4a@^1.6.4: + version "1.6.7" + resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.6.7.tgz#a99587d4ebbfbd5a6e3b21bdb5d5fa385767abe4" + integrity sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg== + bail@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/bail/-/bail-2.0.2.tgz#d26f5cd8fe5d6f832a31517b9f7c356040ba6d5d" @@ -2305,11 +2663,49 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +bare-events@^2.0.0, bare-events@^2.2.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/bare-events/-/bare-events-2.5.0.tgz#305b511e262ffd8b9d5616b056464f8e1b3329cc" + integrity sha512-/E8dDe9dsbLyh2qrZ64PEPadOQ0F4gbl1sUJOrmph7xOiIxfY8vwab/4bFLh4Y88/Hk/ujKcrQKc+ps0mv873A== + +bare-fs@^2.1.1: + version "2.3.5" + resolved "https://registry.yarnpkg.com/bare-fs/-/bare-fs-2.3.5.tgz#05daa8e8206aeb46d13c2fe25a2cd3797b0d284a" + integrity sha512-SlE9eTxifPDJrT6YgemQ1WGFleevzwY+XAP1Xqgl56HtcrisC2CHCZ2tq6dBpcH2TnNxwUEUGhweo+lrQtYuiw== + dependencies: + bare-events "^2.0.0" + bare-path "^2.0.0" + bare-stream "^2.0.0" + +bare-os@^2.1.0: + version "2.4.4" + resolved "https://registry.yarnpkg.com/bare-os/-/bare-os-2.4.4.tgz#01243392eb0a6e947177bb7c8a45123d45c9b1a9" + integrity sha512-z3UiI2yi1mK0sXeRdc4O1Kk8aOa/e+FNWZcTiPB/dfTWyLypuE99LibgRaQki914Jq//yAWylcAt+mknKdixRQ== + +bare-path@^2.0.0, bare-path@^2.1.0: + version "2.1.3" + resolved "https://registry.yarnpkg.com/bare-path/-/bare-path-2.1.3.tgz#594104c829ef660e43b5589ec8daef7df6cedb3e" + integrity sha512-lh/eITfU8hrj9Ru5quUp0Io1kJWIk1bTjzo7JH1P5dWmQ2EL4hFUlfI8FonAhSlgIfhn63p84CDY/x+PisgcXA== + dependencies: + bare-os "^2.1.0" + +bare-stream@^2.0.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/bare-stream/-/bare-stream-2.6.1.tgz#b3b9874fab05b662c9aea2706a12fb0698c46836" + integrity sha512-eVZbtKM+4uehzrsj49KtCy3Pbg7kO1pJ3SKZ1SFrIH/0pnj9scuGGgUlNDf/7qS8WKtGdiJY5Kyhs/ivYPTB/g== + dependencies: + streamx "^2.21.0" + base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== +basic-ftp@^5.0.2: + version "5.0.5" + resolved "https://registry.yarnpkg.com/basic-ftp/-/basic-ftp-5.0.5.tgz#14a474f5fffecca1f4f406f1c26b18f800225ac0" + integrity sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg== + bcrypt-pbkdf@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" @@ -2379,7 +2775,7 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer@^5.7.1: +buffer@^5.2.1, buffer@^5.7.1: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -2490,6 +2886,25 @@ check-more-types@^2.24.0: resolved "https://registry.yarnpkg.com/check-more-types/-/check-more-types-2.24.0.tgz#1420ffb10fd444dcfc79b43891bbfffd32a84600" integrity sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA== +chevrotain-allstar@~0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/chevrotain-allstar/-/chevrotain-allstar-0.3.1.tgz#b7412755f5d83cc139ab65810cdb00d8db40e6ca" + integrity sha512-b7g+y9A0v4mxCW1qUhf3BSVPg+/NvGErk/dOkrDaHA0nQIQGAtrOjlX//9OQtRlSCy+x9rfB5N8yC71lH1nvMw== + dependencies: + lodash-es "^4.17.21" + +chevrotain@~11.0.3: + version "11.0.3" + resolved "https://registry.yarnpkg.com/chevrotain/-/chevrotain-11.0.3.tgz#88ffc1fb4b5739c715807eaeedbbf200e202fc1b" + integrity sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw== + dependencies: + "@chevrotain/cst-dts-gen" "11.0.3" + "@chevrotain/gast" "11.0.3" + "@chevrotain/regexp-to-ast" "11.0.3" + "@chevrotain/types" "11.0.3" + "@chevrotain/utils" "11.0.3" + lodash-es "4.17.21" + chokidar@^3.5.3: version "3.6.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" @@ -2505,6 +2920,15 @@ chokidar@^3.5.3: optionalDependencies: fsevents "~2.3.2" +chromium-bidi@0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/chromium-bidi/-/chromium-bidi-0.6.3.tgz#363fe1ca6b9c6122b9f1b2a47f9449ecf712f755" + integrity sha512-qXlsCmpCZJAnoTYI83Iu6EdYQpMYdVkCfq08KDh2pmlVqK5t5IA9mGs4/LwCwp4fqisSOMXZxP3HIh8w8aRn0A== + dependencies: + mitt "3.0.1" + urlpattern-polyfill "10.0.0" + zod "3.23.8" + ci-info@^3.2.0: version "3.9.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" @@ -2685,6 +3109,11 @@ command-line-usage@^5.0.4: table-layout "^0.4.3" typical "^2.6.1" +commander@7: + version "7.2.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" + integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== + commander@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" @@ -2695,6 +3124,11 @@ commander@^6.2.1: resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== +commander@^8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + commander@~12.1.0: version "12.1.0" resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" @@ -2721,6 +3155,11 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +confbox@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/confbox/-/confbox-0.1.8.tgz#820d73d3b3c82d9bd910652c5d4d599ef8ff8b06" + integrity sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w== + contentlayer2@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/contentlayer2/-/contentlayer2-0.5.1.tgz#8ba3fa560adfa3d07a09ba7d13495e65c779b11b" @@ -2743,6 +3182,30 @@ core-util-is@^1.0.3: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== +cose-base@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/cose-base/-/cose-base-1.0.3.tgz#650334b41b869578a543358b80cda7e0abe0a60a" + integrity sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg== + dependencies: + layout-base "^1.0.0" + +cose-base@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cose-base/-/cose-base-2.2.0.tgz#1c395c35b6e10bb83f9769ca8b817d614add5c01" + integrity sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g== + dependencies: + layout-base "^2.0.0" + +cosmiconfig@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-9.0.0.tgz#34c3fc58287b915f3ae905ab6dc3de258b55ad9d" + integrity sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg== + dependencies: + env-paths "^2.2.1" + import-fresh "^3.3.0" + js-yaml "^4.1.0" + parse-json "^5.2.0" + cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -2815,6 +3278,304 @@ cypress@^13.15.0: untildify "^4.0.0" yauzl "^2.10.0" +cytoscape-cose-bilkent@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cytoscape-cose-bilkent/-/cytoscape-cose-bilkent-4.1.0.tgz#762fa121df9930ffeb51a495d87917c570ac209b" + integrity sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ== + dependencies: + cose-base "^1.0.0" + +cytoscape-fcose@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cytoscape-fcose/-/cytoscape-fcose-2.2.0.tgz#e4d6f6490df4fab58ae9cea9e5c3ab8d7472f471" + integrity sha512-ki1/VuRIHFCzxWNrsshHYPs6L7TvLu3DL+TyIGEsRcvVERmxokbf5Gdk7mFxZnTdiGtnA4cfSmjZJMviqSuZrQ== + dependencies: + cose-base "^2.2.0" + +cytoscape@^3.29.2: + version "3.30.4" + resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.30.4.tgz#3404da0a159c00a1a3df2c85b2b43fdc66a0e28e" + integrity sha512-OxtlZwQl1WbwMmLiyPSEBuzeTIQnwZhJYYWFzZ2PhEHVFwpeaqNIkUzSiso00D98qk60l8Gwon2RP304d3BJ1A== + +"d3-array@1 - 2": + version "2.12.1" + resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-2.12.1.tgz#e20b41aafcdffdf5d50928004ececf815a465e81" + integrity sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ== + dependencies: + internmap "^1.0.0" + +"d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3, d3-array@^3.2.0: + version "3.2.4" + resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.2.4.tgz#15fec33b237f97ac5d7c986dc77da273a8ed0bb5" + integrity sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg== + dependencies: + internmap "1 - 2" + +d3-axis@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-axis/-/d3-axis-3.0.0.tgz#c42a4a13e8131d637b745fc2973824cfeaf93322" + integrity sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw== + +d3-brush@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-brush/-/d3-brush-3.0.0.tgz#6f767c4ed8dcb79de7ede3e1c0f89e63ef64d31c" + integrity sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ== + dependencies: + d3-dispatch "1 - 3" + d3-drag "2 - 3" + d3-interpolate "1 - 3" + d3-selection "3" + d3-transition "3" + +d3-chord@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-chord/-/d3-chord-3.0.1.tgz#d156d61f485fce8327e6abf339cb41d8cbba6966" + integrity sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g== + dependencies: + d3-path "1 - 3" + +"d3-color@1 - 3", d3-color@3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-3.1.0.tgz#395b2833dfac71507f12ac2f7af23bf819de24e2" + integrity sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA== + +d3-contour@4: + version "4.0.2" + resolved "https://registry.yarnpkg.com/d3-contour/-/d3-contour-4.0.2.tgz#bb92063bc8c5663acb2422f99c73cbb6c6ae3bcc" + integrity sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA== + dependencies: + d3-array "^3.2.0" + +d3-delaunay@6: + version "6.0.4" + resolved "https://registry.yarnpkg.com/d3-delaunay/-/d3-delaunay-6.0.4.tgz#98169038733a0a5babbeda55054f795bb9e4a58b" + integrity sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A== + dependencies: + delaunator "5" + +"d3-dispatch@1 - 3", d3-dispatch@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-3.0.1.tgz#5fc75284e9c2375c36c839411a0cf550cbfc4d5e" + integrity sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg== + +"d3-drag@2 - 3", d3-drag@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-drag/-/d3-drag-3.0.0.tgz#994aae9cd23c719f53b5e10e3a0a6108c69607ba" + integrity sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg== + dependencies: + d3-dispatch "1 - 3" + d3-selection "3" + +"d3-dsv@1 - 3", d3-dsv@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-3.0.1.tgz#c63af978f4d6a0d084a52a673922be2160789b73" + integrity sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q== + dependencies: + commander "7" + iconv-lite "0.6" + rw "1" + +"d3-ease@1 - 3", d3-ease@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-ease/-/d3-ease-3.0.1.tgz#9658ac38a2140d59d346160f1f6c30fda0bd12f4" + integrity sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w== + +d3-fetch@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-fetch/-/d3-fetch-3.0.1.tgz#83141bff9856a0edb5e38de89cdcfe63d0a60a22" + integrity sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw== + dependencies: + d3-dsv "1 - 3" + +d3-force@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-force/-/d3-force-3.0.0.tgz#3e2ba1a61e70888fe3d9194e30d6d14eece155c4" + integrity sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg== + dependencies: + d3-dispatch "1 - 3" + d3-quadtree "1 - 3" + d3-timer "1 - 3" + +"d3-format@1 - 3", d3-format@3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-3.1.0.tgz#9260e23a28ea5cb109e93b21a06e24e2ebd55641" + integrity sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA== + +d3-geo@3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-3.1.1.tgz#6027cf51246f9b2ebd64f99e01dc7c3364033a4d" + integrity sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q== + dependencies: + d3-array "2.5.0 - 3" + +d3-hierarchy@3: + version "3.1.2" + resolved "https://registry.yarnpkg.com/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz#b01cd42c1eed3d46db77a5966cf726f8c09160c6" + integrity sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA== + +"d3-interpolate@1 - 3", "d3-interpolate@1.2.0 - 3", d3-interpolate@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-3.0.1.tgz#3c47aa5b32c5b3dfb56ef3fd4342078a632b400d" + integrity sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g== + dependencies: + d3-color "1 - 3" + +d3-path@1: + version "1.0.9" + resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.9.tgz#48c050bb1fe8c262493a8caf5524e3e9591701cf" + integrity sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg== + +"d3-path@1 - 3", d3-path@3, d3-path@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-3.1.0.tgz#22df939032fb5a71ae8b1800d61ddb7851c42526" + integrity sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ== + +d3-polygon@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-polygon/-/d3-polygon-3.0.1.tgz#0b45d3dd1c48a29c8e057e6135693ec80bf16398" + integrity sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg== + +"d3-quadtree@1 - 3", d3-quadtree@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-3.0.1.tgz#6dca3e8be2b393c9a9d514dabbd80a92deef1a4f" + integrity sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw== + +d3-random@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-3.0.1.tgz#d4926378d333d9c0bfd1e6fa0194d30aebaa20f4" + integrity sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ== + +d3-sankey@^0.12.3: + version "0.12.3" + resolved "https://registry.yarnpkg.com/d3-sankey/-/d3-sankey-0.12.3.tgz#b3c268627bd72e5d80336e8de6acbfec9d15d01d" + integrity sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ== + dependencies: + d3-array "1 - 2" + d3-shape "^1.2.0" + +d3-scale-chromatic@3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz#34c39da298b23c20e02f1a4b239bd0f22e7f1314" + integrity sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ== + dependencies: + d3-color "1 - 3" + d3-interpolate "1 - 3" + +d3-scale@4: + version "4.0.2" + resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-4.0.2.tgz#82b38e8e8ff7080764f8dcec77bd4be393689396" + integrity sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ== + dependencies: + d3-array "2.10.0 - 3" + d3-format "1 - 3" + d3-interpolate "1.2.0 - 3" + d3-time "2.1.1 - 3" + d3-time-format "2 - 4" + +"d3-selection@2 - 3", d3-selection@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-3.0.0.tgz#c25338207efa72cc5b9bd1458a1a41901f1e1b31" + integrity sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ== + +d3-shape@3: + version "3.2.0" + resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-3.2.0.tgz#a1a839cbd9ba45f28674c69d7f855bcf91dfc6a5" + integrity sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA== + dependencies: + d3-path "^3.1.0" + +d3-shape@^1.2.0: + version "1.3.7" + resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-1.3.7.tgz#df63801be07bc986bc54f63789b4fe502992b5d7" + integrity sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw== + dependencies: + d3-path "1" + +"d3-time-format@2 - 4", d3-time-format@4: + version "4.1.0" + resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-4.1.0.tgz#7ab5257a5041d11ecb4fe70a5c7d16a195bb408a" + integrity sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg== + dependencies: + d3-time "1 - 3" + +"d3-time@1 - 3", "d3-time@2.1.1 - 3", d3-time@3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-3.1.0.tgz#9310db56e992e3c0175e1ef385e545e48a9bb5c7" + integrity sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q== + dependencies: + d3-array "2 - 3" + +"d3-timer@1 - 3", d3-timer@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-3.0.1.tgz#6284d2a2708285b1abb7e201eda4380af35e63b0" + integrity sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA== + +"d3-transition@2 - 3", d3-transition@3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/d3-transition/-/d3-transition-3.0.1.tgz#6869fdde1448868077fdd5989200cb61b2a1645f" + integrity sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w== + dependencies: + d3-color "1 - 3" + d3-dispatch "1 - 3" + d3-ease "1 - 3" + d3-interpolate "1 - 3" + d3-timer "1 - 3" + +d3-zoom@3: + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-zoom/-/d3-zoom-3.0.0.tgz#d13f4165c73217ffeaa54295cd6969b3e7aee8f3" + integrity sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw== + dependencies: + d3-dispatch "1 - 3" + d3-drag "2 - 3" + d3-interpolate "1 - 3" + d3-selection "2 - 3" + d3-transition "2 - 3" + +d3@^7.9.0: + version "7.9.0" + resolved "https://registry.yarnpkg.com/d3/-/d3-7.9.0.tgz#579e7acb3d749caf8860bd1741ae8d371070cd5d" + integrity sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA== + dependencies: + d3-array "3" + d3-axis "3" + d3-brush "3" + d3-chord "3" + d3-color "3" + d3-contour "4" + d3-delaunay "6" + d3-dispatch "3" + d3-drag "3" + d3-dsv "3" + d3-ease "3" + d3-fetch "3" + d3-force "3" + d3-format "3" + d3-geo "3" + d3-hierarchy "3" + d3-interpolate "3" + d3-path "3" + d3-polygon "3" + d3-quadtree "3" + d3-random "3" + d3-scale "4" + d3-scale-chromatic "3" + d3-selection "3" + d3-shape "3" + d3-time "3" + d3-time-format "4" + d3-timer "3" + d3-transition "3" + d3-zoom "3" + +dagre-d3-es@7.0.11: + version "7.0.11" + resolved "https://registry.yarnpkg.com/dagre-d3-es/-/dagre-d3-es-7.0.11.tgz#2237e726c0577bfe67d1a7cfd2265b9ab2c15c40" + integrity sha512-tvlJLyQf834SylNKax8Wkzco/1ias1OPw8DcUMDE7oUIoSEW25riQVuiu/0OWEFqT0cxHT3Pa9/D82Jr47IONw== + dependencies: + d3 "^7.9.0" + lodash-es "^4.17.21" + damerau-levenshtein@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7" @@ -2827,6 +3588,11 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +data-uri-to-buffer@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz#8a58bb67384b261a38ef18bea1810cb01badd28b" + integrity sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw== + data-view-buffer@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.1.tgz#8ea6326efec17a2e42620696e671d7d5a8bc66b2" @@ -2859,11 +3625,18 @@ date-format@4.0.3: resolved "https://registry.yarnpkg.com/date-format/-/date-format-4.0.3.tgz#f63de5dc08dc02efd8ef32bf2a6918e486f35873" integrity sha512-7P3FyqDcfeznLZp2b+OMitV9Sz2lUnsT87WaTat9nVwqsBkTzPG3lPLNwW3en6F4pHUiWzr6vb8CLhjdK9bcxQ== -dayjs@^1.10.4: +dayjs@^1.10.4, dayjs@^1.11.10: version "1.11.13" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.13.tgz#92430b0139055c3ebb60150aa13e860a4b5a366c" integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg== +debug@4, debug@^4.3.6, debug@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a" + integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== + dependencies: + ms "^2.1.3" + debug@^3.1.0, debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -2937,6 +3710,22 @@ define-properties@^1.1.3, define-properties@^1.2.0, define-properties@^1.2.1: has-property-descriptors "^1.0.0" object-keys "^1.1.1" +degenerator@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/degenerator/-/degenerator-5.0.1.tgz#9403bf297c6dad9a1ece409b37db27954f91f2f5" + integrity sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ== + dependencies: + ast-types "^0.13.4" + escodegen "^2.1.0" + esprima "^4.0.1" + +delaunator@5: + version "5.0.1" + resolved "https://registry.yarnpkg.com/delaunator/-/delaunator-5.0.1.tgz#39032b08053923e924d6094fe2cde1a99cc51278" + integrity sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw== + dependencies: + robust-predicates "^3.0.2" + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" @@ -2964,6 +3753,11 @@ devlop@^1.0.0, devlop@^1.1.0: dependencies: dequal "^2.0.0" +devtools-protocol@0.0.1312386: + version "0.0.1312386" + resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.1312386.tgz#5ab824d6f1669ec6c6eb0fba047e73601d969052" + integrity sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA== + dictionary-en-au@^2.3.0: version "2.4.0" resolved "https://registry.yarnpkg.com/dictionary-en-au/-/dictionary-en-au-2.4.0.tgz#6d7199c623bce7f9797f96aa89fbf79fd25d1f1f" @@ -3030,6 +3824,13 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dompurify@^3.2.1: + version "3.2.3" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.2.3.tgz#05dd2175225324daabfca6603055a09b2382a4cd" + integrity sha512-U1U5Hzc2MO0oW3DF+G9qYN0aT7atAou4AgI0XjWz061nyBPbdxkfdhfy5uMgGn6+oLFCfn44ZGbdDqCzVmlOWA== + optionalDependencies: + "@types/trusted-types" "^2.0.7" + eastasianwidth@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" @@ -3101,6 +3902,11 @@ entities@^4.4.0: resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== +env-paths@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" + integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== + environment@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/environment/-/environment-1.1.0.tgz#8e86c66b180f363c7ab311787e0259665f45a9f1" @@ -3294,6 +4100,17 @@ escape-string-regexp@^5.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8" integrity sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw== +escodegen@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" + integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== + dependencies: + esprima "^4.0.1" + estraverse "^5.2.0" + esutils "^2.0.2" + optionalDependencies: + source-map "~0.6.1" + eslint-config-next@^14.0.4: version "14.2.14" resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-14.2.14.tgz#b2b5dedadd4afe20e2103b0ec44eb2f1d211fc63" @@ -3505,6 +4322,13 @@ estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== +estree-util-attach-comments@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/estree-util-attach-comments/-/estree-util-attach-comments-2.1.1.tgz#ee44f4ff6890ee7dfb3237ac7810154c94c63f84" + integrity sha512-+5Ba/xGGS6mnwFbXIuQiDPTbuTxuMCooq3arVv7gPZtYpjp+VXH/NkHAP35OOefPhNG/UGqU3vt/LTABwcHX0w== + dependencies: + "@types/estree" "^1.0.0" + estree-util-attach-comments@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/estree-util-attach-comments/-/estree-util-attach-comments-3.0.0.tgz#344bde6a64c8a31d15231e5ee9e297566a691c2d" @@ -3522,11 +4346,25 @@ estree-util-build-jsx@^3.0.0: estree-util-is-identifier-name "^3.0.0" estree-walker "^3.0.0" +estree-util-is-identifier-name@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/estree-util-is-identifier-name/-/estree-util-is-identifier-name-2.1.0.tgz#fb70a432dcb19045e77b05c8e732f1364b4b49b2" + integrity sha512-bEN9VHRyXAUOjkKVQVvArFym08BTWB0aJPppZZr0UNyAqWsLaVfAqP7hbaTJjzHifmB5ebnR8Wm7r7yGN/HonQ== + estree-util-is-identifier-name@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz#0b5ef4c4ff13508b34dcd01ecfa945f61fce5dbd" integrity sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg== +estree-util-to-js@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/estree-util-to-js/-/estree-util-to-js-1.2.0.tgz#0f80d42443e3b13bd32f7012fffa6f93603f4a36" + integrity sha512-IzU74r1PK5IMMGZXUVZbmiu4A1uhiPgW5hm1GjcOfr4ZzHaMPpLNJjR7HjXiIOzi25nZDrgFTobHTkV5Q6ITjA== + dependencies: + "@types/estree-jsx" "^1.0.0" + astring "^1.8.0" + source-map "^0.7.0" + estree-util-to-js@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/estree-util-to-js/-/estree-util-to-js-2.0.0.tgz#10a6fb924814e6abb62becf0d2bc4dea51d04f17" @@ -3543,7 +4381,7 @@ estree-util-value-to-estree@^3.0.0: dependencies: "@types/estree" "^1.0.0" -estree-util-visit@^1.2.0: +estree-util-visit@^1.0.0, estree-util-visit@^1.2.0, estree-util-visit@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/estree-util-visit/-/estree-util-visit-1.2.1.tgz#8bc2bc09f25b00827294703835aabee1cc9ec69d" integrity sha512-xbgqcrkIVbIG+lI/gzbvd9SGTJL4zqJKBFttUl5pP27KhAjtMKbX/mQXJ7qgyXpMgVy/zvpm0xoQQaGL8OloOw== @@ -3630,7 +4468,7 @@ extend@^3.0.0, extend@~3.0.2: resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== -extract-zip@2.0.1: +extract-zip@2.0.1, extract-zip@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a" integrity sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg== @@ -3656,6 +4494,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-fifo@^1.2.0, fast-fifo@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" + integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== + fast-glob@^3.2.12, fast-glob@^3.2.9, fast-glob@^3.3.0, fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" @@ -3934,6 +4777,15 @@ get-tsconfig@^4.7.5: dependencies: resolve-pkg-maps "^1.0.0" +get-uri@^6.0.1: + version "6.0.4" + resolved "https://registry.yarnpkg.com/get-uri/-/get-uri-6.0.4.tgz#6daaee9e12f9759e19e55ba313956883ef50e0a7" + integrity sha512-E1b1lFFLvLgak2whF2xDBcOy6NLVGZBqqjJjsIhvopKfWWEi64pLVTWWehV8KlLerZkfNTA95sTe2OdJKm1OzQ== + dependencies: + basic-ftp "^5.0.2" + data-uri-to-buffer "^6.0.2" + debug "^4.3.4" + getos@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/getos/-/getos-3.2.1.tgz#0134d1f4e00eb46144c5a9c0ac4dc087cbb27dc5" @@ -4011,6 +4863,11 @@ globals@^13.19.0: dependencies: type-fest "^0.20.2" +globals@^15.13.0: + version "15.14.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-15.14.0.tgz#b8fd3a8941ff3b4d38f3319d433b61bbb482e73f" + integrity sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig== + globalthis@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236" @@ -4058,6 +4915,11 @@ gray-matter@^4.0.3: section-matter "^1.0.0" strip-bom-string "^1.0.0" +hachure-fill@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/hachure-fill/-/hachure-fill-0.5.2.tgz#d19bc4cc8750a5962b47fb1300557a85fcf934cc" + integrity sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg== + has-bigints@^1.0.1, has-bigints@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" @@ -4133,6 +4995,17 @@ hast-util-from-html-isomorphic@^2.0.0: hast-util-from-html "^2.0.0" unist-util-remove-position "^5.0.0" +hast-util-from-html@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/hast-util-from-html/-/hast-util-from-html-1.0.2.tgz#2482fd701b2d8270b912b3909d6fb645d4a346cf" + integrity sha512-LhrTA2gfCbLOGJq2u/asp4kwuG0y6NhWTXiPKP+n0qNukKy7hc10whqqCFfyvIA1Q5U5d0sp9HhNim9gglEH4A== + dependencies: + "@types/hast" "^2.0.0" + hast-util-from-parse5 "^7.0.0" + parse5 "^7.0.0" + vfile "^5.0.0" + vfile-message "^3.0.0" + hast-util-from-html@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/hast-util-from-html/-/hast-util-from-html-2.0.3.tgz#485c74785358beb80c4ba6346299311ac4c49c82" @@ -4145,6 +5018,19 @@ hast-util-from-html@^2.0.0: vfile "^6.0.0" vfile-message "^4.0.0" +hast-util-from-parse5@^7.0.0: + version "7.1.2" + resolved "https://registry.yarnpkg.com/hast-util-from-parse5/-/hast-util-from-parse5-7.1.2.tgz#aecfef73e3ceafdfa4550716443e4eb7b02e22b0" + integrity sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw== + dependencies: + "@types/hast" "^2.0.0" + "@types/unist" "^2.0.0" + hastscript "^7.0.0" + property-information "^6.0.0" + vfile "^5.0.0" + vfile-location "^4.0.0" + web-namespaces "^2.0.0" + hast-util-from-parse5@^8.0.0: version "8.0.1" resolved "https://registry.yarnpkg.com/hast-util-from-parse5/-/hast-util-from-parse5-8.0.1.tgz#654a5676a41211e14ee80d1b1758c399a0327651" @@ -4173,6 +5059,13 @@ hast-util-is-element@^3.0.0: dependencies: "@types/hast" "^3.0.0" +hast-util-parse-selector@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz#25ab00ae9e75cbc62cf7a901f68a247eade659e2" + integrity sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA== + dependencies: + "@types/hast" "^2.0.0" + hast-util-parse-selector@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz#352879fa86e25616036037dd8931fb5f34cb4a27" @@ -4180,6 +5073,27 @@ hast-util-parse-selector@^4.0.0: dependencies: "@types/hast" "^3.0.0" +hast-util-to-estree@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/hast-util-to-estree/-/hast-util-to-estree-2.3.3.tgz#da60142ffe19a6296923ec222aba73339c8bf470" + integrity sha512-ihhPIUPxN0v0w6M5+IiAZZrn0LH2uZomeWwhn7uP7avZC6TE7lIiEh2yBMPr5+zi1aUCXq6VoYRgs2Bw9xmycQ== + dependencies: + "@types/estree" "^1.0.0" + "@types/estree-jsx" "^1.0.0" + "@types/hast" "^2.0.0" + "@types/unist" "^2.0.0" + comma-separated-tokens "^2.0.0" + estree-util-attach-comments "^2.0.0" + estree-util-is-identifier-name "^2.0.0" + hast-util-whitespace "^2.0.0" + mdast-util-mdx-expression "^1.0.0" + mdast-util-mdxjs-esm "^1.0.0" + property-information "^6.0.0" + space-separated-tokens "^2.0.0" + style-to-object "^0.4.1" + unist-util-position "^4.0.0" + zwitch "^2.0.0" + hast-util-to-estree@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/hast-util-to-estree/-/hast-util-to-estree-3.1.0.tgz#f2afe5e869ddf0cf690c75f9fc699f3180b51b19" @@ -4240,6 +5154,11 @@ hast-util-to-jsx-runtime@^2.0.0: unist-util-position "^5.0.0" vfile-message "^4.0.0" +hast-util-whitespace@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz#0ec64e257e6fc216c7d14c8a1b74d27d650b4557" + integrity sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng== + hast-util-whitespace@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz#7778ed9d3c92dd9e8c5c8f648a49c21fc51cb621" @@ -4247,6 +5166,17 @@ hast-util-whitespace@^3.0.0: dependencies: "@types/hast" "^3.0.0" +hastscript@^7.0.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/hastscript/-/hastscript-7.2.0.tgz#0eafb7afb153d047077fa2a833dc9b7ec604d10b" + integrity sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw== + dependencies: + "@types/hast" "^2.0.0" + comma-separated-tokens "^2.0.0" + hast-util-parse-selector "^3.0.0" + property-information "^6.0.0" + space-separated-tokens "^2.0.0" + hastscript@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/hastscript/-/hastscript-8.0.0.tgz#4ef795ec8dee867101b9f23cc830d4baf4fd781a" @@ -4268,6 +5198,14 @@ html-void-elements@^3.0.0: resolved "https://registry.yarnpkg.com/html-void-elements/-/html-void-elements-3.0.0.tgz#fc9dbd84af9e747249034d4d62602def6517f1d7" integrity sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg== +http-proxy-agent@^7.0.0, http-proxy-agent@^7.0.1: + version "7.0.2" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz#9a8b1f246866c028509486585f62b8f2c18c270e" + integrity sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig== + dependencies: + agent-base "^7.1.0" + debug "^4.3.4" + http-signature@~1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.4.0.tgz#dee5a9ba2bf49416abc544abd6d967f6a94c8c3f" @@ -4277,6 +5215,14 @@ http-signature@~1.4.0: jsprim "^2.0.2" sshpk "^1.18.0" +https-proxy-agent@^7.0.6: + version "7.0.6" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz#da8dfeac7da130b05c2ba4b59c9b6cd66611a6b9" + integrity sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw== + dependencies: + agent-base "^7.1.2" + debug "4" + human-signals@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" @@ -4297,6 +5243,13 @@ hyperdyperid@^1.2.0: resolved "https://registry.yarnpkg.com/hyperdyperid/-/hyperdyperid-1.2.0.tgz#59668d323ada92228d2a869d3e474d5a33b69e6b" integrity sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A== +iconv-lite@0.6: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + ieee754@^1.1.13: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" @@ -4312,7 +5265,7 @@ imagescript@^1.2.16: resolved "https://registry.yarnpkg.com/imagescript/-/imagescript-1.3.0.tgz#4f7597ef318c5a95dff4c02956f78c506d399f18" integrity sha512-lCYzQrWzdnA68K03oMj/BUlBJrVBnslzDOgGFymAp49NmdGEJxGeN7sHh5mCva0nQkq+kkKSuru2zLf1m04+3A== -import-fresh@^3.2.1: +import-fresh@^3.2.1, import-fresh@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -4372,6 +5325,16 @@ internal-slot@^1.0.4, internal-slot@^1.0.7: hasown "^2.0.0" side-channel "^1.0.4" +"internmap@1 - 2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009" + integrity sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg== + +internmap@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/internmap/-/internmap-1.0.1.tgz#0017cc8a3b99605f0302f2b198d272e015e5df95" + integrity sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw== + invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -4379,6 +5342,14 @@ invariant@^2.2.4: dependencies: loose-envify "^1.0.0" +ip-address@^9.0.5: + version "9.0.5" + resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-9.0.5.tgz#117a960819b08780c3bd1f14ef3c1cc1d3f3ea5a" + integrity sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g== + dependencies: + jsbn "1.1.0" + sprintf-js "^1.1.3" + is-alphabetical@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-alphabetical/-/is-alphabetical-2.0.1.tgz#01072053ea7c1036df3c7d19a6daaec7f19e789b" @@ -4727,7 +5698,7 @@ jiti@^1.21.0: resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.6.tgz#6c7f7398dd4b3142767f9a168af2f317a428d268" integrity sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w== -"js-tokens@^3.0.0 || ^4.0.0": +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== @@ -4752,6 +5723,11 @@ jsbi@^4.3.0: resolved "https://registry.yarnpkg.com/jsbi/-/jsbi-4.3.0.tgz#b54ee074fb6fcbc00619559305c8f7e912b04741" integrity sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g== +jsbn@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040" + integrity sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A== + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -4767,6 +5743,11 @@ json-parse-better-errors@^1.0.1: resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -4857,6 +5838,13 @@ junit-report-builder@^3.0.1: make-dir "^3.1.0" xmlbuilder "^15.1.1" +katex@^0.16.9: + version "0.16.18" + resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.18.tgz#20781284288bc52805c519e48ac756163ad4b1f3" + integrity sha512-LRuk0rPdXrecAFwQucYjMiIs0JFefk6N1q/04mlw14aVIVgxq1FO0MA9RiIIGVaKOB5GIP5GH4aBBNraZERmaQ== + dependencies: + commander "^8.3.0" + keyv@^4.5.3: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" @@ -4864,6 +5852,11 @@ keyv@^4.5.3: dependencies: json-buffer "3.0.1" +khroma@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/khroma/-/khroma-2.1.0.tgz#45f2ce94ce231a437cf5b63c2e886e6eb42bbbb1" + integrity sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw== + kind-of@^6.0.0, kind-of@^6.0.2: version "6.0.3" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" @@ -4874,6 +5867,22 @@ kleur@^4.0.3: resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.5.tgz#95106101795f7050c6c650f350c683febddb1780" integrity sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ== +kolorist@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/kolorist/-/kolorist-1.8.0.tgz#edddbbbc7894bc13302cdf740af6374d4a04743c" + integrity sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ== + +langium@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/langium/-/langium-3.0.0.tgz#4938294eb57c59066ef955070ac4d0c917b26026" + integrity sha512-+Ez9EoiByeoTu/2BXmEaZ06iPNXM6thWJp02KfBO/raSMyCJ4jw7AkWWa+zBCTm0+Tw1Fj9FOxdqSskyN5nAwg== + dependencies: + chevrotain "~11.0.3" + chevrotain-allstar "~0.3.0" + vscode-languageserver "~9.0.1" + vscode-languageserver-textdocument "~1.0.11" + vscode-uri "~3.0.8" + language-subtag-registry@^0.3.20: version "0.3.23" resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.23.tgz#23529e04d9e3b74679d70142df3fd2eb6ec572e7" @@ -4886,6 +5895,16 @@ language-tags@^1.0.9: dependencies: language-subtag-registry "^0.3.20" +layout-base@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/layout-base/-/layout-base-1.0.2.tgz#1291e296883c322a9dd4c5dd82063721b53e26e2" + integrity sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg== + +layout-base@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/layout-base/-/layout-base-2.0.1.tgz#d0337913586c90f9c2c075292069f5c2da5dd285" + integrity sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg== + lazy-ass@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/lazy-ass/-/lazy-ass-1.6.0.tgz#7999655e8646c17f089fdd187d150d3324d54513" @@ -4965,6 +5984,14 @@ loader-utils@^2.0.0: emojis-list "^3.0.0" json5 "^2.1.2" +local-pkg@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/local-pkg/-/local-pkg-0.5.1.tgz#69658638d2a95287534d4c2fff757980100dbb6d" + integrity sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ== + dependencies: + mlly "^1.7.3" + pkg-types "^1.2.1" + locate-path@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" @@ -4979,6 +6006,11 @@ locate-path@^7.1.0: dependencies: p-locate "^6.0.0" +lodash-es@4.17.21, lodash-es@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" + integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== + lodash.camelcase@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" @@ -5072,6 +6104,11 @@ lru-cache@^10.2.0: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== +lru-cache@^7.14.1: + version "7.18.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89" + integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA== + lucide-react@^0.445.0: version "0.445.0" resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.445.0.tgz#35c42341e98fbf0475b2a6cf74fd25ef7cbfcd62" @@ -5094,6 +6131,11 @@ markdown-table@^3.0.0: resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-3.0.3.tgz#e6331d30e493127e031dd385488b5bd326e4a6bd" integrity sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw== +marked@^13.0.2: + version "13.0.3" + resolved "https://registry.yarnpkg.com/marked/-/marked-13.0.3.tgz#5c5b4a5d0198060c7c9bc6ef9420a7fed30f822d" + integrity sha512-rqRix3/TWzE9rIoFGIn8JmsVfhiuC8VIQ8IdX5TfzmeBucdY05/0UlzKaw0eVtpcN/OdVFpBk7CjKGo9iHJ/zA== + mdast-util-find-and-replace@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.1.tgz#a6fc7b62f0994e973490e45262e4bc07607b04e0" @@ -5104,7 +6146,7 @@ mdast-util-find-and-replace@^3.0.0: unist-util-is "^6.0.0" unist-util-visit-parents "^6.0.0" -mdast-util-from-markdown@^1.0.0: +mdast-util-from-markdown@^1.0.0, mdast-util-from-markdown@^1.1.0, mdast-util-from-markdown@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-1.3.1.tgz#9421a5a247f10d31d2faed2a30df5ec89ceafcf0" integrity sha512-4xTO/M8c82qBcnQc1tgpNtubGUW/Y1tBQ1B0i5CtSoelOLKFYlElIr3bvgREYYO5iRqbMY1YuqZng0GVOI8Qww== @@ -5226,6 +6268,17 @@ mdast-util-gfm@^3.0.0: mdast-util-gfm-task-list-item "^2.0.0" mdast-util-to-markdown "^2.0.0" +mdast-util-mdx-expression@^1.0.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/mdast-util-mdx-expression/-/mdast-util-mdx-expression-1.3.2.tgz#d027789e67524d541d6de543f36d51ae2586f220" + integrity sha512-xIPmR5ReJDu/DHH1OoIT1HkuybIfRGYRywC+gJtI7qHjCJp/M9jrmBEJW22O8lskDWm562BX2W8TiAwRTb0rKA== + dependencies: + "@types/estree-jsx" "^1.0.0" + "@types/hast" "^2.0.0" + "@types/mdast" "^3.0.0" + mdast-util-from-markdown "^1.0.0" + mdast-util-to-markdown "^1.0.0" + mdast-util-mdx-expression@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz#43f0abac9adc756e2086f63822a38c8d3c3a5096" @@ -5238,6 +6291,24 @@ mdast-util-mdx-expression@^2.0.0: mdast-util-from-markdown "^2.0.0" mdast-util-to-markdown "^2.0.0" +mdast-util-mdx-jsx@^2.0.0: + version "2.1.4" + resolved "https://registry.yarnpkg.com/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-2.1.4.tgz#7c1f07f10751a78963cfabee38017cbc8b7786d1" + integrity sha512-DtMn9CmVhVzZx3f+optVDF8yFgQVt7FghCRNdlIaS3X5Bnym3hZwPbg/XW86vdpKjlc1PVj26SpnLGeJBXD3JA== + dependencies: + "@types/estree-jsx" "^1.0.0" + "@types/hast" "^2.0.0" + "@types/mdast" "^3.0.0" + "@types/unist" "^2.0.0" + ccount "^2.0.0" + mdast-util-from-markdown "^1.1.0" + mdast-util-to-markdown "^1.3.0" + parse-entities "^4.0.0" + stringify-entities "^4.0.0" + unist-util-remove-position "^4.0.0" + unist-util-stringify-position "^3.0.0" + vfile-message "^3.0.0" + mdast-util-mdx-jsx@^3.0.0: version "3.1.3" resolved "https://registry.yarnpkg.com/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.1.3.tgz#76b957b3da18ebcfd0de3a9b4451dcd6fdec2320" @@ -5256,6 +6327,17 @@ mdast-util-mdx-jsx@^3.0.0: unist-util-stringify-position "^4.0.0" vfile-message "^4.0.0" +mdast-util-mdx@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/mdast-util-mdx/-/mdast-util-mdx-2.0.1.tgz#49b6e70819b99bb615d7223c088d295e53bb810f" + integrity sha512-38w5y+r8nyKlGvNjSEqWrhG0w5PmnRA+wnBvm+ulYCct7nsGYhFVb0lljS9bQav4psDAS1eGkP2LMVcZBi/aqw== + dependencies: + mdast-util-from-markdown "^1.0.0" + mdast-util-mdx-expression "^1.0.0" + mdast-util-mdx-jsx "^2.0.0" + mdast-util-mdxjs-esm "^1.0.0" + mdast-util-to-markdown "^1.0.0" + mdast-util-mdx@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz#792f9cf0361b46bee1fdf1ef36beac424a099c41" @@ -5267,6 +6349,17 @@ mdast-util-mdx@^3.0.0: mdast-util-mdxjs-esm "^2.0.0" mdast-util-to-markdown "^2.0.0" +mdast-util-mdxjs-esm@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-1.3.1.tgz#645d02cd607a227b49721d146fd81796b2e2d15b" + integrity sha512-SXqglS0HrEvSdUEfoXFtcg7DRl7S2cwOXc7jkuusG472Mmjag34DUDeOJUZtl+BVnyeO1frIgVpHlNRWc2gk/w== + dependencies: + "@types/estree-jsx" "^1.0.0" + "@types/hast" "^2.0.0" + "@types/mdast" "^3.0.0" + mdast-util-from-markdown "^1.0.0" + mdast-util-to-markdown "^1.0.0" + mdast-util-mdxjs-esm@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz#019cfbe757ad62dd557db35a695e7314bcc9fa97" @@ -5389,6 +6482,20 @@ mdx-bundler@^10.0.2: uuid "^9.0.1" vfile "^6.0.1" +mdx-mermaid@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/mdx-mermaid/-/mdx-mermaid-2.0.3.tgz#183d2ca9598f614a079e836d611d2c60e5618315" + integrity sha512-aVLaaVbQD8KmqzEk2AdLFb02MMENWkq5QQPD25sdtiswTIWk684JoaCOmy8oV+w3pthkcy2lRp0xVKIq1sLsqg== + optionalDependencies: + estree-util-to-js "^1.2.0" + estree-util-visit "^1.2.1" + hast-util-from-html "^1.0.2" + hast-util-to-estree "^2.3.3" + mdast-util-from-markdown "^1.3.1" + mdast-util-mdx "^2.0.1" + micromark-extension-mdxjs "^1.0.1" + puppeteer "^22.15.0" + memfs@^4.8.2: version "4.12.0" resolved "https://registry.yarnpkg.com/memfs/-/memfs-4.12.0.tgz#76570478aee461695fb3336ca3356a7a8cfc26cc" @@ -5414,7 +6521,33 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -micromark-core-commonmark@^1.0.1: +mermaid@^11.4.1: + version "11.4.1" + resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-11.4.1.tgz#577fad5c31a01a06d9f793e298d411f1379eecc8" + integrity sha512-Mb01JT/x6CKDWaxigwfZYuYmDZ6xtrNwNlidKZwkSrDaY9n90tdrJTV5Umk+wP1fZscGptmKFXHsXMDEVZ+Q6A== + dependencies: + "@braintree/sanitize-url" "^7.0.1" + "@iconify/utils" "^2.1.32" + "@mermaid-js/parser" "^0.3.0" + "@types/d3" "^7.4.3" + cytoscape "^3.29.2" + cytoscape-cose-bilkent "^4.1.0" + cytoscape-fcose "^2.2.0" + d3 "^7.9.0" + d3-sankey "^0.12.3" + dagre-d3-es "7.0.11" + dayjs "^1.11.10" + dompurify "^3.2.1" + katex "^0.16.9" + khroma "^2.1.0" + lodash-es "^4.17.21" + marked "^13.0.2" + roughjs "^4.6.6" + stylis "^4.3.1" + ts-dedent "^2.2.0" + uuid "^9.0.1" + +micromark-core-commonmark@^1.0.0, micromark-core-commonmark@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-1.1.0.tgz#1386628df59946b2d39fb2edfd10f3e8e0a75bb8" integrity sha512-BgHO1aRbolh2hcrzL2d1La37V0Aoz73ymF8rAcKnohLy93titmv62E0gP8Hrx9PKcKrqCZ1BbLGbP3bEhoXYlw== @@ -5557,6 +6690,20 @@ micromark-extension-gfm@^3.0.0: micromark-util-combine-extensions "^2.0.0" micromark-util-types "^2.0.0" +micromark-extension-mdx-expression@^1.0.0: + version "1.0.8" + resolved "https://registry.yarnpkg.com/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-1.0.8.tgz#5bc1f5fd90388e8293b3ef4f7c6f06c24aff6314" + integrity sha512-zZpeQtc5wfWKdzDsHRBY003H2Smg+PUi2REhqgIhdzAa5xonhP03FcXxqFSerFiNUr5AWmHpaNPQTBVOS4lrXw== + dependencies: + "@types/estree" "^1.0.0" + micromark-factory-mdx-expression "^1.0.0" + micromark-factory-space "^1.0.0" + micromark-util-character "^1.0.0" + micromark-util-events-to-acorn "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + uvu "^0.5.0" + micromark-extension-mdx-expression@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.0.tgz#1407b9ce69916cf5e03a196ad9586889df25302a" @@ -5571,6 +6718,22 @@ micromark-extension-mdx-expression@^3.0.0: micromark-util-symbol "^2.0.0" micromark-util-types "^2.0.0" +micromark-extension-mdx-jsx@^1.0.0: + version "1.0.5" + resolved "https://registry.yarnpkg.com/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-1.0.5.tgz#e72d24b7754a30d20fb797ece11e2c4e2cae9e82" + integrity sha512-gPH+9ZdmDflbu19Xkb8+gheqEDqkSpdCEubQyxuz/Hn8DOXiXvrXeikOoBA71+e8Pfi0/UYmU3wW3H58kr7akA== + dependencies: + "@types/acorn" "^4.0.0" + "@types/estree" "^1.0.0" + estree-util-is-identifier-name "^2.0.0" + micromark-factory-mdx-expression "^1.0.0" + micromark-factory-space "^1.0.0" + micromark-util-character "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + uvu "^0.5.0" + vfile-message "^3.0.0" + micromark-extension-mdx-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-3.0.1.tgz#5abb83da5ddc8e473a374453e6ea56fbd66b59ad" @@ -5588,6 +6751,13 @@ micromark-extension-mdx-jsx@^3.0.0: micromark-util-types "^2.0.0" vfile-message "^4.0.0" +micromark-extension-mdx-md@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/micromark-extension-mdx-md/-/micromark-extension-mdx-md-1.0.1.tgz#595d4b2f692b134080dca92c12272ab5b74c6d1a" + integrity sha512-7MSuj2S7xjOQXAjjkbjBsHkMtb+mDGVW6uI2dBL9snOBCbZmoNgDAeZ0nSn9j3T42UE/g2xVNMn18PJxZvkBEA== + dependencies: + micromark-util-types "^1.0.0" + micromark-extension-mdx-md@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/micromark-extension-mdx-md/-/micromark-extension-mdx-md-2.0.0.tgz#1d252881ea35d74698423ab44917e1f5b197b92d" @@ -5595,6 +6765,21 @@ micromark-extension-mdx-md@^2.0.0: dependencies: micromark-util-types "^2.0.0" +micromark-extension-mdxjs-esm@^1.0.0: + version "1.0.5" + resolved "https://registry.yarnpkg.com/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-1.0.5.tgz#e4f8be9c14c324a80833d8d3a227419e2b25dec1" + integrity sha512-xNRBw4aoURcyz/S69B19WnZAkWJMxHMT5hE36GtDAyhoyn/8TuAeqjFJQlwk+MKQsUD7b3l7kFX+vlfVWgcX1w== + dependencies: + "@types/estree" "^1.0.0" + micromark-core-commonmark "^1.0.0" + micromark-util-character "^1.0.0" + micromark-util-events-to-acorn "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + unist-util-position-from-estree "^1.1.0" + uvu "^0.5.0" + vfile-message "^3.0.0" + micromark-extension-mdxjs-esm@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-3.0.0.tgz#de21b2b045fd2059bd00d36746081de38390d54a" @@ -5610,6 +6795,20 @@ micromark-extension-mdxjs-esm@^3.0.0: unist-util-position-from-estree "^2.0.0" vfile-message "^4.0.0" +micromark-extension-mdxjs@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/micromark-extension-mdxjs/-/micromark-extension-mdxjs-1.0.1.tgz#f78d4671678d16395efeda85170c520ee795ded8" + integrity sha512-7YA7hF6i5eKOfFUzZ+0z6avRG52GpWR8DL+kN47y3f2KhxbBZMhmxe7auOeaTBrW2DenbbZTf1ea9tA2hDpC2Q== + dependencies: + acorn "^8.0.0" + acorn-jsx "^5.0.0" + micromark-extension-mdx-expression "^1.0.0" + micromark-extension-mdx-jsx "^1.0.0" + micromark-extension-mdx-md "^1.0.0" + micromark-extension-mdxjs-esm "^1.0.0" + micromark-util-combine-extensions "^1.0.0" + micromark-util-types "^1.0.0" + micromark-extension-mdxjs@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/micromark-extension-mdxjs/-/micromark-extension-mdxjs-3.0.0.tgz#b5a2e0ed449288f3f6f6c544358159557549de18" @@ -5662,6 +6861,20 @@ micromark-factory-label@^2.0.0: micromark-util-symbol "^2.0.0" micromark-util-types "^2.0.0" +micromark-factory-mdx-expression@^1.0.0: + version "1.0.9" + resolved "https://registry.yarnpkg.com/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-1.0.9.tgz#57ba4571b69a867a1530f34741011c71c73a4976" + integrity sha512-jGIWzSmNfdnkJq05c7b0+Wv0Kfz3NJ3N4cBjnbO4zjXIlxJr+f8lk+5ZmwFvqdAbUy2q6B5rCY//g0QAAaXDWA== + dependencies: + "@types/estree" "^1.0.0" + micromark-util-character "^1.0.0" + micromark-util-events-to-acorn "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + unist-util-position-from-estree "^1.0.0" + uvu "^0.5.0" + vfile-message "^3.0.0" + micromark-factory-mdx-expression@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-2.0.2.tgz#2afaa8ba6d5f63e0cead3e4dee643cad184ca260" @@ -5841,6 +7054,20 @@ micromark-util-encode@^2.0.0: resolved "https://registry.yarnpkg.com/micromark-util-encode/-/micromark-util-encode-2.0.0.tgz#0921ac7953dc3f1fd281e3d1932decfdb9382ab1" integrity sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA== +micromark-util-events-to-acorn@^1.0.0: + version "1.2.3" + resolved "https://registry.yarnpkg.com/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-1.2.3.tgz#a4ab157f57a380e646670e49ddee97a72b58b557" + integrity sha512-ij4X7Wuc4fED6UoLWkmo0xJQhsktfNh1J0m8g4PbIMPlx+ek/4YdW5mvbye8z/aZvAPUoxgXHrwVlXAPKMRp1w== + dependencies: + "@types/acorn" "^4.0.0" + "@types/estree" "^1.0.0" + "@types/unist" "^2.0.0" + estree-util-visit "^1.0.0" + micromark-util-symbol "^1.0.0" + micromark-util-types "^1.0.0" + uvu "^0.5.0" + vfile-message "^3.0.0" + micromark-util-events-to-acorn@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-2.0.2.tgz#4275834f5453c088bd29cd72dfbf80e3327cec07" @@ -6056,6 +7283,11 @@ minimist@^1.2.0, minimist@^1.2.6, minimist@^1.2.8: resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== +mitt@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.1.tgz#ea36cf0cc30403601ae074c8f77b7092cdab36d1" + integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw== + mkdirp@^0.5.1: version "0.5.6" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" @@ -6063,6 +7295,16 @@ mkdirp@^0.5.1: dependencies: minimist "^1.2.6" +mlly@^1.7.2, mlly@^1.7.3: + version "1.7.3" + resolved "https://registry.yarnpkg.com/mlly/-/mlly-1.7.3.tgz#d86c0fcd8ad8e16395eb764a5f4b831590cee48c" + integrity sha512-xUsx5n/mN0uQf4V548PKQ+YShA4/IW0KI1dZhrNrPCLG+xizETbHTkOa1f8/xut9JRPp8kQuMnz0oqwkTiLo/A== + dependencies: + acorn "^8.14.0" + pathe "^1.1.2" + pkg-types "^1.2.1" + ufo "^1.5.4" + mri@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" @@ -6092,6 +7334,11 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +netmask@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7" + integrity sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg== + next-contentlayer2@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/next-contentlayer2/-/next-contentlayer2-0.5.1.tgz#e7d58f4678d33059c9aef07cd2c898316bfe3c55" @@ -6388,11 +7635,38 @@ p-map@^4.0.0: dependencies: aggregate-error "^3.0.0" +pac-proxy-agent@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/pac-proxy-agent/-/pac-proxy-agent-7.1.0.tgz#da7c3b5c4cccc6655aaafb701ae140fb23f15df2" + integrity sha512-Z5FnLVVZSnX7WjBg0mhDtydeRZ1xMcATZThjySQUHqr+0ksP8kqaw23fNKkaaN/Z8gwLUs/W7xdl0I75eP2Xyw== + dependencies: + "@tootallnate/quickjs-emscripten" "^0.23.0" + agent-base "^7.1.2" + debug "^4.3.4" + get-uri "^6.0.1" + http-proxy-agent "^7.0.0" + https-proxy-agent "^7.0.6" + pac-resolver "^7.0.1" + socks-proxy-agent "^8.0.5" + +pac-resolver@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/pac-resolver/-/pac-resolver-7.0.1.tgz#54675558ea368b64d210fd9c92a640b5f3b8abb6" + integrity sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg== + dependencies: + degenerator "^5.0.0" + netmask "^2.0.2" + package-json-from-dist@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== +package-manager-detector@^0.2.0: + version "0.2.7" + resolved "https://registry.yarnpkg.com/package-manager-detector/-/package-manager-detector-0.2.7.tgz#6c3e47d7794fdd513512d02e2160c24ba559e39b" + integrity sha512-g4+387DXDKlZzHkP+9FLt8yKj8+/3tOkPv7DVTJGGRm00RkEWgqbFstX1mXJ4M0VDYhUqsTOiISqNOJnhAu3PQ== + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -6422,6 +7696,16 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" +parse-json@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + parse-latin@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/parse-latin/-/parse-latin-5.0.1.tgz#f3b4fac54d06f6a0501cf8b8ecfafa4cbb4f2f47" @@ -6446,6 +7730,11 @@ pascal-case@^3.1.2: no-case "^3.0.4" tslib "^2.0.3" +path-data-parser@0.1.0, path-data-parser@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/path-data-parser/-/path-data-parser-0.1.0.tgz#8f5ba5cc70fc7becb3dcefaea08e2659aba60b8c" + integrity sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w== + path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -6489,6 +7778,11 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +pathe@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.2.tgz#6c4cb47a945692e48a1ddd6e4094d170516437ec" + integrity sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ== + pend@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" @@ -6540,6 +7834,28 @@ pkg-dir@^6.0.1: dependencies: find-up "^6.1.0" +pkg-types@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/pkg-types/-/pkg-types-1.2.1.tgz#6ac4e455a5bb4b9a6185c1c79abd544c901db2e5" + integrity sha512-sQoqa8alT3nHjGuTjuKgOnvjo4cljkufdtLMnO2LBP/wRwuDlo1tkaEdMxCRhyGRPacv/ztlZgDPm2b7FAmEvw== + dependencies: + confbox "^0.1.8" + mlly "^1.7.2" + pathe "^1.1.2" + +points-on-curve@0.2.0, points-on-curve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/points-on-curve/-/points-on-curve-0.2.0.tgz#7dbb98c43791859434284761330fa893cb81b4d1" + integrity sha512-0mYKnYYe9ZcqMCWhUjItv/oHjvgEsfKvnUTg8sAtnHr3GVy7rGkXCb6d5cSyqrWqL4k81b9CPg3urd+T7aop3A== + +points-on-path@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/points-on-path/-/points-on-path-0.2.1.tgz#553202b5424c53bed37135b318858eacff85dd52" + integrity sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g== + dependencies: + path-data-parser "0.1.0" + points-on-curve "0.2.0" + possible-typed-array-names@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz#89bb63c6fada2c3e90adc4a647beeeb39cc7bf8f" @@ -6649,6 +7965,11 @@ process@^0.11.10: resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== +progress@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + prop-types@^15.5.8, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" @@ -6681,11 +8002,30 @@ protobufjs@^7.2.3, protobufjs@^7.2.5: "@types/node" ">=13.7.0" long "^5.0.0" +proxy-agent@^6.4.0: + version "6.5.0" + resolved "https://registry.yarnpkg.com/proxy-agent/-/proxy-agent-6.5.0.tgz#9e49acba8e4ee234aacb539f89ed9c23d02f232d" + integrity sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A== + dependencies: + agent-base "^7.1.2" + debug "^4.3.4" + http-proxy-agent "^7.0.1" + https-proxy-agent "^7.0.6" + lru-cache "^7.14.1" + pac-proxy-agent "^7.1.0" + proxy-from-env "^1.1.0" + socks-proxy-agent "^8.0.5" + proxy-from-env@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" integrity sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A== +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + psl@^1.1.33: version "1.9.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" @@ -6704,6 +8044,27 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== +puppeteer-core@22.15.0: + version "22.15.0" + resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-22.15.0.tgz#c76926cce5dbc177572797a9dacc325c313fa91a" + integrity sha512-cHArnywCiAAVXa3t4GGL2vttNxh7GqXtIYGym99egkNJ3oG//wL9LkvO4WE8W1TJe95t1F1ocu9X4xWaGsOKOA== + dependencies: + "@puppeteer/browsers" "2.3.0" + chromium-bidi "0.6.3" + debug "^4.3.6" + devtools-protocol "0.0.1312386" + ws "^8.18.0" + +puppeteer@^22.15.0: + version "22.15.0" + resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-22.15.0.tgz#4f842087090f1d9017ce947512e7baff55a10e75" + integrity sha512-XjCY1SiSEi1T7iSYuxS82ft85kwDJUS7wj1Z0eGVXKdtr5g4xnVcbjwxhq5xBnpK/E7x1VZZoJDxpjAOasHT4Q== + dependencies: + "@puppeteer/browsers" "2.3.0" + cosmiconfig "^9.0.0" + devtools-protocol "0.0.1312386" + puppeteer-core "22.15.0" + qs@6.13.0: version "6.13.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" @@ -6721,6 +8082,11 @@ queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== +queue-tick@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/queue-tick/-/queue-tick-1.0.1.tgz#f6f07ac82c1fd60f82e098b417a80e52f1f4c142" + integrity sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag== + quotation@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/quotation/-/quotation-2.0.3.tgz#b94c05128209a63b40b4e20e0f8f1a38adea7e0b" @@ -7183,6 +8549,21 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" +robust-predicates@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-3.0.2.tgz#d5b28528c4824d20fc48df1928d41d9efa1ad771" + integrity sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg== + +roughjs@^4.6.6: + version "4.6.6" + resolved "https://registry.yarnpkg.com/roughjs/-/roughjs-4.6.6.tgz#1059f49a5e0c80dee541a005b20cc322b222158b" + integrity sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ== + dependencies: + hachure-fill "^0.5.2" + path-data-parser "^0.1.0" + points-on-curve "^0.2.0" + points-on-path "^0.2.1" + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -7190,6 +8571,11 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +rw@1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" + integrity sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ== + rxjs@^7.5.1: version "7.8.1" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" @@ -7228,7 +8614,7 @@ safe-regex-test@^1.0.3: es-errors "^1.3.0" is-regex "^1.1.4" -safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: +"safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -7399,6 +8785,28 @@ slugify@^1.6.6: resolved "https://registry.yarnpkg.com/slugify/-/slugify-1.6.6.tgz#2d4ac0eacb47add6af9e04d3be79319cbcc7924b" integrity sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw== +smart-buffer@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" + integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== + +socks-proxy-agent@^8.0.5: + version "8.0.5" + resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz#b9cdb4e7e998509d7659d689ce7697ac21645bee" + integrity sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw== + dependencies: + agent-base "^7.1.2" + debug "^4.3.4" + socks "^2.8.3" + +socks@^2.8.3: + version "2.8.3" + resolved "https://registry.yarnpkg.com/socks/-/socks-2.8.3.tgz#1ebd0f09c52ba95a09750afe3f3f9f724a800cb5" + integrity sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw== + dependencies: + ip-address "^9.0.5" + smart-buffer "^4.2.0" + source-map-js@^1.0.2, source-map-js@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" @@ -7412,7 +8820,7 @@ source-map-support@^0.5.21: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0: +source-map@^0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -7463,6 +8871,11 @@ spellchecker-cli@^6.2.0: vfile "^3.0.1" vfile-reporter "^6.0.0" +sprintf-js@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.3.tgz#4914b903a2f8b685d17fdf78a70e917e872e444a" + integrity sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA== + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -7495,6 +8908,17 @@ streamsearch@^1.1.0: resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== +streamx@^2.15.0, streamx@^2.21.0: + version "2.21.1" + resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.21.1.tgz#f02979d8395b6b637d08a589fb514498bed55845" + integrity sha512-PhP9wUnFLa+91CPy3N6tiQsK+gnYyUNuk15S3YG/zjYE7RuPeCjJngqnzpC31ow0lzBHQ+QGO4cNJnd0djYUsw== + dependencies: + fast-fifo "^1.3.2" + queue-tick "^1.0.1" + text-decoder "^1.1.0" + optionalDependencies: + bare-events "^2.2.0" + string-argv@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" @@ -7662,7 +9086,7 @@ strnum@^1.0.5: resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db" integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA== -style-to-object@^0.4.0: +style-to-object@^0.4.0, style-to-object@^0.4.1: version "0.4.4" resolved "https://registry.yarnpkg.com/style-to-object/-/style-to-object-0.4.4.tgz#266e3dfd56391a7eefb7770423612d043c3f33ec" integrity sha512-HYNoHZa2GorYNyqiCaBgsxvcJIn7OHq6inEga+E6Ke3m5JkoqpQbnFssk4jwe+K7AhGa2fcha4wSOf1Kn01dMg== @@ -7683,6 +9107,11 @@ styled-jsx@5.1.1: dependencies: client-only "0.0.1" +stylis@^4.3.1: + version "4.3.4" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.4.tgz#ca5c6c4a35c4784e4e93a2a24dc4e9fa075250a4" + integrity sha512-osIBl6BGUmSfDkyH2mB7EFvCJntXDrLhKjHTRj/rK6xLH0yuPrHULDRQzKokSOD4VoorhtKpfcfW1GAntu8now== + sucrase@^3.32.0: version "3.35.0" resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.35.0.tgz#57f17a3d7e19b36d8995f06679d121be914ae263" @@ -7788,6 +9217,33 @@ tapable@^2.2.0: resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== +tar-fs@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-3.0.6.tgz#eaccd3a67d5672f09ca8e8f9c3d2b89fa173f217" + integrity sha512-iokBDQQkUyeXhgPYaZxmczGPhnhXZ0CmrqI+MOb/WFGS9DW5wnfrLgtjUJBvz50vQ3qfRwJ62QVoCFu8mPVu5w== + dependencies: + pump "^3.0.0" + tar-stream "^3.1.5" + optionalDependencies: + bare-fs "^2.1.1" + bare-path "^2.1.0" + +tar-stream@^3.1.5: + version "3.1.7" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-3.1.7.tgz#24b3fb5eabada19fe7338ed6d26e5f7c482e792b" + integrity sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ== + dependencies: + b4a "^1.6.4" + fast-fifo "^1.2.0" + streamx "^2.15.0" + +text-decoder@^1.1.0: + version "1.2.3" + resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.3.tgz#b19da364d981b2326d5f43099c310cc80d770c65" + integrity sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA== + dependencies: + b4a "^1.6.4" + text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -7822,6 +9278,11 @@ through@^2.3.8: resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== +tinyexec@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/tinyexec/-/tinyexec-0.3.1.tgz#0ab0daf93b43e2c211212396bdb836b468c97c98" + integrity sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ== + tmp@~0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.3.tgz#eb783cc22bc1e8bebd0671476d46ea4eb32a79ae" @@ -7869,6 +9330,11 @@ ts-api-utils@^1.3.0: resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== +ts-dedent@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/ts-dedent/-/ts-dedent-2.2.0.tgz#39e4bd297cd036292ae2394eb3412be63f563bb5" + integrity sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ== + ts-interface-checker@^0.1.9: version "0.1.13" resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" @@ -7894,6 +9360,11 @@ tslib@^2.0.0, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.4.0, tslib@^2.4.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== +tslib@^2.0.1: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -7992,6 +9463,11 @@ typical@^4.0.0: resolved "https://registry.yarnpkg.com/typical/-/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4" integrity sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw== +ufo@^1.5.4: + version "1.5.4" + resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.5.4.tgz#16d6949674ca0c9e0fbbae1fa20a71d7b1ded754" + integrity sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ== + unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -8002,6 +9478,14 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +unbzip2-stream@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz#b0da04c4371311df771cdc215e87f2130991ace7" + integrity sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg== + dependencies: + buffer "^5.2.1" + through "^2.3.8" + undici-types@~6.19.2: version "6.19.8" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" @@ -8079,6 +9563,13 @@ unist-util-modify-children@^3.0.0: "@types/unist" "^2.0.0" array-iterate "^2.0.0" +unist-util-position-from-estree@^1.0.0, unist-util-position-from-estree@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/unist-util-position-from-estree/-/unist-util-position-from-estree-1.1.2.tgz#8ac2480027229de76512079e377afbcabcfcce22" + integrity sha512-poZa0eXpS+/XpoQwGwl79UUdea4ol2ZuCYguVaJS4qzIOMDzbqz8a3erUCOmubSZkaOuGamb3tX790iwOIROww== + dependencies: + "@types/unist" "^2.0.0" + unist-util-position-from-estree@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/unist-util-position-from-estree/-/unist-util-position-from-estree-2.0.0.tgz#d94da4df596529d1faa3de506202f0c9a23f2200" @@ -8100,6 +9591,14 @@ unist-util-position@^5.0.0: dependencies: "@types/unist" "^3.0.0" +unist-util-remove-position@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/unist-util-remove-position/-/unist-util-remove-position-4.0.2.tgz#a89be6ea72e23b1a402350832b02a91f6a9afe51" + integrity sha512-TkBb0HABNmxzAcfLf4qsIbFbaPDvMO6wa3b3j4VcEzFVaw1LBKwnW4/sRJ/atSLSzoIg41JWEdnE7N6DIhGDGQ== + dependencies: + "@types/unist" "^2.0.0" + unist-util-visit "^4.0.0" + unist-util-remove-position@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/unist-util-remove-position/-/unist-util-remove-position-5.0.0.tgz#fea68a25658409c9460408bc6b4991b965b52163" @@ -8232,6 +9731,11 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" +urlpattern-polyfill@10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz#f0a03a97bfb03cdf33553e5e79a2aadd22cac8ec" + integrity sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg== + use-callback-ref@^1.3.0: version "1.3.2" resolved "https://registry.yarnpkg.com/use-callback-ref/-/use-callback-ref-1.3.2.tgz#6134c7f6ff76e2be0b56c809b17a650c942b1693" @@ -8375,6 +9879,41 @@ vfile@^6.0.0, vfile@^6.0.1: "@types/unist" "^3.0.0" vfile-message "^4.0.0" +vscode-jsonrpc@8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz#f43dfa35fb51e763d17cd94dcca0c9458f35abf9" + integrity sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA== + +vscode-languageserver-protocol@3.17.5: + version "3.17.5" + resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz#864a8b8f390835572f4e13bd9f8313d0e3ac4bea" + integrity sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg== + dependencies: + vscode-jsonrpc "8.2.0" + vscode-languageserver-types "3.17.5" + +vscode-languageserver-textdocument@~1.0.11: + version "1.0.12" + resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz#457ee04271ab38998a093c68c2342f53f6e4a631" + integrity sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA== + +vscode-languageserver-types@3.17.5: + version "3.17.5" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz#3273676f0cf2eab40b3f44d085acbb7f08a39d8a" + integrity sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg== + +vscode-languageserver@~9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-9.0.1.tgz#500aef82097eb94df90d008678b0b6b5f474015b" + integrity sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g== + dependencies: + vscode-languageserver-protocol "3.17.5" + +vscode-uri@~3.0.8: + version "3.0.8" + resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.8.tgz#1770938d3e72588659a172d0fd4642780083ff9f" + integrity sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw== + web-namespaces@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-2.0.1.tgz#1010ff7c650eccb2592cebeeaf9a1b253fd40692" @@ -8500,6 +10039,11 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +ws@^8.18.0: + version "8.18.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== + xmlbuilder@^15.1.1: version "15.1.1" resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-15.1.1.tgz#9dcdce49eea66d8d10b42cae94a79c3c8d0c2ec5" @@ -8551,7 +10095,7 @@ yocto-queue@^1.0.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.1.1.tgz#fef65ce3ac9f8a32ceac5a634f74e17e5b232110" integrity sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g== -zod@^3.22.4: +zod@3.23.8, zod@^3.22.4: version "3.23.8" resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g== From d8fd0101758cf2ec5a84f51dd33dcb07089bca50 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Fri, 20 Dec 2024 12:05:58 +1100 Subject: [PATCH 02/38] update global theme, and apis diagram. --- docs/apis.mdx | 7 +++++-- src/mdx/remark.mjs | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/apis.mdx b/docs/apis.mdx index 68c1eed9f..a261b4d31 100644 --- a/docs/apis.mdx +++ b/docs/apis.mdx @@ -12,10 +12,13 @@ Nitric has built-in support for web apps and HTTP API development. The `api` res graph LR; classDef default line-height:1.2; - A[Api]-->B[Service A]; - A-->C[Service B]; + A(Admin Api)-->B(Service A); + A-->C(Service B); + D(Public Api)-->B(Service A) ``` +> An API can route to many nitric services, and services can handle many APIs. + ## Creating APIs Nitric allows you define named APIs, each with their own routes, middleware, handlers and security. diff --git a/src/mdx/remark.mjs b/src/mdx/remark.mjs index b366a6000..2d2baabd1 100644 --- a/src/mdx/remark.mjs +++ b/src/mdx/remark.mjs @@ -11,11 +11,13 @@ export const remarkPlugins = [ output: 'svg', mermaid: { theme: 'base', + // TODO: Relocate theme config themeVariables: { - primaryColor: '#ff0000', - secondaryColor: '#00ff00', + primaryColor: '#242037', + lineColor: '#cad3f5', + secondaryColor: '#42424a', tertiaryColor: '#0000ff', - textColor: '#000000', + primaryTextColor: '#cad3f5', fontSize: '14px', fontFamily: 'Fira Code, monospace', }, From cd4f7fc68a1d81bb3a1dd11fce8a2856dc336024 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Fri, 20 Dec 2024 13:31:34 +1100 Subject: [PATCH 03/38] center align diagrams and add more examples. --- docs/messaging.mdx | 14 ++++++++++++++ docs/schedules.mdx | 11 +++++++++++ docs/secrets.mdx | 13 +++++++++++++ docs/storage.mdx | 14 ++++++++++++++ docs/websockets.mdx | 16 ++++++++++++++++ src/app/layout.tsx | 1 + src/styles/mermaid.css | 6 ++++++ 7 files changed, 75 insertions(+) create mode 100644 src/styles/mermaid.css diff --git a/docs/messaging.mdx b/docs/messaging.mdx index 577cf7347..a1f17ec5a 100644 --- a/docs/messaging.mdx +++ b/docs/messaging.mdx @@ -14,6 +14,20 @@ A topic is a named resource where events can be published. They can be thought o Topics are often the first choice for communication between services, since they offer stateless, scalable and highly decoupled communication. +### Architecture + +```mermaid +graph LR; + classDef default line-height:1.2; + classDef edgeLabel line-height:1.2; + + A(Topic)-- on message -->B(Message Service); + C(Publisher Service) -- publish message --> A; + D(Publisher Batch Service) -- publish message --> A; +``` + +`Services` can both publish and subscribe to topics. `Batch Services` may only publish messages. + ### Subscriptions A subscription is a binding between a topic and a service. You can think of it as a channel that notifies your services when something new arrives on the topic. diff --git a/docs/schedules.mdx b/docs/schedules.mdx index 4ddc89489..022814006 100644 --- a/docs/schedules.mdx +++ b/docs/schedules.mdx @@ -10,6 +10,17 @@ The `schedule` resource lets you define named schedules, including their frequen If you're looking for a way to perform once-off work at some point in the future, use [delayed messaging](./messaging#delayed-messaging) instead of schedules. +## Architecture + +```mermaid +graph LR; + classDef default line-height:1.2; + + A(Weekly Schedule)-->B(Service A); +``` + +> Schedules can be used to trigger a single service at a set cadence + ## Creating schedules There are two ways to define schedules. Using `every` allows simple rate definitions to trigger the callback or `cron` can be used for more complex scenarios. diff --git a/docs/secrets.mdx b/docs/secrets.mdx index fb07bdcbb..cfa80efd3 100644 --- a/docs/secrets.mdx +++ b/docs/secrets.mdx @@ -8,6 +8,19 @@ Nitric Secrets simplifies the secure storage, updating, and retrieval of sensiti Alternatively, you can choose to store these values as environment variables. Learn more about it [here](/reference/env). +### Architecture + +```mermaid +graph LR; + classDef default line-height:1.2; + classDef edgeLabel line-height:1.2; + + B(Service)-- access/put secret -->A(Secret); + C(Batch Service) -- access/put secret --> A; +``` + +Both `Services` and `Batch Services` can access and put secrets values. + ## Definitions ### Secrets diff --git a/docs/storage.mdx b/docs/storage.mdx index 867ef4a6f..c62023a74 100644 --- a/docs/storage.mdx +++ b/docs/storage.mdx @@ -6,6 +6,20 @@ description: 'Working with files and storage in Nitric' Nitric provides storage support for securely storing and retrieving large files in the cloud. +## Architecture + +```mermaid +graph LR; + classDef default line-height:1.2; + classDef edgeLabel line-height:1.2; + + A(Bucket)-- on write -->B(Bucket Handler Service); + C(Bucket File Service) -- read/write/delete files --> A; + D(Image Processing Batch Service) -- read/write/delete files --> A; +``` + +A `Service` can both interact file files in a `Bucket` and receive notifications when files are written or deleted. A `Batch Service` can only interact with files on a bucket but cannot subscribe to file changes. + ## Definitions ### Files diff --git a/docs/websockets.mdx b/docs/websockets.mdx index ec6eb2bde..18eac4f10 100644 --- a/docs/websockets.mdx +++ b/docs/websockets.mdx @@ -12,6 +12,22 @@ Nitric provides support for serverless websockets. This feature allows you to co https://github.com/nitrictech/nitric/issues +## Architecture + +```mermaid +graph LR; + classDef default line-height:1.2; + classDef edgeLabel line-height:1.2; + + A(Websocket Gateway)-- on connect -->B(Connection Handler Service); + A -- on disconnect --> B; + A -- on message --> C(Message Handler Service); + C -- send message --> A; + D(Batch Service) -- send message --> A; +``` + +A `Service` can both receive and send messages to a `Websocket`, `Batch Services` may only send message to a `Websocket`. + ## Listening for events There are three events that must be defined to deploy a valid websocket implementation. These are `connect`, `disconnect` and `message`. diff --git a/src/app/layout.tsx b/src/app/layout.tsx index cd8a10788..0af768edd 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -3,6 +3,7 @@ import { Inter, Sora, JetBrains_Mono } from 'next/font/google' import { Providers } from '@/app/providers' +import '@/styles/mermaid.css' import '@/styles/tailwind.css' import clsx from 'clsx' import Fathom from './Fathom' diff --git a/src/styles/mermaid.css b/src/styles/mermaid.css new file mode 100644 index 000000000..066dd886e --- /dev/null +++ b/src/styles/mermaid.css @@ -0,0 +1,6 @@ +svg[id^='mermaid-svg-'] { + display: block; + /* width: 100%; */ + margin: auto; + /* padding: 0; */ +} From 1788b628d866cd752520b964f84e8665d9d351af Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Mon, 6 Jan 2025 11:51:08 +1100 Subject: [PATCH 04/38] try install additional deps. --- chrome-dependencies.txt | 17 +++++++++++++++++ puppeteer.config.json | 9 +++++++++ vercel.json | 5 +++++ 3 files changed, 31 insertions(+) create mode 100644 chrome-dependencies.txt create mode 100644 puppeteer.config.json create mode 100644 vercel.json diff --git a/chrome-dependencies.txt b/chrome-dependencies.txt new file mode 100644 index 000000000..905183f1d --- /dev/null +++ b/chrome-dependencies.txt @@ -0,0 +1,17 @@ +mesa-libgbm +nss +nspr +at-spi2-atk +cups-libs +libdrm +libXcomposite +libXdamage +libXext +libXrandr +libgbm +libxcb +alsa-lib +atk +gtk3 +pango +libxkbcommon \ No newline at end of file diff --git a/puppeteer.config.json b/puppeteer.config.json new file mode 100644 index 000000000..af94e5cc0 --- /dev/null +++ b/puppeteer.config.json @@ -0,0 +1,9 @@ +{ + "cacheDirectory": "/vercel/.cache/puppeteer", + "executablePath": "/vercel/.cache/puppeteer/chrome/linux-131.0.6778.204/chrome-linux64/chrome", + "args": [ + "--no-sandbox", + "--disable-setuid-sandbox", + "--disable-dev-shm-usage" + ] +} diff --git a/vercel.json b/vercel.json new file mode 100644 index 000000000..94af19cbb --- /dev/null +++ b/vercel.json @@ -0,0 +1,5 @@ +{ + "buildCommand": "yarn build", + "installCommand": "dnf install -y $(cat chrome-dependencies.txt) && pnpm install && pnpm exec browsers install chrome@131.0.6778.204 --path /vercel/.cache/puppeteer", + "framework": "nextjs" +} From d5b80f5e0476723aea6f4603c5a0ffd0539f5b38 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Mon, 6 Jan 2025 11:55:10 +1100 Subject: [PATCH 05/38] fix config. --- vercel.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vercel.json b/vercel.json index 94af19cbb..7e96b34fa 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,5 @@ { "buildCommand": "yarn build", - "installCommand": "dnf install -y $(cat chrome-dependencies.txt) && pnpm install && pnpm exec browsers install chrome@131.0.6778.204 --path /vercel/.cache/puppeteer", + "installCommand": "dnf install -y $(cat chrome-dependencies.txt) && yarn install && npx browsers install chrome@131.0.6778.204 --path /vercel/.cache/puppeteer", "framework": "nextjs" } From ce438ff96e0f89f82a4b43ae8a0e624cc3f666a3 Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Mon, 6 Jan 2025 12:34:51 +1100 Subject: [PATCH 06/38] install browser before deps. --- vercel.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vercel.json b/vercel.json index 7e96b34fa..270f873dd 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,5 @@ { "buildCommand": "yarn build", - "installCommand": "dnf install -y $(cat chrome-dependencies.txt) && yarn install && npx browsers install chrome@131.0.6778.204 --path /vercel/.cache/puppeteer", + "installCommand": "dnf install -y $(cat chrome-dependencies.txt) && npx browsers install chrome@131.0.6778.204 --path /vercel/.cache/puppeteer && yarn install", "framework": "nextjs" } From b004e2593d7d76fbf86d2d6e504ef44b8a5a9e25 Mon Sep 17 00:00:00 2001 From: David Moore <4121492+davemooreuws@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:16:49 +1100 Subject: [PATCH 07/38] fix vercel cache issue (#695) --- .puppeteerrc.cjs | 14 ++++++++++++++ puppeteer.config.json | 9 --------- vercel.json | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .puppeteerrc.cjs delete mode 100644 puppeteer.config.json diff --git a/.puppeteerrc.cjs b/.puppeteerrc.cjs new file mode 100644 index 000000000..66d077a44 --- /dev/null +++ b/.puppeteerrc.cjs @@ -0,0 +1,14 @@ +const isCI = !!process.env.VERCEL_ENV + +/** + * @type {import("puppeteer").Configuration} + */ +module.exports = { + cacheDirectory: '/vercel/.cache/puppeteer', + executablePath: + '/vercel/.cache/puppeteer/chrome/linux-131.0.6778.204/chrome-linux64/chrome', + chrome: { + skipDownload: isCI, + }, + args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage'], +} diff --git a/puppeteer.config.json b/puppeteer.config.json deleted file mode 100644 index af94e5cc0..000000000 --- a/puppeteer.config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "cacheDirectory": "/vercel/.cache/puppeteer", - "executablePath": "/vercel/.cache/puppeteer/chrome/linux-131.0.6778.204/chrome-linux64/chrome", - "args": [ - "--no-sandbox", - "--disable-setuid-sandbox", - "--disable-dev-shm-usage" - ] -} diff --git a/vercel.json b/vercel.json index 270f873dd..7e96b34fa 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,5 @@ { "buildCommand": "yarn build", - "installCommand": "dnf install -y $(cat chrome-dependencies.txt) && npx browsers install chrome@131.0.6778.204 --path /vercel/.cache/puppeteer && yarn install", + "installCommand": "dnf install -y $(cat chrome-dependencies.txt) && yarn install && npx browsers install chrome@131.0.6778.204 --path /vercel/.cache/puppeteer", "framework": "nextjs" } From 57e236391f656a4d2a709034182ccd9d9000c275 Mon Sep 17 00:00:00 2001 From: David Moore Date: Mon, 6 Jan 2025 15:19:45 +1100 Subject: [PATCH 08/38] use defaults for non vercel env --- .puppeteerrc.cjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.puppeteerrc.cjs b/.puppeteerrc.cjs index 66d077a44..6ed102866 100644 --- a/.puppeteerrc.cjs +++ b/.puppeteerrc.cjs @@ -1,5 +1,10 @@ const isCI = !!process.env.VERCEL_ENV +if (!isCI) { + // just use the default configuration on non vercel CI environments + return {} +} + /** * @type {import("puppeteer").Configuration} */ @@ -8,7 +13,7 @@ module.exports = { executablePath: '/vercel/.cache/puppeteer/chrome/linux-131.0.6778.204/chrome-linux64/chrome', chrome: { - skipDownload: isCI, + skipDownload: true, }, args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage'], } From cc123457caffeabfb832dc8b99b1ca177725cf04 Mon Sep 17 00:00:00 2001 From: Rak Siva Date: Thu, 9 Jan 2025 12:44:44 -0700 Subject: [PATCH 09/38] wip: experimenting with c4 diagrams --- docs/guides/c4/c4-api.mdx | 151 +++++++++++++ docs/guides/c4/c4-big-picture.mdx | 92 ++++++++ docs/guides/c4/c4-buckets.mdx | 135 ++++++++++++ docs/guides/c4/c4-keyvalue.mdx | 96 ++++++++ docs/guides/c4/c4-queues.mdx | 82 +++++++ docs/guides/c4/c4-rds.mdx | 253 ++++++++++++++++++++++ docs/guides/c4/c4-schedules.mdx | 137 ++++++++++++ docs/guides/c4/c4-secrets.mdx | 89 ++++++++ docs/guides/c4/c4-services.mdx | 234 ++++++++++++++++++++ docs/guides/c4/c4-topics.mdx | 201 +++++++++++++++++ docs/guides/c4/c4-websockets.mdx | 207 ++++++++++++++++++ docs/guides/terraform/docs.code-workspace | 11 + 12 files changed, 1688 insertions(+) create mode 100644 docs/guides/c4/c4-api.mdx create mode 100644 docs/guides/c4/c4-big-picture.mdx create mode 100644 docs/guides/c4/c4-buckets.mdx create mode 100644 docs/guides/c4/c4-keyvalue.mdx create mode 100644 docs/guides/c4/c4-queues.mdx create mode 100644 docs/guides/c4/c4-rds.mdx create mode 100644 docs/guides/c4/c4-schedules.mdx create mode 100644 docs/guides/c4/c4-secrets.mdx create mode 100644 docs/guides/c4/c4-services.mdx create mode 100644 docs/guides/c4/c4-topics.mdx create mode 100644 docs/guides/c4/c4-websockets.mdx create mode 100644 docs/guides/terraform/docs.code-workspace diff --git a/docs/guides/c4/c4-api.mdx b/docs/guides/c4/c4-api.mdx new file mode 100644 index 000000000..7641c3235 --- /dev/null +++ b/docs/guides/c4/c4-api.mdx @@ -0,0 +1,151 @@ +--- +description: 'C4 Api' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric 'API' Architecture + +## 1. System Context (Level 1) + +- A **Developer** uses Nitric to create and manage APIs within their application. + - App code interacts with the **API resource** through defined endpoints. + - Developers define API specifications and implement backend logic to handle requests. +- **Operations** use default or overridden Terraform modules to provision the necessary AWS API Gateway resources. + - **AWS API Gateway v2** serves as the HTTP API management service. + - **AWS Lambda** functions are deployed to handle API requests. + - **AWS IAM** (implicitly assumed) provides roles and policies for secure interaction between API Gateway and Lambda functions. + - **AWS ACM** manages SSL/TLS certificates for custom domain names. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + APIGateway["AWS API Gateway v2
(HTTP API)"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + ACM["AWS ACM
(Certificates)"] + + Developer -->|Define API| App + Operations -->|Terraform| App + App -->|Create API Gateway| APIGateway + App -->|Deploy Lambda Functions| Lambda + App -->|Configure Permissions| IAM + APIGateway -->|Invoke| Lambda + ACM -->|Provide Certificates| APIGateway + IAM -->|Manage Access| APIGateway + App -->ACM + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 2. Container (Level 2) + +Each **API** is managed through AWS API Gateway v2 and interacts with backend Lambda functions to process HTTP requests. + +```mermaid +flowchart TD + Nitric["Nitric Application"] + Nitric -->B(API 1) + Nitric -->C(API 2) + Nitric -->D(...) + B(API 1) -->E(HTTP GET) + B(API 1) -->F(HTTP POST) + B(API 1) -->G(...) + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 3. Component (Level 3) + +### API Module + +- **aws_apigatewayv2_api.api_gateway** + - Creates an AWS API Gateway v2 HTTP API. + - Configures the API name, protocol type, API specification (`body`), and tags for identification and management. +- **aws_apigatewayv2_stage.stage** + - Creates a stage for the API Gateway. + - Sets the stage name to `$default` and enables automatic deployment of changes. +- **aws_lambda_permission.apigw_lambda** + - Grants API Gateway permission to invoke the specified Lambda functions. + - Iterates over `var.target_lambda_functions` to set permissions for each target function. +- **data.aws_acm_certificate.cert** + - Looks up existing ACM certificates for the specified domains. + - Iterates over `var.domains` to retrieve certificate details for each domain. +- **aws_apigatewayv2_domain_name.domain** + + - Creates custom domain names for the API Gateway using the retrieved ACM certificates. + - Configures domain name settings, including the certificate ARN, endpoint type, and security policy. + +## 4. Code (Level 4) + +**Developers** write application code that imports the 'api' resource from the SDK, configures the api, and implements HTTP routes, implement middleware, etc. + +```typescript +import { api } from '@nitric/sdk' + +const publicApi = api('public') + +api('public').get('/customers', (ctx) => { + // construct response for the GET: /customers request... + const responseBody = {} + ctx.res.json(responseBody) +}) + +const authMiddleware = async (ctx, next) => { + // Perform auth validation. + return await next(ctx) +} + +const privateApi = api('private', { middleware: authMiddleware }) +``` + +**Operations** will use the provided Terraform module to create and manage the AWS API Gateway as defined. + +```hcl +resource "aws_apigatewayv2_api" "api_gateway" { + name = var.name + protocol_type = "HTTP" + body = var.spec + tags = { + "x-nitric-${var.stack_id}-name" = var.name, + "x-nitric-${var.stack_id}-type" = "api", + } +} + +resource "aws_apigatewayv2_stage" "stage" { + api_id = aws_apigatewayv2_api.api_gateway.id + name = "$default" + auto_deploy = true +} + +# deploy lambda permissions for execution +resource "aws_lambda_permission" "apigw_lambda" { + for_each = var.target_lambda_functions + action = "lambda:InvokeFunction" + function_name = each.value + principal = "apigateway.amazonaws.com" + source_arn = "${aws_apigatewayv2_api.api_gateway.execution_arn}/*/*/*" +} + +# look up existing certificate for domains +data "aws_acm_certificate" "cert" { + for_each = var.domains + domain = each.value +} + +# deploy custom domain names +resource "aws_apigatewayv2_domain_name" "domain" { + for_each = var.domains + domain_name = each.value + domain_name_configuration { + certificate_arn = data.aws_acm_certificate.cert[each.key].arn + endpoint_type = "REGIONAL" + security_policy = "TLS_1_2" + } +} +``` diff --git a/docs/guides/c4/c4-big-picture.mdx b/docs/guides/c4/c4-big-picture.mdx new file mode 100644 index 000000000..b1e4947fc --- /dev/null +++ b/docs/guides/c4/c4-big-picture.mdx @@ -0,0 +1,92 @@ +--- +description: 'C4 Nitric High-Level Architecture' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric High-Level Architecture + +Nitric allows your team to work together to build an application: + +- **Developer**: Writes application code with built-in support for APIs, file storage (bucket), secrets, key‑value store, and RDS, leveraging the Nitric SDK. +- **Operations**: Customize, extend or use Nitric's generated IaC (Terraform or Pulumi) to provision and manage the resources that the developer needs for their application. +- **SRE**: Configure environment/region/policy specific details, they also are heavily involved in overseeing that the Terraform modules themselves adhere to governance standards. + +The roles above may overlap depending on your organization structure, for example, it is not abnormal Developers to assume all roles, or for Operations and SRE responsibilities to be handled by the same team. + +```mermaid +flowchart TD + Developer[Developer] + Operations[Operations] + SRE[Site Reliablility Engineer] + App[Nitric App - 'nitric up'] + Repo[Code Repository] + + API[API Gateway] + Bucket[Bucket - AWS S3] + Secrets[Secrets - AWS Secrets Manager\n] + KVStore[Key-Value Store - AWS DynamoDB] + RDS[Relational Database - AWS RDS/Aurora] + Other[Other resources] + + SRE -->|Deployment Config| Repo + Developer -->|Code| Repo + Operations -->|Extend/Customize Terraform| Repo + Repo-->App + + App -->|Exposes REST/HTTP Routes| API + App -->|Stores/Retrieves Files| Bucket + App -->|Manages Sensitive Data| Secrets + App -->|Reads/Writes Data| KVStore + App -->|Executes SQL Queries| RDS + App -->|1..n|Other + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +Nitric applications can have any number of APIs, Secrets, Buckets etc. Providers can also be extended to further support new resources, many which will work across all cloud providers and some that are cloud specific. + +## Example: Handling HTTP requests. + +Interaction with services that have been exposed as HTTP routes within an API gateway, Scheduled tasks, Event subscriptions, WebSocket handlers and more. + +```mermaid +flowchart TD + %% Actors + Browser[Client Browser] + + %% Nitric Application Containers + API[HTTP API - API Gateway] + Service[GET Route] + Service2[POST Route] + Service3[...] + + %% Backend Services / Resources + Bucket[AWS S3 Bucket] + Secrets[AWS Secrets Manager] + KVStore[AWS DynamoDB - Key-Value Store] + RDS[AWS RDS/Aurora] + + %% Interactions + Browser -->|Sends HTTP Request| API + API -->|Triggers Service| Service + API -->|Triggers Service| Service2 + API -->|Triggers Service| Service3 + Service -->|Manage/Uploads/Downloads files| Bucket + Service -->|Retrieves credentials/config data| Secrets + Service -->|Reads/Writes key data| KVStore + Service -->|Queries/Updates relational data| RDS + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +- The **Client Browser** sends an HTTP request to the **API Gateway**. +- The **API Gateway** acts as a proxy, forwarding the request to the appropriate **Services**. +- The **Services** process the request by coordinating with different backend services, this is done through : + - They interact with one or more **AWS S3 Bucket** to manage files. + - They retrieve credentials or configuration from **AWS Secrets Manager**. + - They use **AWS DynamoDB** for fast key-value operations. + - They query or update structured data in **AWS RDS/Aurora**. diff --git a/docs/guides/c4/c4-buckets.mdx b/docs/guides/c4/c4-buckets.mdx new file mode 100644 index 000000000..12ecb050a --- /dev/null +++ b/docs/guides/c4/c4-buckets.mdx @@ -0,0 +1,135 @@ +--- +description: 'C4 Buckets' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric 'Bucket' Architecture + +## 1. System Context (Level 1) + +- A **Developer** uses Nitric to manage S3 buckets within their application. + - App code imports the **Bucket resource** from the Nitric SDK. + - Developers configure buckets and implement application logic to securely access and manipulate bucket data. + - Developers can also implement hanlders for on events like on read, write or delete. +- **Operations** use default or overridden Terraform modules to provision the necessary AWS S3 resources. + - **AWS S3** serves as the storage backend. + - **AWS Lambda** functions are used to process events triggered by S3. + - **AWS IAM** provides roles and policies for secure access to S3 buckets and Lambda functions. + - **Random ID** resource is used to generate unique bucket names. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + S3Bucket["AWS S3 Bucket"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create S3 Bucket| S3Bucket + App -->|Configure Notifications| S3Bucket + App -->|Allow Lambda Invocation| Lambda + S3Bucket -->|Store/Retrieve Data| App + Lambda -->|Process Events| App + App -->|Provide Access| IAM + IAM -->S3Bucket + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 2. Container (Level 2) + +Each **Bucket** is managed through AWS S3 and accessed by the application through securely configured mechanisms provided by Nitric. + +```mermaid +flowchart TD + Nitric["Nitric Application"] + Nitric -->B(Bucket 1) + Nitric -->C(Bucket 2) + Nitric -->D(...) + B(BUCKET 1) -->E(ON Read) + B(BUCKET 1) -->F(ON Write) + B(BUCKET 1) -->G(ON Delete) +``` + +## 3. Component (Level 3) + +### Bucket Module + +- **random_id.bucket_id** + - Generates a random ID for the S3 bucket to ensure unique naming. +- **aws_s3_bucket.bucket** + - Creates an AWS S3 bucket with a unique name by appending the generated random ID. + - Configures tags for identification and management. +- **aws_lambda_permission.allow_bucket** + - Grants AWS S3 permission to invoke the specified Lambda functions. + - Iterates over `var.notification_targets` to set permissions for each target. +- **aws_s3_bucket_notification.bucket_notification** + - Configures S3 bucket notifications to trigger Lambda functions based on specified events. + - Uses dynamic blocks to handle multiple Lambda function notifications. + +## 4. Code (Level 4) + +**Developers** write application code that imports the 'bucket' resource from the SDK, configures the bucket, and implements the application logic to read, write and delete files. + +```typescript +import { bucket } from '@nitric/sdk' + +const profiles = bucket('profiles').allow('read') + +const image = await profiles.file('users/bruce-wayne/profile.png').read() +``` + +**Operations** will use the provided Terraform module to create and manage the AWS S3 Buckets as defined. + +```hcl + +# Generate a random id for the bucket +resource "random_id" "bucket_id" { + byte_length = 8 + + keepers = { + # Generate a new id each time we switch to a new AMI id + bucket_name = var.bucket_name + } +} + +# AWS S3 bucket +resource "aws_s3_bucket" "bucket" { + bucket = "${var.bucket_name}-${random_id.bucket_id.hex}" + + tags = { + "x-nitric-${var.stack_id}-name" = var.bucket_name + "x-nitric-${var.stack_id}-type" = "bucket" + } +} + +# Deploy bucket lambda invocation permissions +resource "aws_lambda_permission" "allow_bucket" { + for_each = var.notification_targets + action = "lambda:InvokeFunction" + function_name = each.value.arn + principal = "s3.amazonaws.com" + source_arn = aws_s3_bucket.bucket.arn +} + +# Deploy lambda notifications +resource "aws_s3_bucket_notification" "bucket_notification" { + bucket = aws_s3_bucket.bucket.id + + // make dynamic blocks for lambda function + dynamic "lambda_function" { + for_each = var.notification_targets + content { + lambda_function_arn = lambda_function.value.arn + events = lambda_function.value.events + filter_prefix = lambda_function.value.prefix + } + } +} +``` diff --git a/docs/guides/c4/c4-keyvalue.mdx b/docs/guides/c4/c4-keyvalue.mdx new file mode 100644 index 000000000..2a6fc2b68 --- /dev/null +++ b/docs/guides/c4/c4-keyvalue.mdx @@ -0,0 +1,96 @@ +--- +description: 'C4 KV' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric 'KVStore' Architecture + +## 1. System Context (Level 1) + +- A **Developer** uses Nitric to manage key-value stores within their application. + - App code imports the **KVStore resource** from the Nitric SDK. + - Developers configure key-value stores and implement application logic to securely access and manipulate data. +- **Operations** use default or overridden Terraform modules to provision the necessary AWS DynamoDB resources. + - **AWS DynamoDB** serves as the key-value store backend. + - **AWS IAM** provides roles and policies for secure access to DynamoDB tables. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + DynamoDB["AWS DynamoDB
(Key-Value Store)"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create DynamoDB Table| DynamoDB + App -->|Access DynamoDB| IAM + DynamoDB -->|Store/Retrieve Data| App + IAM -->|Provide Access| App + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 2. Container (Level 2) + +Each **KVStore** is managed through AWS DynamoDB and accessed by the application through securely configured mechanisms provided by Nitric. + +```mermaid +flowchart TD + Nitric["Nitric Application"] + Nitric -->B(KVStore 1) + Nitric -->C(KVStore 2) + Nitric -->D(...) +``` + +## 3. Component (Level 3) + +### KVStore Module + +- **aws_dynamodb_table.table** + - Deploys an AWS DynamoDB table with specified attributes, hash key, range key, billing mode, and tags for identification and management. + +## 4. Code (Level 4) + +**Developers** write application code that imports the 'secret' resource from the SDK, configures the secret, and implements the application logic to access and manage secrets. + +```typescript +import { kv } from '@nitric/sdk' + +const countries = kv('Countries').allow('delete', 'set') + +await countries.set('USA', { + name: 'United States of America', + population: 329500000, +}) + +await countries.delete('USA') +``` + +**Operations** will use the provided Terraform module to create and manage the KeyValue store as defined. + +```hcl +# Deploy an aws dynamodb table +resource "aws_dynamodb_table" "table" { + name = var.kvstore_name + attribute { + name = "_pk" + type = "S" + } + attribute { + name = "_sk" + type = "S" + } + hash_key = "_pk" + range_key = "_sk" + billing_mode = "PAY_PER_REQUEST" + tags = { + "x-nitric-${var.stack_id}-name" = var.kvstore_name + "x-nitric-${var.stack_id}-type" = "kvstore" + } +} +``` diff --git a/docs/guides/c4/c4-queues.mdx b/docs/guides/c4/c4-queues.mdx new file mode 100644 index 000000000..442c58540 --- /dev/null +++ b/docs/guides/c4/c4-queues.mdx @@ -0,0 +1,82 @@ +--- +description: 'C4 Queues' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric 'Queue' Architecture + +## 1. System Context (Level 1) + +- A **Developer** uses Nitric to manage message queues within their application. + - App code imports the **Queue resource** from the Nitric SDK. + - Developers configure queues and implement application logic to send and receive messages. +- **Operations** use default or overridden Terraform modules to provision the necessary AWS SQS resources. + - **AWS SQS** serves as the message queuing service. + - **AWS IAM** provides roles and policies for secure access to SQS queues. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + SQSQueue["AWS SQS Queue"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create SQS Queue| SQSQueue + App -->|Access SQS Queue| IAM + SQSQueue -->|Send/Receive Messages| App + IAM -->|Provide Access| App + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 2. Container (Level 2) + +Each **Queue** is managed through AWS SQS and accessed by the application through securely configured mechanisms provided by Nitric. + +```mermaid +flowchart TD + Nitric["Nitric Application"] + Nitric -->B(Queue 1) + Nitric -->C(Queue 2) + Nitric -->D(...) +``` + +## 3. Component (Level 3) + +### Queue Module + +- **aws_sqs_queue.queue** + - Deploys an AWS SQS queue with a specified name. + - Configures tags for identification and management. + +## 4. Code (Level 4) + +**Developers** write application code that imports the 'secret' resource from the SDK, configures the secret, and implements the application logic to access and manage secrets. + +```typescript +import { queue } from '@nitric/sdk' + +const payload = {} +const batchQueue = queue('batch').allow('dequeue') + +const messages = await batchQueue.enqueue() +``` + +**Operations** will use the provided Terraform module to create and manage the AWS SQS queues as defined. + +```hcl +# Deploy an SQS queue +resource "aws_sqs_queue" "queue" { + name = var.queue_name + tags = { + "x-nitric-${var.stack_id}-name" = var.queue_name + "x-nitric-${var.stack_id}-type" = "queue" + } +} +``` diff --git a/docs/guides/c4/c4-rds.mdx b/docs/guides/c4/c4-rds.mdx new file mode 100644 index 000000000..fc8625654 --- /dev/null +++ b/docs/guides/c4/c4-rds.mdx @@ -0,0 +1,253 @@ +--- +description: 'C4' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric 'RDS' Architecture + +## 1. System Context (Level 1) + +- A **Developer** uses Nitric to manage relational databases and automate database creation within their application. + - App code interacts with the **RDS Cluster** for data storage and retrieval. + - Developers utilize **CodeBuild** projects to automate database setup and migrations. +- **Operations** use default or overridden Terraform modules to provision the necessary AWS resources. + - **AWS RDS** provides a scalable and managed relational database service. + - **AWS CodeBuild** automates the process of setting up and managing the database schema. + - **AWS IAM** manages roles and permissions for secure access to AWS resources. + - **AWS VPC** ensures network isolation and security for the database instances. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + RDSCluster["AWS RDS Cluster"] + CodeBuild["AWS CodeBuild"] + IAM["AWS IAM"] + VPC["AWS VPC"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Provision RDS Cluster| RDSCluster + App -->|Configure CodeBuild| CodeBuild + RDSCluster <-->|Store/Retrieve Data| App + CodeBuild -->|Automate Database Setup| RDSCluster + IAM -->|Manage Permissions| RDSCluster + VPC -->|Network Security| RDSCluster + App -->IAM + App -->VPC + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 2. Container (Level 2) + +The system comprises several AWS services orchestrated through Terraform to provide a secure and scalable relational database environment with automated deployment capabilities. + +```mermaid +flowchart TD + Nitric["Nitric Application"] + Nitric -->A(RDS Cluster) + Nitric -->B(CodeBuild Project) + Nitric -->C(IAM Roles) + Nitric -->D(VPC Configuration) + Nitric -->E(Security Groups) +``` + +## 3. Component (Level 3) + +### RDS Module + +- **random_password.rds_password** + - Generates a secure random password for the RDS cluster. +- **aws_db_subnet_group.rds_subnet_group** + - Creates a subnet group for the RDS instance to ensure it is deployed within the specified private subnets. +- **aws_security_group.rds_security_group** + - Defines a security group for the RDS instance, allowing inbound traffic on port 5432 (PostgreSQL) from within the VPC and allowing all outbound traffic. +- **aws_iam_role.codebuild_role** + - Creates an IAM role for AWS CodeBuild with a trust relationship allowing CodeBuild to assume the role. +- **aws_iam_role_policy_attachment.codebuild_managed_policies** + - Attaches managed IAM policies to the CodeBuild role to grant necessary permissions for CodeBuild operations. +- **aws_rds_cluster.rds_cluster** + - Creates an AWS RDS cluster with Aurora PostgreSQL engine, configuring it for serverless v2 with specified scaling parameters. +- **aws_rds_cluster_instance.rds_cluster_instance** + - Creates an instance within the RDS cluster, specifying the instance class and engine details. +- **aws_codebuild_project.create_database** + - Sets up an AWS CodeBuild project to automate the creation of the database within the RDS cluster. It includes environment variables, VPC configuration, and build specifications. + +## 4. Code (Level 4) + +**Developers** write application code that imports the 'rds' resource from the SDK, configures and connects to an RDS. + +```typescript +import { api, sql } from '@nitric/sdk' +import { PrismaClient } from '@prisma/client' + +const mainApi = api('main') +const db = sql('my-data') + +let prisma +const getClient = async () => { + // ensure we only create the client once + if (!prisma) { + const connectionString = await db.connectionString() + + prisma = new PrismaClient({ + datasourceUrl: connectionString, + }) + } + return prisma +} +``` + +**Operations** will use the provided Terraform module to create and manage the AWS RDS as defined. + +```hcl +# Create a new random password for the RDS cluster +resource "random_password" "rds_password" { + length = 16 + special = false +} + +# Create a subnet group for the RDS instance +resource "aws_db_subnet_group" "rds_subnet_group" { + subnet_ids = var.private_subnet_ids +} + +# Create a security group for the RDS instance +resource "aws_security_group" "rds_security_group" { + vpc_id = var.vpc_id + + ingress { + from_port = 5432 + to_port = 5432 + protocol = "tcp" + self = true + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} + +# Create a role for the codebuild job +resource "aws_iam_role" "codebuild_role" { + name = "nitric-codebuild-role" + assume_role_policy = jsonencode({ + Version = "2012-10-17", + Statement = [ + { + Effect = "Allow", + Principal = { + Service = "codebuild.amazonaws.com" + }, + Action = "sts:AssumeRole" + } + ] + }) +} + +# Attach managed policies to the codebuild role +locals { + codebuildManagedPolicies = { + "codeBuildAdmin" = "arn:aws:iam::aws:policy/AWSCodeBuildAdminAccess" + "rdsAdmin" = "arn:aws:iam::aws:policy/AmazonRDSFullAccess" + "ec2Admin" = "arn:aws:iam::aws:policy/AmazonEC2FullAccess" + "cloudWatchLogs" = "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess" + "ecrReadonly" = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly" + } +} + +resource "aws_iam_role_policy_attachment" "codebuild_managed_policies" { + for_each = local.codebuildManagedPolicies + + role = aws_iam_role.codebuild_role.name + policy_arn = each.value +} + +# Create an RDS cluster with serverless v2 +resource "aws_rds_cluster" "rds_cluster" { + cluster_identifier = "nitric-rds-cluster" + engine = "aurora-postgresql" + engine_mode = "provisioned" + engine_version = "13.14" + database_name = "nitric" + master_username = "nitric" + master_password = random_password.rds_password.result + db_subnet_group_name = aws_db_subnet_group.rds_subnet_group.id + vpc_security_group_ids = [aws_security_group.rds_security_group.id] + skip_final_snapshot = true + deletion_protection = false + serverlessv2_scaling_configuration { + max_capacity = var.max_capacity + min_capacity = var.min_capacity + } +} + +# Create a rds cluster instance +resource "aws_rds_cluster_instance" "rds_cluster_instance" { + cluster_identifier = aws_rds_cluster.rds_cluster.id + instance_class = "db.serverless" + engine = aws_rds_cluster.rds_cluster.engine + engine_version = aws_rds_cluster.rds_cluster.engine_version + db_subnet_group_name = aws_rds_cluster.rds_cluster.db_subnet_group_name +} + + + +# Create an AWS Codebuild job to create a database on the RDS cluster +resource "aws_codebuild_project" "create_database" { + name = "nitric-create-database" + description = "Create the database on the RDS cluster" + build_timeout = 60 + service_role = aws_iam_role.codebuild_role.arn + + artifacts { + type = "NO_ARTIFACTS" + } + + + environment { + compute_type = "BUILD_GENERAL1_SMALL" + image = "aws/codebuild/amazonlinux2-x86_64-standard:4.0" + type = "LINUX_CONTAINER" + + environment_variable { + name = "DB_PASSWORD" + value = random_password.rds_password.result + type = "PLAINTEXT" + } + } + + + vpc_config { + subnets = var.private_subnet_ids + security_group_ids = aws_rds_cluster.rds_cluster.vpc_security_group_ids + vpc_id = var.vpc_id + } + + source { + type = "NO_SOURCE" + buildspec = jsonencode({ + version = "0.2", + phases = { + build = { + commands = [ + "echo 'Creating database $DB_NAME'", + # FIXME: Store the password in a secret manager + "export PGPASSWORD=$${DB_PASSWORD}", + # "CREATE DATABASE ${DB_NAME}" || echo "database ${DB_NAME} already exists" + "psql -h ${aws_rds_cluster.rds_cluster.endpoint} -U ${aws_rds_cluster.rds_cluster.master_username} -d ${aws_rds_cluster.rds_cluster.database_name} -c \"CREATE DATABASE $${DB_NAME}\" || echo \"database $${DB_NAME} already exists\"" + ] + } + } + }) + } +} +``` diff --git a/docs/guides/c4/c4-schedules.mdx b/docs/guides/c4/c4-schedules.mdx new file mode 100644 index 000000000..5afd33c78 --- /dev/null +++ b/docs/guides/c4/c4-schedules.mdx @@ -0,0 +1,137 @@ +--- +description: 'C4 Schedules' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric 'Schedule' Architecture + +## 1. System Context (Level 1) + +- A **Developer** uses Nitric to write and deploy their application, + - App code will import the **Schedule resource** from the Nitric SDK. + - Developers configure the schedule with CRON or rate expressions like '7 days' and implement application logic to be executed. +- **Operations** use default/extended or overridden Terraform modules to provision the neccessary resources to run the schedule. + - **Lambda function** is deployed as a packaged container image uploaded to an Amazon Elastic Container Registry (Amazon ECR). + - **AWS EventBridge** is used to schedule and trigger Lambda functions. + - **AWS IAM** provides the role/policies allowing EventBridge to invoke the Lambda functions securely. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + EventBridge["EventBridge
(AWS Scheduler)"] + Lambda["AWS Lambda
Deployed function(s)"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create AWS schedules| EventBridge + App -->|Create AWS IAM Roles / Policies| IAM + EventBridge -->|Invokes| Lambda + IAM -->|Attach Policy| Lambda + App -->|Deploy container app| Lambda + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 2. Container (Level 2) + +Each **Schedule** is deployed as a Lambda function from a container image that has been packaged with either Docker or Podman and uploaded to an Amazon Elastic Container Registry (Amazon ECR) repository. + +```mermaid +flowchart TD + Nitric["Nitric Application"] + Nitric -->B(API 1) + Nitric -->C(Schedule 1) + Nitric -->E(API 2) + Nitric -->F(Schedule 2) + Nitric -->G(...) + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 3. Component (Level 3) + +Schedules Module + +- **aws_iam_role.role** creates the IAM role for `scheduler.amazonaws.com`. +- **aws_iam_role_policy.role_policy** attaches the correct policy (i.e., `lambda:InvokeFunction`) to that role. +- **aws_scheduler_schedule.schedule** configures EventBridge Scheduler with the Cron (or rate) expression, the time zone, and the role ARN. + - When triggered it passes an event payload (`"x-nitric-schedule": var.schedule_name`) in the request. + +## 4. Code (Level 4) + +**Developers** write application code like the following examples that import the 'schedule' resource from the SDK, configure the schedule and implement the application code that will execute. + +```typescript +import { schedule } from '@nitric/sdk' + +// Run every 5 minutes +schedule('process-transactions').every('5 minutes', async (ctx) => { + console.log(`processing at ${new Date().toLocaleString()}`) +}) + +// Run at 22:00 Monday through Friday. +schedule('send-reminder').cron('0 22 * * 1-5', async (ctx) => { + console.log(`reminder at ${new Date().toLocaleString()}`) +}) +``` + +**Operations** will accept or override the default Nitric schedule Terraform provider. + +```hcl +# Create role and policy to allow schedule to invoke lambda +resource "aws_iam_role" "role" { + assume_role_policy = jsonencode({ + Version = "2012-10-17", + Statement = [ + { + Effect = "Allow", + Principal = { + Service = "scheduler.amazonaws.com" + }, + Action = "sts:AssumeRole" + } + ] + }) +} + +resource "aws_iam_role_policy" "role_policy" { + role = aws_iam_role.role.id + policy = jsonencode({ + Version = "2012-10-17", + Statement = [ + { + Effect = "Allow", + Action = "lambda:InvokeFunction", + Resource = var.target_lambda_arn + } + ] + }) +} + +# Create an AWS eventbridge schedule +resource "aws_scheduler_schedule" "schedule" { + flexible_time_window { + mode = "OFF" + } + + schedule_expression_timezone = var.schedule_timezone + + schedule_expression = var.schedule_expression + + target { + arn = var.target_lambda_arn + role_arn = aws_iam_role.role.arn + + input = jsonencode({ + "x-nitric-schedule": var.schedule_name + }) + } +} +``` diff --git a/docs/guides/c4/c4-secrets.mdx b/docs/guides/c4/c4-secrets.mdx new file mode 100644 index 000000000..91e4222c5 --- /dev/null +++ b/docs/guides/c4/c4-secrets.mdx @@ -0,0 +1,89 @@ +--- +description: 'C4 Secrets' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric 'Secret' Architecture + +## 1. System Context (Level 1) + +- A **Developer** uses Nitric to manage secrets within their application. + - App code imports the **Secret resource** from the Nitric SDK. + - Developers configure secrets and implement application logic to securely access and manage these secrets. +- **Operations** use default or overridden Terraform modules to provision the necessary AWS Secrets Manager resources. + - **AWS Secrets Manager** stores and manages secrets. + - **AWS IAM** provides roles/policies for secure access to secrets. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + SecretsManager["AWS Secrets Manager"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create Secret| SecretsManager + App -->|Access Secret| IAM + SecretsManager -->|Store/Retrieve Secret| App + IAM -->|Provide Access| App + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 2. Container (Level 2) + +Each **Secret** is managed through AWS Secrets Manager and is accessed by the application through securely configured mechanisms provided by Nitric. + +```mermaid +flowchart TD + Nitric["Nitric Application"] + Nitric -->B(Secret 1) + Nitric -->C(Secret 2) + Nitric -->D(...) + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 3. Component (Level 3) + +### Secrets Module + +- **aws_secretsmanager_secret.secret** + - Creates a new secret in AWS Secrets Manager. + - Configures the secret name and tags for identification and management. + +## 4. Code (Level 4) + +**Developers** write application code that imports the 'secret' resource from the SDK, configures the secret, and implements the application logic to access and manage secrets. + +```typescript +import { secret } from '@nitric/sdk' + +// Define a secret with permission to put a new value +const apiKey = secret('api-key').allow('put') + +// Store a new secret value +const latestVersion = await apiKey.put('a new secret value') + +// Retrieve the version ID of the newly stored value +console.log(`Secret version ID: ${latestVersion.version}`) +``` + +**Operations** will use the provided Terraform module to create and manage the AWS Secrets Manager secret as defined. + +```hcl +# Create a new AWS Secrets Manager secret +resource "aws_secretsmanager_secret" "secret" { + name = var.secret_name + tags = { + "x-nitric-${var.stack_id}-name" = var.secret_name + "x-nitric-${var.stack_id}-type" = "secret" + } +} +``` diff --git a/docs/guides/c4/c4-services.mdx b/docs/guides/c4/c4-services.mdx new file mode 100644 index 000000000..693c62edb --- /dev/null +++ b/docs/guides/c4/c4-services.mdx @@ -0,0 +1,234 @@ +--- +description: 'C4 Services' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric 'Service Deployment' Architecture + +## 1. System Context (Level 1) + +- A **Developer** uses Nitric to deploy and manage serverless functions within their application. + - App code interacts with the **Service resource** through defined functions. + - Developers build container images for their Lambda functions and push them to a container registry. +- **Operations** use default or overridden Terraform modules to provision the necessary AWS resources. + - **AWS ECR (Elastic Container Registry)** stores container images for Lambda functions. + - **AWS Lambda** runs serverless functions based on the container images. + - **AWS IAM** manages roles and policies for secure access to AWS resources. + - **Docker** is used to build and tag container images before pushing them to ECR. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + ECR["AWS ECR
(Container Registry)"] + Lambda["AWS Lambda
(Containerized Functions)"] + IAM["AWS IAM"] + Docker["Docker
(Image Building)"] + + Developer -->|Code| App + App -->|Build & Push Image| Docker + Docker -->|Push to| ECR + Operations -->|Terraform| App + + App -->|Access ECR| IAM + ECR -->|Provide Image| Lambda + IAM -->|Manage Permissions| App + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 2. Container (Level 2) + +Each **Service** is containerized, stored in AWS ECR, and deployed using AWS Lambda. The deployment process involves building, tagging, and pushing Docker images to ECR, followed by deploying them as Lambda functions. + +```mermaid +flowchart TD + Nitric["Nitric Application"] + Nitric -->A(Function 1) + Nitric -->B(Function 2) + Nitric -->C(...) + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 3. Component (Level 3) + +### Lambda Deployment Module + +- **terraform `{ required_providers { docker = { source = "kreuzwerker/docker" version = "3.0.2" } } }`** + - Configures Terraform to use the Docker provider for managing Docker images and containers. +- **aws_ecr_repository.repo** + - Creates an AWS ECR repository to store container images for Lambda functions. +- **data.aws_ecr_authorization_token.ecr_auth** + - Retrieves an authorization token for authenticating Docker with AWS ECR. +- **docker_tag.tag** + - Tags the provided Docker image with the ECR repository URL. +- **docker_registry_image.push** + - Pushes the tagged Docker image to the ECR repository. +- **aws_iam_role.role** + - Creates an IAM role for the Lambda function with a trust relationship allowing Lambda to assume the role. +- **aws_iam_role_policy.resource-list-access** + - Attaches a custom IAM policy to the Lambda role, granting permissions to list various AWS resources. +- **aws_iam_role_policy_attachment.basic-execution** + - Attaches the AWSLambdaBasicExecutionRole managed policy to the Lambda role for basic Lambda execution permissions. +- **aws_iam_role_policy_attachment.vpc-access** + - Conditionally attaches the AWSLambdaVPCAccessExecutionRole managed policy to the Lambda role if VPC subnets are provided. +- **aws_lambda_function.function** + - Creates a Lambda function using the container image pushed to ECR. Configures environment variables, memory, timeout, and optionally VPC settings. + +## 4. Code (Level 4) + +**Developers** write application code that implements handlers for the the 'api','bucket','websocket',"topic", "schedule" resources from the SDK. + +```typescript +import { api } from '@nitric/sdk' + +const customerRoute = api('public').route(`/customers`) + +customerRoute.get((ctx) => { + // construct response for the GET: /customers request... + const responseBody = {} + ctx.res.json(responseBody) +}) +``` + +```typescript +import { bucket } from '@nitric/sdk' + +const assets = bucket('assets') + +const accessibleAssets = bucket('assets').allow('delete') + +// The request will contain the name of the file `key` and the type of event `type` +assets.on('delete', '*', (ctx) => { + console.log(`A file named ${ctx.req.key} was deleted`) +}) +``` + +**Operations** will use the provided Terraform module to create and manage the Service deployment as defined. + +```hcl +terraform { + required_providers { + docker = { + source = "kreuzwerker/docker" + version = "3.0.2" + } + } +} + +# Create an ECR repository +resource "aws_ecr_repository" "repo" { + name = var.service_name + image_tag_mutability = "IMMUTABLE" +} + +data "aws_ecr_authorization_token" "ecr_auth" { +} + +# Tag the provided docker image with the ECR repository url +resource "docker_tag" "tag" { + source_image = var.image + target_image = aws_ecr_repository.repo.repository_url +} + +# Push the tagged image to the ECR repository +resource "docker_registry_image" "push" { + name = aws_ecr_repository.repo.repository_url + triggers = { + source_image_id = docker_tag.tag.source_image_id + } +} + +# Create a role for the lambda function +resource "aws_iam_role" "role" { + name = var.service_name + assume_role_policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Effect = "Allow" + Principal = { + Service = "lambda.amazonaws.com" + } + Action = "sts:AssumeRole" + } + ] + }) +} + +# TODO Make a common policy and attach separately +# as a base common compute policy +resource "aws_iam_role_policy" "resource-list-access" { + name = "resource-list-access" + role = aws_iam_role.role.name + + policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Effect = "Allow" + Action = [ + "sns:ListTopics", + "sqs:ListQueues", + "dynamodb:ListTables", + "s3:ListAllMyBuckets", + "tag:GetResources", + "apigateway:GET", + ] + Resource = "*" + } + ] + }) +} + + +resource "aws_iam_role_policy_attachment" "basic-execution" { + role = aws_iam_role.role.name + policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" +} + +# Attach vpc access execution role if subnets are provided +resource "aws_iam_role_policy_attachment" "vpc-access" { + count = length(var.subnet_ids) > 0 ? 1 : 0 + role = aws_iam_role.role.name + policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole" +} + +# Create a lambda function using the pushed image +resource "aws_lambda_function" "function" { + function_name = "${var.service_name}-${var.stack_id}" + role = aws_iam_role.role.arn + image_uri = "${aws_ecr_repository.repo.repository_url}@${docker_registry_image.push.sha256_digest}" + package_type = "Image" + timeout = var.timeout + memory_size = var.memory + ephemeral_storage { + size = var.ephemeral_storage + } + environment { + variables = var.environment + } + + + dynamic "vpc_config" { + for_each = length(var.subnet_ids) > 0 ? ["1"] : [] + content { + subnet_ids = var.subnet_ids + security_group_ids = var.security_group_ids + } + } + + depends_on = [docker_registry_image.push] + + tags = { + "x-nitric-${var.stack_id}-name" = var.service_name, + "x-nitric-${var.stack_id}-type" = "service", + } +} +``` diff --git a/docs/guides/c4/c4-topics.mdx b/docs/guides/c4/c4-topics.mdx new file mode 100644 index 000000000..bd0bdb3c8 --- /dev/null +++ b/docs/guides/c4/c4-topics.mdx @@ -0,0 +1,201 @@ +--- +description: 'C4 Topics' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric 'Topic' Architecture + +## 1. System Context (Level 1) + +- A **Developer** uses Nitric to manage messaging and event-driven communication within their application. + - App code interacts with the **SNS Topic resource** through defined topics and subscriptions. + - Developers configure SNS topics and implement application logic to publish and consume messages. +- **Operations** use default or overridden Terraform modules to provision the necessary AWS SNS resources. + - **AWS SNS (Simple Notification Service)** serves as the messaging and event notification service. + - **AWS Lambda** functions are subscribed to SNS topics to process incoming messages. + - **AWS IAM** manages roles and policies for secure access to SNS topics and Lambda functions. + - **AWS Step Functions** orchestrate workflows that interact with SNS topics. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + SNSTopic["AWS SNS Topic"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + StepFunctions["AWS Step Functions"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create SNS Topic| SNSTopic + App -->|Configure Subscriptions| SNSTopic + App -->|Publish Messages| StepFunctions + SNSTopic -->|Invoke Lambda| Lambda + App -->|Manage Permissions| IAM + StepFunctions -->|Orchestrate Workflows| SNSTopic + Lambda -->|Process Messages| App + IAM -->SNSTopic + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 2. Container (Level 2) + +Each **SNS Topic** is managed through AWS SNS and interacts with subscribed AWS Lambda functions and AWS Step Functions to handle event-driven workflows. + +```mermaid +flowchart TD + Nitric["Nitric Application"] + Nitric -->A(SNS Topic 1) + Nitric -->B(SNS Topic 2) + Nitric -->C(...) + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 3. Component (Level 3) + +### SNS Topic Module + +- **random_id.topic_id** + - Generates a unique random ID for each SNS topic to ensure unique naming. +- **aws_sns_topic.topic** + - Creates an AWS SNS topic with a unique name by appending the generated random ID. + - Configures tags for identification and management. +- **aws_sns_topic_subscription.subscription** + - Subscribes Lambda functions to the SNS topic. + - Iterates over `var.lambda_subscribers` to create subscriptions for each Lambda endpoint. +- **aws_lambda_permission.sns** + - Grants SNS permission to invoke the specified Lambda functions. + - Iterates over `var.lambda_subscribers` to set permissions for each target function. +- **aws_iam_role.sns_publish_role** + - Creates an IAM role for AWS Step Functions to publish messages to the SNS topic. + - Defines a trust relationship allowing Step Functions to assume the role. +- **aws_iam_role_policy.publish_policy** + - Attaches an inline policy to the SNS publish role, granting permissions to publish messages to the SNS topic. +- **aws_sfn_state_machine.publish_to_topic** + - Creates an AWS Step Functions state machine that publishes messages to the SNS topic. + - Defines the workflow with a wait state followed by a publish task. + +## 4. Code (Level 4) + +**Developers** write application code that imports the 'topic' resource from the SDK, and implements the application logic to publish and subscript to topics. + +```typescript +import { topic } from '@nitric/sdk' + +const updates = topic('updates').allow('publish') + +await updates.publish({ + something: 'amazing happened', +}) +``` + +**Operations** will use the provided Terraform module to create and manage the AWS Secrets Manager secret as defined. + +```hcl +# Generate a random id for the topic +resource "random_id" "topic_id" { + byte_length = 8 + + keepers = { + # Generate a new id each time we switch to a new name + topic_name = var.topic_name + } +} + + +# AWS SNS Topic +resource "aws_sns_topic" "topic" { + name = "${var.topic_name}-${random_id.topic_id.hex}" + + tags = { + "x-nitric-${var.stack_id}-name" = var.topic_name + "x-nitric-${var.stack_id}-type" = "topic" + } +} + +# Loop over the subsribers and deploy subscriptions and permissions +resource "aws_sns_topic_subscription" "subscription" { + for_each = var.lambda_subscribers + + topic_arn = aws_sns_topic.topic.arn + protocol = "lambda" + endpoint = each.value +} + +resource "aws_lambda_permission" "sns" { + for_each = var.lambda_subscribers + + action = "lambda:InvokeFunction" + function_name = each.value + principal = "sns.amazonaws.com" + source_arn = aws_sns_topic.topic.arn +} + +resource "aws_iam_role" "sns_publish_role" { + name = "${var.topic_name}-sns-publish-role" + + assume_role_policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Effect = "Allow" + Principal = { + Service = "states.amazonaws.com" + } + Action = "sts:AssumeRole" + } + ] + }) +} + +# Attach the policy to the role inline +resource "aws_iam_role_policy" "publish_policy" { + role = aws_iam_role.sns_publish_role.id + + # Terraform's "jsonencode" function converts a + # Terraform expression result to valid JSON syntax. + policy = jsonencode({ + Version = "2012-10-17" + Statement = [ + { + Effect = "Allow" + Action = "sns:Publish" + Resource = aws_sns_topic.topic.arn + } + ] + }) +} + +# Create a step function that publishes to the topic +resource "aws_sfn_state_machine" "publish_to_topic" { + name = "${var.topic_name}-publish-to-topic" + role_arn = aws_iam_role.sns_publish_role.arn + definition = jsonencode({ + Comment = "", + StartAt = "Wait", + States = { + Wait = { + Type = "Wait", + SecondsPath : "$.seconds", + Next = "Publish" + } + Publish = { + Type = "Task", + Resource = "arn:aws:states:::sns:publish", + Parameters = { + TopicArn = aws_sns_topic.topic.arn, + "Message.$" : "$.message", + }, + End = true + } + } + }) +} +``` diff --git a/docs/guides/c4/c4-websockets.mdx b/docs/guides/c4/c4-websockets.mdx new file mode 100644 index 000000000..f1015c28a --- /dev/null +++ b/docs/guides/c4/c4-websockets.mdx @@ -0,0 +1,207 @@ +--- +description: 'C4' +tags: + - C4 +published_at: 2024-07-25 +--- + +# Nitric 'WebSocket API Gateway' Architecture + +## 1. System Context (Level 1) + +- A **Developer** uses Nitric to create and manage WebSocket APIs within their application. + - App code interacts with the **WebSocket API resource** through defined routes and integrations. + - Developers implement backend logic to handle WebSocket connections, messages, and disconnections. +- **Operations** use default or overridden Terraform modules to provision the necessary AWS WebSocket API resources. + - **AWS API Gateway v2** manages WebSocket API endpoints and routes. + - **AWS Lambda** functions handle WebSocket events such as connection, message reception, and disconnection. + - **AWS IAM** manages roles and policies for secure access between API Gateway and Lambda functions. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + APIGateway["AWS API Gateway v2
(WebSocket API)"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create WebSocket API| APIGateway + App -->|Configure Integrations| APIGateway + App -->|Deploy Lambda Functions| Lambda + APIGateway -->|Invoke Lambda| Lambda + App -->|Manage Permissions| IAM + IAM -->Lambda + IAM -->APIGateway + Lambda -->|Handle Events| App +``` + +## 2. Container (Level 2) + +The system comprises AWS API Gateway v2 managing WebSocket APIs, which interact with AWS Lambda functions to handle connection, message, and disconnection events. + +```mermaid +flowchart TD + Nitric["Nitric Application"] + Nitric -->A(WebSocket API 1) + Nitric -->B(WebSocket API 2) + Nitric -->C(...) + A(WebSocket API 1) -->D(onConnect) + A(WebSocket API 1) -->E(onDisconnect) + A(WebSocket API 1) -->F(onMessage) + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 3. Component (Level 3) + +### WebSocket API Module + +- **random_id.topic_id** + - Generates a unique random ID for each SNS topic to ensure unique naming. +- **aws_apigatewayv2_api.websocket** + - Creates an AWS API Gateway v2 WebSocket API. + - Configures the API name, protocol type, route selection expression, and tags for identification and management. +- **aws_apigatewayv2_integration.default** + - Creates an integration for the `$default` route, linking it to a Lambda function. +- **aws_apigatewayv2_integration.connect** + - Creates an integration for the `$connect` route, linking it to a Lambda function. +- **aws_apigatewayv2_integration.disconnect** + - Creates an integration for the `$disconnect` route, linking it to a Lambda function. +- **aws_apigatewayv2_route.default** + - Creates the default route for the WebSocket API, targeting the default integration. +- **aws_apigatewayv2_route.connect** + - Creates the `$connect` route for the WebSocket API, targeting the connect integration. + - Depends on the default route to prevent concurrent edit conflicts. +- **aws_apigatewayv2_route.disconnect** + - Creates the `$disconnect` route for the WebSocket API, targeting the disconnect integration. + - Depends on the connect route to prevent concurrent edit conflicts. +- **aws_lambda_permission.websocket-message** + - Grants API Gateway permission to invoke the Lambda function handling messages. +- **aws_lambda_permission.websocket-connect** + - Grants API Gateway permission to invoke the Lambda function handling connections. +- **aws_lambda_permission.websocket-disconnect** + - Grants API Gateway permission to invoke the Lambda function handling disconnections. +- **aws_apigatewayv2_stage.stage** + - Creates a stage for the WebSocket API, enabling automatic deployment of changes. + - Configures tags for identification and management. + +## 4. Code (Level 4) + +**Developers** write application code that imports the 'websocket' resource from the SDK and implement backend logic to handle WebSocket connections, messages, and disconnections. + +```typescript +import { websocket } from '@nitric/sdk' + +const socket = websocket('socket') + +socket.on('connect', async (ctx) => { + // handle connections +}) + +socket.on('disconnect', async (ctx) => { + // handle disconnections +}) + +socket.on('message', async (ctx) => { + // handle messages +}) +``` + +**Operations** will use the provided Terraform module to create and manage the AWS Secrets Manager secret as defined. + +```hcl +# Deploy a websocket API gateway + +resource "aws_apigatewayv2_api" "websocket" { + name = var.websocket_name + protocol_type = "WEBSOCKET" + route_selection_expression = "$request.body.action" + tags = { + "x-nitric-${var.stack_id}-name" = var.websocket_name + "x-nitric-${var.stack_id}-type" = "websocket" + } +} + +resource "aws_apigatewayv2_integration" "default" { + api_id = aws_apigatewayv2_api.websocket.id + integration_type = "AWS_PROXY" + integration_uri = var.lambda_message_target +} + +# Create an integration for the connect route +resource "aws_apigatewayv2_integration" "disconnect" { + api_id = aws_apigatewayv2_api.websocket.id + integration_type = "AWS_PROXY" + integration_uri = var.lambda_disconnect_target +} + +# Create an integration for the connect route +resource "aws_apigatewayv2_integration" "connect" { + api_id = aws_apigatewayv2_api.websocket.id + integration_type = "AWS_PROXY" + integration_uri = var.lambda_connect_target +} + +# Create the default route for the websocket +resource "aws_apigatewayv2_route" "default" { + api_id = aws_apigatewayv2_api.websocket.id + route_key = "$default" + target = "integrations/${aws_apigatewayv2_integration.default.id}" +} + +# Create the connect route for the websocket +resource "aws_apigatewayv2_route" "connect" { + api_id = aws_apigatewayv2_api.websocket.id + route_key = "$connect" + target = "integrations/${aws_apigatewayv2_integration.connect.id}" + # Chain routes to prevent Concurrent edit conflict exceptions + depends_on = [ aws_apigatewayv2_route.default ] +} + +# Create the disconnect route for the websocket +resource "aws_apigatewayv2_route" "disconnect" { + api_id = aws_apigatewayv2_api.websocket.id + route_key = "$disconnect" + target = "integrations/${aws_apigatewayv2_integration.disconnect.id}" + # Chain routes to prevent Concurrent edit conflict exceptions + depends_on = [ aws_apigatewayv2_route.connect ] +} + +# Create execution lambda permissions for the websocket +resource "aws_lambda_permission" "websocket-message" { + action = "lambda:InvokeFunction" + function_name = var.lambda_message_target + principal = "apigateway.amazonaws.com" + source_arn = "${aws_apigatewayv2_api.websocket.execution_arn}/*/*" +} + +resource "aws_lambda_permission" "websocket-connect" { + action = "lambda:InvokeFunction" + function_name = var.lambda_connect_target + principal = "apigateway.amazonaws.com" + source_arn = "${aws_apigatewayv2_api.websocket.execution_arn}/*/*" +} + +resource "aws_lambda_permission" "websocket-disconnect" { + action = "lambda:InvokeFunction" + function_name = var.lambda_disconnect_target + principal = "apigateway.amazonaws.com" + source_arn = "${aws_apigatewayv2_api.websocket.execution_arn}/*/*" +} + +# create a stage for the api gateway +resource "aws_apigatewayv2_stage" "stage" { + api_id = aws_apigatewayv2_api.websocket.id + name = "ws" + auto_deploy = true + + tags = { + "x-nitric-${var.stack_id}-name" = "${var.websocket_name}DefaultStage" + "x-nitric-${var.stack_id}-type" = "websocket" + } +} +``` diff --git a/docs/guides/terraform/docs.code-workspace b/docs/guides/terraform/docs.code-workspace new file mode 100644 index 000000000..9eb416af5 --- /dev/null +++ b/docs/guides/terraform/docs.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "../../.." + }, + { + "path": "../../../../nitric" + } + ], + "settings": {} +} \ No newline at end of file From a1141ae65ebc929c634e49abcdc904b9dc14d4ca Mon Sep 17 00:00:00 2001 From: Rak Siva Date: Tue, 21 Jan 2025 11:31:21 -0700 Subject: [PATCH 10/38] wip: feedback --- dictionary.txt | 7 + docs/architecture/apis.mdx | 133 ++++++++++++++++ docs/architecture/buckets.mdx | 134 ++++++++++++++++ docs/architecture/index.mdx | 231 +++++++++++++++++++++++++++ docs/architecture/keyvalue.mdx | 120 ++++++++++++++ docs/architecture/queues.mdx | 117 ++++++++++++++ docs/architecture/schedules.mdx | 120 ++++++++++++++ docs/architecture/secrets.mdx | 120 ++++++++++++++ docs/architecture/services.mdx | 163 +++++++++++++++++++ docs/architecture/sql.mdx | 104 ++++++++++++ docs/architecture/topics.mdx | 136 ++++++++++++++++ docs/architecture/websockets.mdx | 102 ++++++++++++ docs/guides/c4/c4-api.mdx | 151 ------------------ docs/guides/c4/c4-big-picture.mdx | 92 ----------- docs/guides/c4/c4-buckets.mdx | 135 ---------------- docs/guides/c4/c4-keyvalue.mdx | 96 ------------ docs/guides/c4/c4-queues.mdx | 82 ---------- docs/guides/c4/c4-rds.mdx | 253 ------------------------------ docs/guides/c4/c4-schedules.mdx | 137 ---------------- docs/guides/c4/c4-secrets.mdx | 89 ----------- docs/guides/c4/c4-services.mdx | 234 --------------------------- docs/guides/c4/c4-topics.mdx | 201 ------------------------ docs/guides/c4/c4-websockets.mdx | 207 ------------------------ next-env.d.ts | 1 + src/config/index.ts | 65 ++++++++ 25 files changed, 1553 insertions(+), 1677 deletions(-) create mode 100644 docs/architecture/apis.mdx create mode 100644 docs/architecture/buckets.mdx create mode 100644 docs/architecture/index.mdx create mode 100644 docs/architecture/keyvalue.mdx create mode 100644 docs/architecture/queues.mdx create mode 100644 docs/architecture/schedules.mdx create mode 100644 docs/architecture/secrets.mdx create mode 100644 docs/architecture/services.mdx create mode 100644 docs/architecture/sql.mdx create mode 100644 docs/architecture/topics.mdx create mode 100644 docs/architecture/websockets.mdx delete mode 100644 docs/guides/c4/c4-api.mdx delete mode 100644 docs/guides/c4/c4-big-picture.mdx delete mode 100644 docs/guides/c4/c4-buckets.mdx delete mode 100644 docs/guides/c4/c4-keyvalue.mdx delete mode 100644 docs/guides/c4/c4-queues.mdx delete mode 100644 docs/guides/c4/c4-rds.mdx delete mode 100644 docs/guides/c4/c4-schedules.mdx delete mode 100644 docs/guides/c4/c4-secrets.mdx delete mode 100644 docs/guides/c4/c4-services.mdx delete mode 100644 docs/guides/c4/c4-topics.mdx delete mode 100644 docs/guides/c4/c4-websockets.mdx diff --git a/dictionary.txt b/dictionary.txt index 9e62dd43a..f7097bcad 100644 --- a/dictionary.txt +++ b/dictionary.txt @@ -236,6 +236,13 @@ EC2 .jpg .pdf preflight +lifecycle +NodeJS +priviledge +APIS +TLS +SRE +ACM nav MacOS quantized diff --git a/docs/architecture/apis.mdx b/docs/architecture/apis.mdx new file mode 100644 index 000000000..d296a0145 --- /dev/null +++ b/docs/architecture/apis.mdx @@ -0,0 +1,133 @@ +--- +description: 'Nitric API' +--- + +# APIS + +## 1. System Context + +**Developers** use Nitric to declare APIs and routes within their application. + +- App code uses the [API resource](/apis) through defined endpoints. +- Developers define API specifications and implement backend logic to handle HTTP requests. + +**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. + +
+ Example AWS Provider + +- **AWS API Gateway v2** serves as the HTTP API management service. +- **AWS Lambda** functions are deployed to handle API requests. +- **AWS IAM** (implicitly assumed) provides roles and policies for secure interaction between API Gateway and Lambda functions. +- **AWS ACM** manages TLS certificates for custom domain names. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + APIGateway["AWS API Gateway v2
(HTTP API)"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + ACM["AWS ACM
(Certificates)"] + + Developer -->|Define API| App + Operations -->|Terraform| App + App -->|Create API Gateway| APIGateway + App -->|Deploy Lambda Functions| Lambda + App -->|Configure Permissions| IAM + APIGateway -->|Invoke| Lambda + ACM -->|Provide Certificates| APIGateway + IAM -->|Manage Access| APIGateway + App -->ACM + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+
+ Example GCP Provider + +- **Google API Gateway** serves as the HTTP API management service, routing requests to backend services. +- **Google Cloud Run** services are deployed to handle API requests with serverless execution. +- **Google IAM** provides roles and policies to secure interactions between API Gateway, Cloud Run, and other GCP services. +- **Certificates** (Google-managed or custom) ensure secure HTTPS communication for custom domain names. +- **Google Service Account** is created and configured to allow API Gateway to invoke the Cloud Run backend securely. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + APIGateway["Google API Gateway"] + CloudRun["Google Cloud Run"] + IAM["Google IAM"] + Certificates["Certificates
(Google Managed or Custom)"] + ServiceAccount["Google Service Account"] + + Developer -->|Define API| App + Operations -->|Terraform| App + App -->|Create API Gateway| APIGateway + App -->|Deploy Cloud Run Services| CloudRun + App -->|Configure Permissions| IAM + APIGateway -->|Invoke| CloudRun + Certificates -->|Provide Certificates| APIGateway + IAM -->|Manage Access| APIGateway + App -->ServiceAccount + App -->Certificates + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+ +## 2. Sequence + +```mermaid +sequenceDiagram + participant Client as Client + participant NitricSDK as Nitric SDK + participant NitricRuntime as Nitric Runtime + participant APIGateway as API Gateway + participant Worker as App Worker + + Client->>NitricSDK: Send HTTP API request + NitricSDK->>NitricRuntime: Forward API request + NitricRuntime->>APIGateway: Register API routes (during deployment) + + APIGateway->>NitricRuntime: Route incoming request + NitricRuntime->>Worker: Forward request to application logic + Worker-->>NitricRuntime: Process request and return response + NitricRuntime-->>APIGateway: Respond with result + APIGateway-->>Client: Return API response +``` + +## 3. Component + +### API Module + +- Dynamically creates and manages API gateways to expose application functionality through HTTP endpoints and routes. +- Configures API properties, including protocol type, API specifications (e.g., OpenAPI), and metadata for identification and lifecycle management. +- Provisions and associates backend integrations with API routes, supporting multiple targets such as serverless functions, containers, or application services. +- Automates the setup of custom domain names with secure certificates, abstracting provider-specific configurations for HTTPS communication. +- Grants least privilege permissions to enable secure communication between the API gateway and backend services, ensuring robust security practices. +- Supports versioning and staging of APIs, enabling seamless updates and rollbacks without disrupting existing deployments. +- Abstracts the complexities of cloud-native API gateway services, providing a unified interface for developing and deploying HTTP APIs across different providers. + +## 4. Code + +**Developers** write application code that uses the [API resource](/apis) from the SDK, configures the api and implement HTTP routes and middleware. + +SDK Reference by language - + +- [NodeJS SDK](/reference/nodejs/api/api) +- [Python SDK](/reference/python/api/api) +- [GO SDK](/reference/go/api/api) +- [Dart SDK](/reference/dart/api/api) + +**Operations** will use or extend the Nitric Terraform reference modules: + +- [AWS API Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploytf/.nitric/modules/api/main.tf) +- [GCP API Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/gcp/deploytf/.nitric/modules/api/main.tf) diff --git a/docs/architecture/buckets.mdx b/docs/architecture/buckets.mdx new file mode 100644 index 000000000..668607ace --- /dev/null +++ b/docs/architecture/buckets.mdx @@ -0,0 +1,134 @@ +--- +description: 'C4 Buckets' +--- + +# Storage - Buckets + +## 1. System Context + +**Developers** use Nitric to declare buckets within their application. + +- App code uses the [Bucket resource](/storage) from the Nitric SDK. +- Developers configure buckets and implement application logic to securely access and manipulate bucket data. +- Developers request the level of access they require for the bucket in their application logic e.g. read, write, delete. +- Developers can implement handlers for on events such as read, write or delete. + +**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. + +
+ Example AWS Provider + +- **AWS S3** serves as the storage backend. +- **AWS Lambda** functions are used to process events triggered by S3. +- **AWS IAM** provides roles and policies for secure access to S3 buckets and Lambda functions, enforcing least priviledge access based on the developers request. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + S3Bucket["AWS S3 Bucket"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create S3 Bucket| S3Bucket + App -->|Configure Notifications| S3Bucket + IAM -->|Allow Lambda Invocation| Lambda + Lambda -->|Store/Retrieve Data/Trigger onEvents| S3Bucket + App -->|Provide Access| IAM + IAM -->S3Bucket + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+
+ Example GCP Provider + +- **Google Cloud Storage** serves as the storage backend. +- **Google Cloud Pub/Sub** is used to publish events triggered by Cloud Storage notifications. +- **Google IAM** provides roles and policies for secure access to Cloud Storage buckets and Pub/Sub topics, enforcing least privilege access based on the developer's request. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + GCSBucket["Google Cloud Storage Bucket"] + PubSubTopic["Google Pub/Sub Topic"] + PubSubSubscription["Google Pub/Sub Subscription"] + IAM["Google IAM"] + Lambda["AWS Lambda Functions"] + + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create Storage Bucket| GCSBucket + App -->|Configure Notifications| GCSBucket + IAM -->|Allow Pub/Sub Publishing| PubSubTopic + PubSubTopic -->|Publish Events| PubSubSubscription + PubSubSubscription -->|Deliver Notifications| Lambda + App -->|Provide Access| IAM + IAM -->GCSBucket + IAM -->PubSubTopic + Lambda -->|Store/Retrieve Data/Trigger onEvents| GCSBucket + + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+ +## 2. Sequence + +```mermaid +sequenceDiagram + participant Client as Client + participant NitricSDK as Nitric SDK + participant NitricRuntime as Nitric Runtime + participant CloudStorage as Cloud Storage (e.g., S3, GCS) + + Client->>NitricSDK: Perform storage operation (e.g., write, read, delete) + NitricSDK->>NitricRuntime: Forward storage API call + NitricRuntime->>CloudStorage: Execute storage operation + + alt Successful Operation + CloudStorage-->>NitricRuntime: Return result (e.g., data or success status) + NitricRuntime-->>NitricSDK: Return result + NitricSDK-->>Client: Return result to client + else Failure + CloudStorage-->>NitricRuntime: Return error + NitricRuntime-->>NitricSDK: Forward error + NitricSDK-->>Client: Return error response + end +``` + +## 3. Component + +### Bucket Module + +- Ensures storage buckets have unique names by appending a randomly generated identifier. This avoids naming conflicts and aligns with best practices for globally accessible cloud resources. +- Supports the addition of metadata tags for resource identification, management, and tracking, enabling better governance. +- Configures storage bucket notifications to trigger functions or message queues based on specified events (e.g., object creation, update, or deletion). +- Implements least privilege access by dynamically assigning permissions to functions or services that interact with the storage bucket. +- Uses templates or dynamic blocks to handle multiple notification targets, allowing scalability and flexibility for different workflows. + +## 4. Code + +**Developers** write application code that uses the [Bucket resource](/storage) from the SDK, configures the bucket, and implements the application logic to read, write and delete files. + +SDK Reference by language - + +- [NodeJS SDK](/reference/nodejs/storage/bucket) +- [Python SDK](/reference/python/storage/bucket) +- [GO SDK](/reference/go/storage/bucket) +- [Dart SDK](/reference/dart/storage/bucket) + +**Operations** will use or extend the Nitric Terraform reference modules: + +- [AWS Storage Bucket Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploytf/.nitric/modules/bucket/main.tf) +- [GCP Storage Bucket Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/gcp/deploytf/.nitric/modules/bucket/main.tf) diff --git a/docs/architecture/index.mdx b/docs/architecture/index.mdx new file mode 100644 index 000000000..cbf6d30ea --- /dev/null +++ b/docs/architecture/index.mdx @@ -0,0 +1,231 @@ +--- +description: 'Architecture Overview' +--- + +# Architecture Overview + +Nitric allows your team to work together to build an application: + +- **Developer**: Writes application code with built-in support for APIs, file storage (bucket), secrets, key/value store, and RDS, leveraging the Nitric SDK. +- **Operations**: Customize, extend or use Nitric's generated IaC (Terraform or Pulumi) to provision and manage the resources that the developer needs for their application. +- **SRE**: Configure environment/region/policy specific details, they also are heavily involved in overseeing that the Terraform modules themselves adhere to governance standards. +- **Nitric**: Automatically generates a specification for resource declarations and fulfills them by orchestrating a cloud deployment using IaC modules and container images tailored to the runtime requirements of the application code. While many of examples focus on AWS as the target cloud, Nitric's flexibility allows providers to support any cloud environment or even multiple clouds simultaneously. + +The roles above may overlap depending on your organization structure, for example, it is not abnormal Developers to assume all roles, or for Operations and SRE responsibilities to be handled by the same team. + +```mermaid +flowchart TD + Developer[Developer] + Operations[Operations] + SRE[Site Reliablility Engineer] + App[Deployed Application] + CLI[Nitric CLI - 'nitric up'] + Provider[Nitric Provider] + Container[Container Images] + + API[API Gateway] + Bucket[Bucket] + Secrets[Secrets] + KVStore[Key/Value Store] + RDS[Relational Database] + Other[Other Resources] + + SRE -->|Deployment Config| CLI + Developer -->|Code| CLI + Operations -->|Extend/Customize IaC Modules| Provider + CLI -->|Resource Specification| Provider + CLI -->|Build| Container + Provider -->App + Container -->Provider + + App -->|Exposes REST/HTTP Routes| API + App -->|Stores/Retrieves Files| Bucket + App -->|Manages Sensitive Data| Secrets + App -->|Reads/Writes Data| KVStore + App -->|Executes SQL Queries| RDS + App -->|1..n|Other + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +Nitric applications can have any number of APIs, Secrets, Buckets etc. Providers can also be extended to further support new resources, many which will work across all cloud providers and some that are cloud specific. + +Interact seamlessly with services exposed through HTTP routes in an API gateway, as scheduled tasks, via event subscriptions, through WebSocket handlers, and more. + +## Example: Handling HTTP requests + +```mermaid +flowchart TD + %% Actors + Browser[Client Browser] + + %% Nitric Application Containers + API[HTTP API - API Gateway] + Service[GET Route] + Service2[POST Route] + Service3[Other Services/APIs] + + %% Backend Services / Resources + Bucket[Storage Bucket] + Secrets[Secrets Manager] + KVStore[Key/Value Store] + RDS[Relational Database Service] + + %% Interactions + Browser -->|Sends HTTP Request| API + API -->|Triggers Service| Service + API -->|Triggers Service| Service2 + API -->Service3 + Service -->|Manage/Uploads/Downloads files| Bucket + Service -->|Retrieves credentials/config data| Secrets + Service -->|Reads/Writes key data| KVStore + Service -->|Queries/Updates relational data| RDS + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +- The **Client Browser** sends an HTTP request to the **API Gateway**. +- The **API Gateway** acts as a proxy, forwarding the request to the appropriate **Services**. +- The **Services** process the request by coordinating with different resources like buckets, secrets, key/value store etc. + +## Example: Handling Websockets + +```mermaid +flowchart TD + %% Actors + Browser[Websocket Client] + + %% Nitric Application Containers (WebSocket Handlers) + WS[WebSocket API] + Conn[onConnection Handler] + Msg[onMessage Handler] + Disc[onDisconnect Handler] + + %% Backend Services / Resources + Bucket[Storage Bucket] + KVStore[Key-Value Store] + More[...] + + %% Interactions + Browser -->|Opens/Closes WebSocket Connection| WS + WS -->|Triggers onConnection event| Conn + Browser -->|Sends Message| WS + WS -->|Triggers onMessage event| Msg + WS -->|Triggers onDisconnect event| Disc + + %% Backend Interactions for onMessage + Msg -->|Manages/Uploads/Downloads files| Bucket + Msg -->|Reads/Writes key data| KVStore + Msg -->|Other services/APIs| More + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +- The **Client Browser** opens a WebSocket connection. +- The **WebSocket** handles the connection lifecycle: + - When the connection opens, it triggers the onConnect service. + - Once the connection is established, messages from the client trigger the onMessage service. + - When the connection closes, it triggers the onDisconnect service. +- The **onMessage**, **onConnect** and **onDisconnect** handlers: + - Interact with other cloud resources e.g. Buckets, KeyValue stores and APIs. + +## Example: Sharing resources + +Deploy multiple APIs and other entrypoints into an application that can access shared resources. + +```mermaid +flowchart TD + %% Actors + Browser[Client Browser] + + %% Nitric Application Containers (APIs) + API_Read[HTTP API - Read API Gateway] + API_Write[HTTP API - Write API Gateway] + + Other[Other Resources] + + %% Services for respective API routes + ReadService[GET Route] + WriteService[POST Route] + + %% Backend Services / Resources + Bucket[AWS S3 Bucket] + RDS[AWS RDS/Aurora] + + %% Interactions from the client to each API + Browser -->|Sends HTTP Request| API_Read + Browser -->|Sends HTTP Request| API_Write + + %% API triggers to their respective services + API_Read -->|Triggers Service| ReadService + API_Write -->|Triggers Service| WriteService + + %% Common backend resource interactions from the read service + ReadService -->|Retrieves files| Bucket + ReadService -->|Queries data| RDS + + %% Common backend resource interactions from the write service + WriteService -->|Uploads files| Bucket + WriteService -->|Updates data| RDS + WriteService -->Other +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +- The **Client Browser** sends HTTP requests to the **API Gateways**. +- **API Gateways** and their respective service handlers are established with least privileges: + - The Read API Gateway invokes the GET Route Service, which is granted read-only permissions. + - The Write API Gateway invokes the POST Route Service, which is granted write-only permissions. + +## Example: Multiple entry points + +A Nitric application can have multiple entry points, such as an **HTTP API Gateway**, a **Scheduled Event**, and a **WebSocket API** all sharing the same resources. + +```mermaid +flowchart TD + + Browser[Client Browser] + WSClient[WebSocket Client] + Scheduled[Scheduled Event] + + API_Read[HTTP API - Read] + API_Write[HTTP API - Write] + WS_API[WebSocket API] + + ReadService[GET Route] + WriteService[POST Route] + ScheduledJob[Scheduled Task] + + Bucket[AWS S3 Bucket] + RDS[AWS RDS/Aurora] + Other[Other Shared Resources] + + Browser -->|HTTP Request| API_Read + Browser -->|HTTP Request| API_Write + WSClient <-->|Bi-directional messages| WS_API + + Scheduled -->|Triggers| ScheduledJob + + API_Read -->|Invokes| ReadService + API_Write -->|Invokes| WriteService + WS_API -->|Invokes| WriteService + WS_API -->|Invokes| ReadService + + ReadService -->|Query| Bucket + ReadService -->|Query| RDS + + WriteService -->|Write/Upload| Bucket + WriteService -->|Create/Update| RDS + + ScheduledJob -->|Read| Bucket + ScheduledJob -->|Read/Query| RDS + ScheduledJob --> Other + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +- **Backend resources** (e.g. Key/Value Store, Bucket, RDS) are shared and accessed with **least-privilege** access from each service. diff --git a/docs/architecture/keyvalue.mdx b/docs/architecture/keyvalue.mdx new file mode 100644 index 000000000..a84ed7c81 --- /dev/null +++ b/docs/architecture/keyvalue.mdx @@ -0,0 +1,120 @@ +--- +description: 'Nitric Key/Value Store' +--- + +# Key/Value Stores + +## 1. System Context + +**Developers** use Nitric to declare key/value stores within their application. + +- App code uses the [Key/Value resource](/keyvalue) from the Nitric SDK. +- Developers configure key/value stores and implement application logic to securely access and manipulate data. + +**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. + +
+ Example AWS Provider + +- **AWS DynamoDB** serves as the key/value store backend. +- **AWS IAM** provides roles and policies for secure access to DynamoDB tables. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + DynamoDB["AWS DynamoDB
(Key/Value Store)"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create DynamoDB| DynamoDB + Lambda -->|Store/Retrieve Data| DynamoDB + App -->|Provide Access| IAM + IAM -->DynamoDB + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+
+ Example GCP Provider + +- **Google Firestore** serves as the key/value store backend. +- **Google IAM** provides roles and policies for secure access to Firestore. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + Firestore["Google Firestore
(Key/Value Store)"] + CloudFunctions["Google Cloud Functions"] + IAM["Google IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create Firestore| Firestore + CloudFunctions -->|Store/Retrieve Data| Firestore + App -->|Provide Access| IAM + IAM -->Firestore + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+ +## 2. Sequence + +```mermaid +sequenceDiagram + participant Client as Client + participant NitricSDK as Nitric SDK + participant NitricRuntime as Nitric Runtime + participant DynamoDB as DynamoDB + + Client->>NitricSDK: Request to set/get/delete a key-value + NitricSDK->>NitricRuntime: Forward API call with key, value, or operation + NitricRuntime->>DynamoDB: Perform operation (GetItem, PutItem, DeleteItem, Scan) + + alt Successful Operation + DynamoDB-->>NitricRuntime: Return result (e.g., value, success status) + NitricRuntime-->>NitricSDK: Return result + NitricSDK-->>Client: Return result to client + else Failure + DynamoDB-->>NitricRuntime: Return error (e.g., AccessDenied, NotFound) + NitricRuntime-->>NitricSDK: Forward error + NitricSDK-->>Client: Return error response + end +``` + +## 3. Component + +### Key/Value Store Module + +- Ensures unique identification of key-value stores by using a standardized naming convention or randomly generated identifiers. +- Supports the definition of attributes, partition keys, and optional sort keys to optimize data organization and querying. +- Provides scalable and cost-efficient storage configurations suitable for variable workloads. +- Enables dynamic access control by assigning permissions to applications or services based on predefined roles and policies, ensuring least privilege access. +- Offers support for event-driven workflows, allowing integration with notification systems or functions triggered by changes in the store. +- Abstracts the underlying key-value storage implementation, enabling consistent developer and operations experience across different cloud providers. + +## 4. Code + +**Developers** write application code that uses the [Key/Value resource](/keyvalue) from the SDK, configures the secret, and implements the application logic to access and manage secrets. + +SDK Reference by language - + +- [NodeJS SDK](/reference/nodejs/keyvalue/keyvalue) +- [Python SDK](/reference/python/keyvalue/keyvalue) +- [GO SDK](/reference/go/keyvalue/keyvalue) +- [Dart SDK](/reference/dart/keyvalue/keyvalue) + +**Operations** will use or extend the Nitric Terraform reference modules: + +- [AWS Key/Value Store Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploytf/.nitric/modules/keyvalue/main.tf) +- [GCP Key/Value Store Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/gcp/deploytf/.nitric/modules/keyvalue/main.tf) diff --git a/docs/architecture/queues.mdx b/docs/architecture/queues.mdx new file mode 100644 index 000000000..948043da5 --- /dev/null +++ b/docs/architecture/queues.mdx @@ -0,0 +1,117 @@ +--- +description: 'Nitric Queue' +--- + +# Messaging - Queues + +## 1. System Context + +**Developers** use Nitric to declare message queues within their application. + +- App code uses the [Queue resource](/messaging#queues) from the Nitric SDK. +- Developers configure queues and implement application logic to send and receive messages. + +**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. + +
+ Example AWS Provider + +- **AWS SQS** serves as the message queuing service. +- **AWS IAM** provides roles and policies for secure access to SQS queues. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + SQSQueue["AWS SQS Queue"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create SQS Queue| SQSQueue + Lambda -->|Access SQS Queue| SQSQueue + App -->|Provide Access| IAM + IAM -->SQSQueue + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+
+ Example GCP Provider + +- **Google Pub/Sub Topic** serves as the message queuing service. +- **Google Pub/Sub Subscription** emulates a queue by creating a pull subscription for the topic. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + PubSubTopic["Google Pub/Sub Topic"] + PubSubSubscription["Google Pub/Sub Subscription"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create Pub/Sub Topic| PubSubTopic + PubSubSubscription -->|Pull Messages| PubSubTopic + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+ +## 2. Sequence + +```mermaid +sequenceDiagram + participant Client as Client + participant NitricSDK as Nitric SDK + participant NitricRuntime as Nitric Runtime + participant QueueService as Cloud Queue Service (e.g., AWS SQS, GCP Pub/Sub) + + Client->>NitricSDK: Send or receive message from queue + NitricSDK->>NitricRuntime: Forward queue API call + NitricRuntime->>QueueService: Perform queue operation (e.g., enqueue, dequeue) + + alt Successful Operation + QueueService-->>NitricRuntime: Return result (e.g., message or success status) + NitricRuntime-->>NitricSDK: Return result + NitricSDK-->>Client: Return result to client + else Failure + QueueService-->>NitricRuntime: Return error + NitricRuntime-->>NitricSDK: Forward error + NitricSDK-->>Client: Return error response + end +``` + +## 3. Component + +### Queue Module + +- Ensures the deployment of a scalable, provider-agnostic message queue with a consistent naming convention for seamless integration. +- Configures metadata or tags for resource identification, governance, and management. +- Implements secure access by dynamically assigning permissions to applications or services, enforcing the principle of least privilege. +- Supports configurable event-driven workflows, enabling the integration of producer-consumer patterns and worker pipelines. +- Provides dynamic configurations to handle varying workloads and queue-specific parameters such as message retention, delivery delay, and dead-letter queues. +- Abstracts the underlying queuing infrastructure, allowing developers and operations teams to focus on messaging logic rather than provider-specific APIs. + +## 4. Code + +**Developers** write application code that uses the [Queue resource](/messaging#queues) from the SDK, configures the secret, and implements the application logic to access and manage secrets. + +SDK Reference by language - + +- [NodeJS SDK](/reference/nodejs/queues/queue) +- [Python SDK](/reference/python/queues/queue) +- [GO SDK](/reference/go/queues/queue) +- [Dart SDK](/reference/dart/queues/queue) + +**Operations** will use or extend the Nitric Terraform reference modules: + +- [AWS Queue Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploytf/.nitric/modules/queue/main.tf) +- [GCP Queue Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/gcp/deploytf/.nitric/modules/queue/main.tf) diff --git a/docs/architecture/schedules.mdx b/docs/architecture/schedules.mdx new file mode 100644 index 000000000..75f645c53 --- /dev/null +++ b/docs/architecture/schedules.mdx @@ -0,0 +1,120 @@ +--- +description: 'Nitric Schedule' +--- + +# Schedules + +## 1. System Context + +**Developers** use Nitric to declare scheduled tasks within their application. + +- App code uses the [Schedule resource](/schedules) from the Nitric SDK. +- Developers configure the schedule with CRON or rate expressions like '7 days' and implement application logic to be executed when triggered. + +**Operations** use default/extended or overridden Terraform modules to provision the necessary resources to run the app logic on the defined schedule. + +
+ Example AWS Provider + +- **Lambda function** is deployed as a packaged container image uploaded to an Amazon Elastic Container Registry (Amazon ECR). +- **AWS EventBridge** is used to schedule and trigger Lambda functions. +- **AWS IAM** provides the role/policies allowing EventBridge to invoke the Lambda functions securely. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + EventBridge["EventBridge
(AWS Scheduler)"] + Lambda["AWS Lambda
Deployed function(s)"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create AWS schedules| EventBridge + App -->|Create AWS IAM Roles / Policies| IAM + EventBridge -->|Invokes| Lambda + IAM -->|Attach Policy| Lambda + App -->|Deploy Container App| Lambda + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+
+ Example GCP Provider + +- **Google Cloud Run** is deployed as a container image stored in **Google Artifact Registry (GCR)**. +- **Google Cloud Scheduler** is used to schedule and trigger **Google Cloud Run** functions via an HTTP trigger. +- **Google IAM** provides the role/policies allowing **Cloud Scheduler** to invoke the **Cloud Run** service securely. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + CloudScheduler["Cloud Scheduler
(GCP Scheduler)"] + CloudRun["Google Cloud Run
Deployed function(s)"] + IAM["Google IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create GCP schedules| CloudScheduler + App -->|Create GCP IAM Roles / Policies| IAM + CloudScheduler -->|Invokes| CloudRun + IAM -->|Attach Policy| CloudRun + App -->|Deploy Container App| CloudRun + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+ +## 2. Sequence + +```mermaid +sequenceDiagram + participant Developer as Developer + participant NitricSDK as Nitric SDK + participant NitricRuntime as Nitric Runtime + participant Scheduler as Cloud Scheduler + participant Worker as Application Worker + + Developer->>NitricSDK: Define schedule (e.g., CRON job) + NitricSDK->>NitricRuntime: Deploy schedule configuration + NitricRuntime->>Scheduler: Create schedule in cloud scheduler + + Scheduler->>NitricRuntime: Trigger scheduled task (e.g., CRON event) + NitricRuntime->>Worker: Forward scheduled event with payload + Worker-->>NitricRuntime: Process task and return result + NitricRuntime-->>Scheduler: Confirm execution (success or error) +``` + +## 3. Component + +### Schedule Module + +- Dynamically creates the necessary roles and permissions for the scheduling service to securely trigger application tasks, enforcing the principle of least privilege. +- Configures the scheduling system with CRON or rate expressions and supports additional parameters like time zones for flexibility. +- Automatically attaches policies to allow secure invocation of application functions or services when schedules are triggered. +- Supports passing custom event payloads to tasks, enabling dynamic behavior and workflows. +- Abstracts the underlying scheduler implementations, allowing developers and operations teams to interact with a unified scheduling interface without concerning themselves with provider-specific configurations. +- Enables seamless integration of recurring or scheduled tasks into applications without manual setup of complex cloud-native scheduling systems. + +## 4. Code + +**Developers** write application code like the following examples that uses the [Schedule resource](/schedules) from the SDK, configure the schedule and implement the application code that will execute. + +SDK Reference by language - + +- [NodeJS SDK](/reference/nodejs/schedule/schedule) +- [Python SDK](/reference/python/schedule/schedule) +- [GO SDK](/reference/go/schedule/schedule) +- [Dart SDK](/reference/dart/schedule/schedule) + +**Operations** will use or extend the Nitric Terraform reference modules: + +- [AWS Schedule Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploytf/.nitric/modules/schedule/main.tf) +- [GCP Schedule Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/gcp/deploytf/.nitric/modules/schedule/main.tf) diff --git a/docs/architecture/secrets.mdx b/docs/architecture/secrets.mdx new file mode 100644 index 000000000..786d05979 --- /dev/null +++ b/docs/architecture/secrets.mdx @@ -0,0 +1,120 @@ +--- +description: 'Nitric Secret' +--- + +# Secrets + +## 1. System Context + +**Developers** use Nitric to declare secrets within their application. + +- App code uses the [Secrets resource](/secrets) from the Nitric SDK. +- Developers configure secrets and implement application logic to securely access and manage these secrets. + +**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. + +
+ Example AWS Provider + +- **AWS Secrets Manager** stores and manages secrets. +- **AWS IAM** provides roles/policies for secure access to secrets. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + Secrets["AWS Secrets Manager"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create Secret| Secrets + Lambda -->|Access Secret| Secrets + App -->|Provide Access| IAM + IAM -->Secrets + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+
+ Example GCP Provider + +- **Google Secret Manager** stores and manages secrets. +- **Google IAM** provides roles/policies for secure access to secrets. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + Secrets["Google Secret Manager"] + CloudFunctions["Google Cloud Functions"] + IAM["Google IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create Secret| Secrets + CloudFunctions -->|Access Secret| Secrets + App -->|Provide Access| IAM + IAM -->Secrets + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+ +## 2. Sequence + +```mermaid +sequenceDiagram + participant Client as Client + participant NitricSDK as Nitric SDK + participant NitricRuntime as Nitric Runtime + participant SecretManager as Cloud Secret Manager (e.g., AWS Secrets Manager, GCP Secret Manager) + + Client->>NitricSDK: Perform secret operation (e.g., get, set, delete) + NitricSDK->>NitricRuntime: Forward secret API call + NitricRuntime->>SecretManager: Execute secret operation + + alt Successful Operation + SecretManager-->>NitricRuntime: Return result (e.g., secret value, success status) + NitricRuntime-->>NitricSDK: Return result + NitricSDK-->>Client: Return result to client + else Failure + SecretManager-->>NitricRuntime: Return error + NitricRuntime-->>NitricSDK: Forward error + NitricSDK-->>Client: Return error response + end +``` + +## 3. Component + +### Secrets Module + +- Dynamically creates and manages secure storage for sensitive information, ensuring confidentiality and integrity. +- Configures secrets with appropriate metadata or tags for easy identification, tracking, and management. +- Enforces access control policies to restrict secret usage to authorized applications or services, following the principle of least privilege. +- Supports versioning of secrets to facilitate secure updates and rollback capabilities without service disruption. +- Provides seamless integration with application workflows by enabling dynamic retrieval and management of secrets. +- Abstracts the complexity of underlying secret management systems, allowing developers and operators to interact with a unified interface regardless of the cloud provider. + +## 4. Code + +**Developers** write application code that imports the 'secret' resource from the SDK, configures the secret, and implements the application logic to access and manage secrets. + +SDK Reference by language - + +- [NodeJS SDK](/reference/nodejs/secrets/secret) +- [Python SDK](/reference/python/secrets/secret) +- [GO SDK](/reference/go/secrets/secret) +- [Dart SDK](/reference/dart/secrets/secret) + +**Operations** will use or extend the Nitric Terraform reference modules: + +- [AWS Secret Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploytf/.nitric/modules/secret/main.tf) +- [GCP Secret Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/gcp/deploytf/.nitric/modules/secret/main.tf) diff --git a/docs/architecture/services.mdx b/docs/architecture/services.mdx new file mode 100644 index 000000000..8318980d9 --- /dev/null +++ b/docs/architecture/services.mdx @@ -0,0 +1,163 @@ +--- +description: 'Service Deployment' +--- + +# Service Deployment + +## 1. System Context + +**Developers** use Nitric to deploy services or functions within their application. + +- Application code is written in files that matches the pattern(s) in the nitric.yaml config file. +- The **Nitric CLI** builds container images for their Lambda functions and push them to a container registry. + +**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. + +
+ Example AWS Provider + +- **AWS ECR (Elastic Container Registry)** stores container images for Lambda functions. +- **AWS Lambda** runs serverless functions based on the container images. +- **AWS IAM** manages roles and policies for secure access to AWS resources. +- **Docker** or **Podman** is used to build and tag container images before pushing them to ECR. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + ECR["AWS ECR
(Container Registry)"] + Lambda["AWS Lambda
(Containerized Functions)"] + IAM["AWS IAM"] + Docker["Docker
(Image Building)"] + + Developer -->|Code| App + App -->|Build & Push Image| Docker + Docker -->|Push to| ECR + Operations -->|Terraform| App + + App -->|Access ECR| IAM + ECR -->|Provide Image| Lambda + IAM -->|Manage Permissions| ECR + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+
+ Example GCP Provider + +- **Docker** builds and tags the image, which is then pushed to **Google Artifact Registry (GCR)**. +- **Google IAM** ensures secure access, with the appropriate permissions for the Cloud Run service and service accounts. +- The **Cloud Run** service will run based on the container image pulled from **GCR**. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + GCR["Google Artifact Registry
(Container Registry)"] + CloudRun["Google Cloud Run
(Containerized Functions)"] + IAM["Google IAM"] + Docker["Docker
(Image Building)"] + + Developer -->|Code| App + App -->|Build & Push Image| Docker + Docker -->|Push to| GCR + Operations -->|Terraform| App + + App -->|Access GCR| IAM + GCR -->|Provide Image| CloudRun + IAM -->|Manage Permissions| CloudRun + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+ +## 2. Container + +General-purpose workers that handle tasks like processing queues, topics, or schedules. Services abstract the runtime’s ability to route tasks and events to application-defined logic. + +```mermaid +flowchart TD + A[Service] -->|Manages API calls| B[APIs] + A -->|Schedules tasks| C[Schedules] + A -->|Handles key-value operations| D[KeyValue] + A -->|Manages file storage| E[Storage] + A -->|Queues messages| F[Queues] + A -->|Broadcasts messages to subscribers| G[Topics] + A -->|Manages secrets securely| H[Secrets] + A -->|Interacts with relational databases| I[SQL Databases] + A -->|Handles WebSocket connections| J[WebSockets] + + B -->|Routes HTTP requests| K[Cloud API Gateway] + C -->|Triggers periodic tasks| L[Cloud Scheduler] + D -->|Stores/retrieves key-value pairs| M[Cloud KeyValue Store] + E -->|Stores/retrieves files| N[Cloud Object Storage] + F -->|Processes message queues| O[Cloud Queue Service] + G -->|Distributes messages to subscribers| P[Cloud Pub/Sub] + H -->|Stores/retrieves secrets| Q[Cloud Secret Manager] + I -->|Executes SQL queries| R[Relational Database] + J -->|Facilitates real-time communication| S[WebSocket Gateway] + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +## 3. Component + +### Service Module + +- Configures Terraform to handle the deployment and management of containerized services, abstracting away provider-specific details. +- Dynamically creates and manages a container registry for storing service container images, ensuring secure and efficient access. +- Automates authentication and tagging for container image pushes, supporting seamless integration with deployment pipelines. +- Creates a role with least privilege permissions for executing the service, including necessary trust relationships and policies for interacting with other resources. +- Configures containerized services with runtime parameters like environment variables, memory limits, and execution timeouts to optimize performance and scalability. +- Optionally supports advanced networking configurations like VPC settings for secure and isolated deployments. +- Abstracts the underlying infrastructure for running serverless or containerized services, enabling developers to focus on application logic while providing a consistent interface for operations teams. + +## 4. Code + +**Developers** write application code that implements handlers for the [api](/apis), [bucket](/buckets), [websocket](/websockets), [topic](/topics), [schedule](/schedule) resources. This code is written in files that matches the pattern(s) in the nitric.yaml file. + +```json +name: service-name +services: + - match: services/*.ts + runtime: "" + type: "" + start: npm run dev:services $SERVICE_PATH +``` + +```typescript +import { api } from '@nitric/sdk' + +const customerRoute = api('public').route(`/customers`) + +customerRoute.get((ctx) => { + // construct response for the GET: /customers request... + const responseBody = {} + ctx.res.json(responseBody) +}) +``` + +```typescript +import { bucket } from '@nitric/sdk' + +const assets = bucket('assets') + +const accessibleAssets = bucket('assets').allow('delete') + +// The request will contain the name of the file `key` and the type of event `type` +assets.on('delete', '*', (ctx) => { + console.log(`A file named ${ctx.req.key} was deleted`) +}) +``` + +**Operations** will use or extend the Nitric Terraform reference modules: + +- [AWS Services Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploytf/.nitric/modules/service/main.tf) +- [GCP Services Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/gcp/deploytf/.nitric/modules/service/main.tf) diff --git a/docs/architecture/sql.mdx b/docs/architecture/sql.mdx new file mode 100644 index 000000000..db6cdb4e1 --- /dev/null +++ b/docs/architecture/sql.mdx @@ -0,0 +1,104 @@ +--- +description: 'Nitric SQL' +--- + +# SQL + +## 1. System Context + +**Developers** use Nitric to declare databases within their application (e.g., referencing a Postgres or MySQL database). + +- App code uses the [SQL database resources](/sql) from the Nitric SDK. +- Developers can use any language specific client or ORM to interact with the databases. + +**Operations** teams use default or customized Terraform modules to provision the required resources for the SQL database and for running database migrations: + +
+ Example AWS Provider + +- **AWS RDS** (or another SQL provider) hosts the actual database. +- **AWS ECR** (Elastic Container Registry) stores the database migration image. +- **AWS CodeBuild** runs the migration image against the database on startup. +- **AWS IAM** manages roles and policies granting CodeBuild access to pull images from ECR, access VPC resources, and more. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + NitricApp["nitric up"] + RDS["AWS RDS (SQL Database)"] + ECR["AWS ECR"] + CodeBuild["AWS CodeBuild (Executes Migrations)"] + IAM["AWS IAM"] + Lambda["AWS Lambda Functions"] + + Developer -->|Write Code| NitricApp + Operations -->|Terraform| NitricApp + NitricApp -->|Provision & Configure| RDS + NitricApp -->|Push/Tag Image| ECR + NitricApp -->|Run Migrations| CodeBuild + NitricApp -->|Manage Permissions| IAM + Lambda -->|Access Database| RDS + IAM -->Lambda + + CodeBuild -->|Executes SQL Migrations| RDS + IAM --> RDS + IAM --> ECR + IAM --> CodeBuild + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+ +## 2. Sequence Diagram (Level 2) + +```mermaid +sequenceDiagram + participant Client as Client + participant NitricSDK as Nitric SDK + participant NitricRuntime as Nitric Runtime + participant SQLDatabase as SQL Database (e.g., PostgreSQL, MySQL) + + Client->>NitricSDK: Perform SQL operation (e.g., query, insert, update) + NitricSDK->>NitricRuntime: Forward SQL API call + NitricRuntime->>SQLDatabase: Execute SQL operation + + alt Successful Operation + SQLDatabase-->>NitricRuntime: Return result (e.g., query data or success status) + NitricRuntime-->>NitricSDK: Return result + NitricSDK-->>Client: Return result to client + else Failure + SQLDatabase-->>NitricRuntime: Return error + NitricRuntime-->>NitricSDK: Forward error + NitricSDK-->>Client: Return error response + end +``` + +## 3. Component + +### SQL Resource Module + +- Configures a container registry for storing database migration images, ensuring secure and efficient image management. +- Dynamically tags and pushes migration images to the registry, streamlining deployment pipelines. +- Automates the setup of a migration execution environment using containerized tools, enabling seamless database schema updates and initialization. +- Provides an execution layer for running migrations against the SQL database, with monitoring to ensure successful completion. +- Abstracts the underlying SQL infrastructure, enabling consistent interactions with relational databases regardless of the cloud provider or database engine (e.g., PostgreSQL, MySQL). +- Optionally supports provisioning of the SQL database instance or cluster if not pre-existing, ensuring compatibility with the application. +- Enforces least privilege access by configuring secure roles and policies for database and migration operations, maintaining robust security standards. + +## 4. Code + +**Developers** write application code that uses the [SQL database resources](/sql) from the SDK, and implements the application logic to connect and interact with database. + +SDK Reference by language - + +- [NodeJS SDK](/reference/nodejs/sql/sql) +- [Python SDK](/reference/python/sql/sql) +- [GO SDK](/reference/go/sql/sql) +- [Dart SDK](/reference/dart/sql/sql) + +**Operations** will use or extend the Nitric Terraform reference modules: + +- [AWS SQL Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploytf/.nitric/modules/sql/main.tf) diff --git a/docs/architecture/topics.mdx b/docs/architecture/topics.mdx new file mode 100644 index 000000000..26f6aa0a1 --- /dev/null +++ b/docs/architecture/topics.mdx @@ -0,0 +1,136 @@ +--- +description: 'Nitric Topic' +--- + +# Messaging - Topics + +## 1. System Context + +**Developers** use Nitric to declare topics to enable event-driven communication within their application. + +- App code interacts with the [Topic resource](/messaging#topics) through defined topics and subscriptions. +- Developers configure topics and implement application logic to publish and consume messages. + +**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. + +
+ Example AWS Provider + +- **AWS SNS (Simple Notification Service)** serves as the messaging and event notification service. +- **AWS Lambda** functions are subscribed to SNS topics to process incoming messages. +- **AWS IAM** manages roles and policies for secure access to SNS topics and Lambda functions. +- **AWS Step Functions** make it possible to delay or schedule notifications, batch jobs, or any process that requires a timed pause before continuing with a task. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + SNSTopic["AWS SNS Topic"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + StepFunctions["AWS Step Functions"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create SNS Topic| SNSTopic + App -->|Configure Subscriptions| SNSTopic + App -->|Publish Messages| StepFunctions + SNSTopic -->|Invoke Lambda| Lambda + App -->|Manage Permissions| IAM + StepFunctions -->|Delayed Messages| SNSTopic + IAM -->SNSTopic + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+
+ Example GCP Provider + +- **Google Pub/Sub** serves as the messaging and event notification service. +- **Google Cloud Run** services are subscribed to Pub/Sub topics to process incoming messages. +- **Google IAM** manages roles and policies for secure access to Pub/Sub topics and Cloud Run services. +- **Retry Policy and Push Configuration** ensure reliable delivery and handling of messages to Cloud Run services. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + PubSubTopic["Google Pub/Sub Topic"] + CloudRun["Google Cloud Run Services"] + IAM["Google IAM"] + RetryConfig["Retry Policy & Push Config"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create Pub/Sub Topic| PubSubTopic + App -->|Configure Subscriptions| PubSubTopic + App -->|Publish Messages| RetryConfig + PubSubTopic -->|Push to Services| CloudRun + App -->|Manage Permissions| IAM + RetryConfig -->|Retry Delivery| PubSubTopic + IAM -->PubSubTopic + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+ +## 2. Sequence + +```mermaid +sequenceDiagram + participant Client as Client + participant NitricSDK as Nitric SDK + participant NitricRuntime as Nitric Runtime + participant TopicService as Cloud Topic Service (e.g., AWS SNS, GCP Pub/Sub) + participant Subscriber as Subscriber (e.g., Queue, Function) + + Client->>NitricSDK: Publish message to topic + NitricSDK->>NitricRuntime: Forward topic API call + NitricRuntime->>TopicService: Publish message to topic + + alt Successful Publish + TopicService-->>NitricRuntime: Confirm message delivery + NitricRuntime-->>NitricSDK: Return success confirmation + NitricSDK-->>Client: Return success to client + TopicService->>Subscriber: Distribute message to subscribers + Subscriber-->>TopicService: Acknowledge receipt of message + else Publish Failure + TopicService-->>NitricRuntime: Return error + NitricRuntime-->>NitricSDK: Forward error + NitricSDK-->>Client: Return error response + end +``` + +## 3. Component + +### Topic Module + +- Dynamically creates unique topics for messaging and event-driven communication, ensuring consistent naming and avoiding conflicts. +- Configures metadata or tags for resource identification, governance, and lifecycle management. +- Supports subscribing various endpoints (e.g., functions, services, queues) to the topic, enabling scalable publish-subscribe patterns. +- Automates the assignment of permissions to ensure secure publishing and subscription handling, following the principle of least privilege. +- Provides configurable retry policies and message delivery options to ensure reliable and fault-tolerant communication between services. +- Abstracts the underlying cloud messaging infrastructure, offering a unified interface for event-driven architectures across different providers. +- Optionally integrates with workflows or scheduling systems for advanced scenarios like delayed notifications or batched processing. + +## 4. Code + +**Developers** write application code that imports and declares the [Topic resource](/messaging#topics) from the SDK, and implements the application logic to publish and subscribe to topics. + +SDK Reference by language - + +- [NodeJS SDK](/reference/nodejs/topic/topic) +- [Python SDK](/reference/python/topic/topic) +- [GO SDK](/reference/go/topic/topic) +- [Dart SDK](/reference/dart/topic/topic) + +**Operations** will use or extend the Nitric Terraform reference modules: + +- [AWS Topic Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploytf/.nitric/modules/topic/main.tf) +- [GCP Topic Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/gcp/deploytf/.nitric/modules/topic/main.tf) diff --git a/docs/architecture/websockets.mdx b/docs/architecture/websockets.mdx new file mode 100644 index 000000000..4a02f3566 --- /dev/null +++ b/docs/architecture/websockets.mdx @@ -0,0 +1,102 @@ +--- +description: 'Nitric WebSocket API' +--- + +# WebSockets + +## 1. System Context + +**Developers** use Nitric to declare WebSocket APIs within their application. + +- App code interacts with the [WebSocket resource](/websocket) through defined routes and integrations. +- Developers implement backend logic to handle WebSocket connections, messages, and disconnections. + +**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. + +
+ Example AWS Provider + +- **AWS API Gateway v2** manages WebSocket API endpoints and routes. +- **AWS Lambda** functions handle WebSocket events such as connection, message reception, and disconnection. +- **AWS IAM** manages roles and policies for secure access between API Gateway and Lambda functions. + +```mermaid +flowchart TD + Developer["Developer"] + Operations["Operations"] + App["nitric up"] + APIGateway["AWS API Gateway v2
(WebSocket API)"] + Lambda["AWS Lambda Functions"] + IAM["AWS IAM"] + + Developer -->|Code| App + Operations -->|Terraform| App + App -->|Create WebSocket API| APIGateway + App -->|Configure Integrations| APIGateway + App -->|Deploy Lambda Functions| Lambda + APIGateway -->|Invoke Lambda/Handle Events| Lambda + App -->|Manage Permissions| IAM + IAM -->Lambda + IAM -->APIGateway + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +
+ +## 2. Sequence + +```mermaid +sequenceDiagram + participant Client as Client + participant NitricSDK as Nitric SDK + participant NitricRuntime as Nitric Runtime + participant WebSocketGateway as Cloud WebSocket Gateway (e.g., AWS API Gateway, GCP WebSocket Gateway) + + Client->>NitricSDK: Connect to WebSocket endpoint + NitricSDK->>NitricRuntime: Forward connection request + NitricRuntime->>WebSocketGateway: Establish WebSocket connection + + loop Real-Time Communication + Client->>NitricSDK: Send or receive WebSocket message + NitricSDK->>NitricRuntime: Forward message + NitricRuntime->>WebSocketGateway: Relay message + WebSocketGateway-->>NitricRuntime: Forward response or broadcast message + NitricRuntime-->>NitricSDK: Relay message to the client + NitricSDK-->>Client: Deliver message + end + + alt Disconnect + Client->>NitricSDK: Disconnect from WebSocket + NitricSDK->>NitricRuntime: Notify runtime + NitricRuntime->>WebSocketGateway: Close WebSocket connection + end +``` + +## 3. Component + +### WebSocket API Module + +- Dynamically creates and manages WebSocket APIs to enable real-time, bidirectional communication between clients and servers. +- Configures API properties such as protocol type, route selection expressions, and tags for governance and management. +- Automatically provisions and links backend integrations to handle events for connection establishment (`$connect`), message handling (`$default`), and disconnections (`$disconnect`). +- Grants permissions to enable secure communication between the WebSocket gateway and backend services, adhering to the principle of least privilege. +- Supports deployment of WebSocket APIs with automatic handling of stage configurations and versioning for seamless updates. +- Abstracts cloud-specific WebSocket services, ensuring a consistent developer experience across providers. +- Ensures fault-tolerant and scalable handling of WebSocket connections, supporting high-throughput scenarios with minimal configuration. + +## 4. Code + +**Developers** write application code that uses the [WebSocket resource](/websocket) from the SDK and implement backend logic to handle WebSocket connections, messages, and disconnections. + +SDK Reference by language - + +- [NodeJS SDK](/reference/nodejs/websocket/websocket) +- [Python SDK](/reference/python/websocket/websocket) +- [GO SDK](/reference/go/websocket/websocket) +- [Dart SDK](/reference/dart/websocket/websocket) + +**Operations** will use or extend the Nitric Terraform reference modules: + +- [AWS WebSocket Terrform Module](https://github.com/nitrictech/nitric/blob/main/cloud/aws/deploytf/.nitric/modules/websocket/main.tf) diff --git a/docs/guides/c4/c4-api.mdx b/docs/guides/c4/c4-api.mdx deleted file mode 100644 index 7641c3235..000000000 --- a/docs/guides/c4/c4-api.mdx +++ /dev/null @@ -1,151 +0,0 @@ ---- -description: 'C4 Api' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric 'API' Architecture - -## 1. System Context (Level 1) - -- A **Developer** uses Nitric to create and manage APIs within their application. - - App code interacts with the **API resource** through defined endpoints. - - Developers define API specifications and implement backend logic to handle requests. -- **Operations** use default or overridden Terraform modules to provision the necessary AWS API Gateway resources. - - **AWS API Gateway v2** serves as the HTTP API management service. - - **AWS Lambda** functions are deployed to handle API requests. - - **AWS IAM** (implicitly assumed) provides roles and policies for secure interaction between API Gateway and Lambda functions. - - **AWS ACM** manages SSL/TLS certificates for custom domain names. - -```mermaid -flowchart TD - Developer["Developer"] - Operations["Operations"] - App["nitric up"] - APIGateway["AWS API Gateway v2
(HTTP API)"] - Lambda["AWS Lambda Functions"] - IAM["AWS IAM"] - ACM["AWS ACM
(Certificates)"] - - Developer -->|Define API| App - Operations -->|Terraform| App - App -->|Create API Gateway| APIGateway - App -->|Deploy Lambda Functions| Lambda - App -->|Configure Permissions| IAM - APIGateway -->|Invoke| Lambda - ACM -->|Provide Certificates| APIGateway - IAM -->|Manage Access| APIGateway - App -->ACM - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 2. Container (Level 2) - -Each **API** is managed through AWS API Gateway v2 and interacts with backend Lambda functions to process HTTP requests. - -```mermaid -flowchart TD - Nitric["Nitric Application"] - Nitric -->B(API 1) - Nitric -->C(API 2) - Nitric -->D(...) - B(API 1) -->E(HTTP GET) - B(API 1) -->F(HTTP POST) - B(API 1) -->G(...) - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 3. Component (Level 3) - -### API Module - -- **aws_apigatewayv2_api.api_gateway** - - Creates an AWS API Gateway v2 HTTP API. - - Configures the API name, protocol type, API specification (`body`), and tags for identification and management. -- **aws_apigatewayv2_stage.stage** - - Creates a stage for the API Gateway. - - Sets the stage name to `$default` and enables automatic deployment of changes. -- **aws_lambda_permission.apigw_lambda** - - Grants API Gateway permission to invoke the specified Lambda functions. - - Iterates over `var.target_lambda_functions` to set permissions for each target function. -- **data.aws_acm_certificate.cert** - - Looks up existing ACM certificates for the specified domains. - - Iterates over `var.domains` to retrieve certificate details for each domain. -- **aws_apigatewayv2_domain_name.domain** - - - Creates custom domain names for the API Gateway using the retrieved ACM certificates. - - Configures domain name settings, including the certificate ARN, endpoint type, and security policy. - -## 4. Code (Level 4) - -**Developers** write application code that imports the 'api' resource from the SDK, configures the api, and implements HTTP routes, implement middleware, etc. - -```typescript -import { api } from '@nitric/sdk' - -const publicApi = api('public') - -api('public').get('/customers', (ctx) => { - // construct response for the GET: /customers request... - const responseBody = {} - ctx.res.json(responseBody) -}) - -const authMiddleware = async (ctx, next) => { - // Perform auth validation. - return await next(ctx) -} - -const privateApi = api('private', { middleware: authMiddleware }) -``` - -**Operations** will use the provided Terraform module to create and manage the AWS API Gateway as defined. - -```hcl -resource "aws_apigatewayv2_api" "api_gateway" { - name = var.name - protocol_type = "HTTP" - body = var.spec - tags = { - "x-nitric-${var.stack_id}-name" = var.name, - "x-nitric-${var.stack_id}-type" = "api", - } -} - -resource "aws_apigatewayv2_stage" "stage" { - api_id = aws_apigatewayv2_api.api_gateway.id - name = "$default" - auto_deploy = true -} - -# deploy lambda permissions for execution -resource "aws_lambda_permission" "apigw_lambda" { - for_each = var.target_lambda_functions - action = "lambda:InvokeFunction" - function_name = each.value - principal = "apigateway.amazonaws.com" - source_arn = "${aws_apigatewayv2_api.api_gateway.execution_arn}/*/*/*" -} - -# look up existing certificate for domains -data "aws_acm_certificate" "cert" { - for_each = var.domains - domain = each.value -} - -# deploy custom domain names -resource "aws_apigatewayv2_domain_name" "domain" { - for_each = var.domains - domain_name = each.value - domain_name_configuration { - certificate_arn = data.aws_acm_certificate.cert[each.key].arn - endpoint_type = "REGIONAL" - security_policy = "TLS_1_2" - } -} -``` diff --git a/docs/guides/c4/c4-big-picture.mdx b/docs/guides/c4/c4-big-picture.mdx deleted file mode 100644 index b1e4947fc..000000000 --- a/docs/guides/c4/c4-big-picture.mdx +++ /dev/null @@ -1,92 +0,0 @@ ---- -description: 'C4 Nitric High-Level Architecture' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric High-Level Architecture - -Nitric allows your team to work together to build an application: - -- **Developer**: Writes application code with built-in support for APIs, file storage (bucket), secrets, key‑value store, and RDS, leveraging the Nitric SDK. -- **Operations**: Customize, extend or use Nitric's generated IaC (Terraform or Pulumi) to provision and manage the resources that the developer needs for their application. -- **SRE**: Configure environment/region/policy specific details, they also are heavily involved in overseeing that the Terraform modules themselves adhere to governance standards. - -The roles above may overlap depending on your organization structure, for example, it is not abnormal Developers to assume all roles, or for Operations and SRE responsibilities to be handled by the same team. - -```mermaid -flowchart TD - Developer[Developer] - Operations[Operations] - SRE[Site Reliablility Engineer] - App[Nitric App - 'nitric up'] - Repo[Code Repository] - - API[API Gateway] - Bucket[Bucket - AWS S3] - Secrets[Secrets - AWS Secrets Manager\n] - KVStore[Key-Value Store - AWS DynamoDB] - RDS[Relational Database - AWS RDS/Aurora] - Other[Other resources] - - SRE -->|Deployment Config| Repo - Developer -->|Code| Repo - Operations -->|Extend/Customize Terraform| Repo - Repo-->App - - App -->|Exposes REST/HTTP Routes| API - App -->|Stores/Retrieves Files| Bucket - App -->|Manages Sensitive Data| Secrets - App -->|Reads/Writes Data| KVStore - App -->|Executes SQL Queries| RDS - App -->|1..n|Other - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -Nitric applications can have any number of APIs, Secrets, Buckets etc. Providers can also be extended to further support new resources, many which will work across all cloud providers and some that are cloud specific. - -## Example: Handling HTTP requests. - -Interaction with services that have been exposed as HTTP routes within an API gateway, Scheduled tasks, Event subscriptions, WebSocket handlers and more. - -```mermaid -flowchart TD - %% Actors - Browser[Client Browser] - - %% Nitric Application Containers - API[HTTP API - API Gateway] - Service[GET Route] - Service2[POST Route] - Service3[...] - - %% Backend Services / Resources - Bucket[AWS S3 Bucket] - Secrets[AWS Secrets Manager] - KVStore[AWS DynamoDB - Key-Value Store] - RDS[AWS RDS/Aurora] - - %% Interactions - Browser -->|Sends HTTP Request| API - API -->|Triggers Service| Service - API -->|Triggers Service| Service2 - API -->|Triggers Service| Service3 - Service -->|Manage/Uploads/Downloads files| Bucket - Service -->|Retrieves credentials/config data| Secrets - Service -->|Reads/Writes key data| KVStore - Service -->|Queries/Updates relational data| RDS - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -- The **Client Browser** sends an HTTP request to the **API Gateway**. -- The **API Gateway** acts as a proxy, forwarding the request to the appropriate **Services**. -- The **Services** process the request by coordinating with different backend services, this is done through : - - They interact with one or more **AWS S3 Bucket** to manage files. - - They retrieve credentials or configuration from **AWS Secrets Manager**. - - They use **AWS DynamoDB** for fast key-value operations. - - They query or update structured data in **AWS RDS/Aurora**. diff --git a/docs/guides/c4/c4-buckets.mdx b/docs/guides/c4/c4-buckets.mdx deleted file mode 100644 index 12ecb050a..000000000 --- a/docs/guides/c4/c4-buckets.mdx +++ /dev/null @@ -1,135 +0,0 @@ ---- -description: 'C4 Buckets' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric 'Bucket' Architecture - -## 1. System Context (Level 1) - -- A **Developer** uses Nitric to manage S3 buckets within their application. - - App code imports the **Bucket resource** from the Nitric SDK. - - Developers configure buckets and implement application logic to securely access and manipulate bucket data. - - Developers can also implement hanlders for on events like on read, write or delete. -- **Operations** use default or overridden Terraform modules to provision the necessary AWS S3 resources. - - **AWS S3** serves as the storage backend. - - **AWS Lambda** functions are used to process events triggered by S3. - - **AWS IAM** provides roles and policies for secure access to S3 buckets and Lambda functions. - - **Random ID** resource is used to generate unique bucket names. - -```mermaid -flowchart TD - Developer["Developer"] - Operations["Operations"] - App["nitric up"] - S3Bucket["AWS S3 Bucket"] - Lambda["AWS Lambda Functions"] - IAM["AWS IAM"] - - Developer -->|Code| App - Operations -->|Terraform| App - App -->|Create S3 Bucket| S3Bucket - App -->|Configure Notifications| S3Bucket - App -->|Allow Lambda Invocation| Lambda - S3Bucket -->|Store/Retrieve Data| App - Lambda -->|Process Events| App - App -->|Provide Access| IAM - IAM -->S3Bucket - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 2. Container (Level 2) - -Each **Bucket** is managed through AWS S3 and accessed by the application through securely configured mechanisms provided by Nitric. - -```mermaid -flowchart TD - Nitric["Nitric Application"] - Nitric -->B(Bucket 1) - Nitric -->C(Bucket 2) - Nitric -->D(...) - B(BUCKET 1) -->E(ON Read) - B(BUCKET 1) -->F(ON Write) - B(BUCKET 1) -->G(ON Delete) -``` - -## 3. Component (Level 3) - -### Bucket Module - -- **random_id.bucket_id** - - Generates a random ID for the S3 bucket to ensure unique naming. -- **aws_s3_bucket.bucket** - - Creates an AWS S3 bucket with a unique name by appending the generated random ID. - - Configures tags for identification and management. -- **aws_lambda_permission.allow_bucket** - - Grants AWS S3 permission to invoke the specified Lambda functions. - - Iterates over `var.notification_targets` to set permissions for each target. -- **aws_s3_bucket_notification.bucket_notification** - - Configures S3 bucket notifications to trigger Lambda functions based on specified events. - - Uses dynamic blocks to handle multiple Lambda function notifications. - -## 4. Code (Level 4) - -**Developers** write application code that imports the 'bucket' resource from the SDK, configures the bucket, and implements the application logic to read, write and delete files. - -```typescript -import { bucket } from '@nitric/sdk' - -const profiles = bucket('profiles').allow('read') - -const image = await profiles.file('users/bruce-wayne/profile.png').read() -``` - -**Operations** will use the provided Terraform module to create and manage the AWS S3 Buckets as defined. - -```hcl - -# Generate a random id for the bucket -resource "random_id" "bucket_id" { - byte_length = 8 - - keepers = { - # Generate a new id each time we switch to a new AMI id - bucket_name = var.bucket_name - } -} - -# AWS S3 bucket -resource "aws_s3_bucket" "bucket" { - bucket = "${var.bucket_name}-${random_id.bucket_id.hex}" - - tags = { - "x-nitric-${var.stack_id}-name" = var.bucket_name - "x-nitric-${var.stack_id}-type" = "bucket" - } -} - -# Deploy bucket lambda invocation permissions -resource "aws_lambda_permission" "allow_bucket" { - for_each = var.notification_targets - action = "lambda:InvokeFunction" - function_name = each.value.arn - principal = "s3.amazonaws.com" - source_arn = aws_s3_bucket.bucket.arn -} - -# Deploy lambda notifications -resource "aws_s3_bucket_notification" "bucket_notification" { - bucket = aws_s3_bucket.bucket.id - - // make dynamic blocks for lambda function - dynamic "lambda_function" { - for_each = var.notification_targets - content { - lambda_function_arn = lambda_function.value.arn - events = lambda_function.value.events - filter_prefix = lambda_function.value.prefix - } - } -} -``` diff --git a/docs/guides/c4/c4-keyvalue.mdx b/docs/guides/c4/c4-keyvalue.mdx deleted file mode 100644 index 2a6fc2b68..000000000 --- a/docs/guides/c4/c4-keyvalue.mdx +++ /dev/null @@ -1,96 +0,0 @@ ---- -description: 'C4 KV' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric 'KVStore' Architecture - -## 1. System Context (Level 1) - -- A **Developer** uses Nitric to manage key-value stores within their application. - - App code imports the **KVStore resource** from the Nitric SDK. - - Developers configure key-value stores and implement application logic to securely access and manipulate data. -- **Operations** use default or overridden Terraform modules to provision the necessary AWS DynamoDB resources. - - **AWS DynamoDB** serves as the key-value store backend. - - **AWS IAM** provides roles and policies for secure access to DynamoDB tables. - -```mermaid -flowchart TD - Developer["Developer"] - Operations["Operations"] - App["nitric up"] - DynamoDB["AWS DynamoDB
(Key-Value Store)"] - IAM["AWS IAM"] - - Developer -->|Code| App - Operations -->|Terraform| App - App -->|Create DynamoDB Table| DynamoDB - App -->|Access DynamoDB| IAM - DynamoDB -->|Store/Retrieve Data| App - IAM -->|Provide Access| App - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 2. Container (Level 2) - -Each **KVStore** is managed through AWS DynamoDB and accessed by the application through securely configured mechanisms provided by Nitric. - -```mermaid -flowchart TD - Nitric["Nitric Application"] - Nitric -->B(KVStore 1) - Nitric -->C(KVStore 2) - Nitric -->D(...) -``` - -## 3. Component (Level 3) - -### KVStore Module - -- **aws_dynamodb_table.table** - - Deploys an AWS DynamoDB table with specified attributes, hash key, range key, billing mode, and tags for identification and management. - -## 4. Code (Level 4) - -**Developers** write application code that imports the 'secret' resource from the SDK, configures the secret, and implements the application logic to access and manage secrets. - -```typescript -import { kv } from '@nitric/sdk' - -const countries = kv('Countries').allow('delete', 'set') - -await countries.set('USA', { - name: 'United States of America', - population: 329500000, -}) - -await countries.delete('USA') -``` - -**Operations** will use the provided Terraform module to create and manage the KeyValue store as defined. - -```hcl -# Deploy an aws dynamodb table -resource "aws_dynamodb_table" "table" { - name = var.kvstore_name - attribute { - name = "_pk" - type = "S" - } - attribute { - name = "_sk" - type = "S" - } - hash_key = "_pk" - range_key = "_sk" - billing_mode = "PAY_PER_REQUEST" - tags = { - "x-nitric-${var.stack_id}-name" = var.kvstore_name - "x-nitric-${var.stack_id}-type" = "kvstore" - } -} -``` diff --git a/docs/guides/c4/c4-queues.mdx b/docs/guides/c4/c4-queues.mdx deleted file mode 100644 index 442c58540..000000000 --- a/docs/guides/c4/c4-queues.mdx +++ /dev/null @@ -1,82 +0,0 @@ ---- -description: 'C4 Queues' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric 'Queue' Architecture - -## 1. System Context (Level 1) - -- A **Developer** uses Nitric to manage message queues within their application. - - App code imports the **Queue resource** from the Nitric SDK. - - Developers configure queues and implement application logic to send and receive messages. -- **Operations** use default or overridden Terraform modules to provision the necessary AWS SQS resources. - - **AWS SQS** serves as the message queuing service. - - **AWS IAM** provides roles and policies for secure access to SQS queues. - -```mermaid -flowchart TD - Developer["Developer"] - Operations["Operations"] - App["nitric up"] - SQSQueue["AWS SQS Queue"] - IAM["AWS IAM"] - - Developer -->|Code| App - Operations -->|Terraform| App - App -->|Create SQS Queue| SQSQueue - App -->|Access SQS Queue| IAM - SQSQueue -->|Send/Receive Messages| App - IAM -->|Provide Access| App - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 2. Container (Level 2) - -Each **Queue** is managed through AWS SQS and accessed by the application through securely configured mechanisms provided by Nitric. - -```mermaid -flowchart TD - Nitric["Nitric Application"] - Nitric -->B(Queue 1) - Nitric -->C(Queue 2) - Nitric -->D(...) -``` - -## 3. Component (Level 3) - -### Queue Module - -- **aws_sqs_queue.queue** - - Deploys an AWS SQS queue with a specified name. - - Configures tags for identification and management. - -## 4. Code (Level 4) - -**Developers** write application code that imports the 'secret' resource from the SDK, configures the secret, and implements the application logic to access and manage secrets. - -```typescript -import { queue } from '@nitric/sdk' - -const payload = {} -const batchQueue = queue('batch').allow('dequeue') - -const messages = await batchQueue.enqueue() -``` - -**Operations** will use the provided Terraform module to create and manage the AWS SQS queues as defined. - -```hcl -# Deploy an SQS queue -resource "aws_sqs_queue" "queue" { - name = var.queue_name - tags = { - "x-nitric-${var.stack_id}-name" = var.queue_name - "x-nitric-${var.stack_id}-type" = "queue" - } -} -``` diff --git a/docs/guides/c4/c4-rds.mdx b/docs/guides/c4/c4-rds.mdx deleted file mode 100644 index fc8625654..000000000 --- a/docs/guides/c4/c4-rds.mdx +++ /dev/null @@ -1,253 +0,0 @@ ---- -description: 'C4' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric 'RDS' Architecture - -## 1. System Context (Level 1) - -- A **Developer** uses Nitric to manage relational databases and automate database creation within their application. - - App code interacts with the **RDS Cluster** for data storage and retrieval. - - Developers utilize **CodeBuild** projects to automate database setup and migrations. -- **Operations** use default or overridden Terraform modules to provision the necessary AWS resources. - - **AWS RDS** provides a scalable and managed relational database service. - - **AWS CodeBuild** automates the process of setting up and managing the database schema. - - **AWS IAM** manages roles and permissions for secure access to AWS resources. - - **AWS VPC** ensures network isolation and security for the database instances. - -```mermaid -flowchart TD - Developer["Developer"] - Operations["Operations"] - App["nitric up"] - RDSCluster["AWS RDS Cluster"] - CodeBuild["AWS CodeBuild"] - IAM["AWS IAM"] - VPC["AWS VPC"] - - Developer -->|Code| App - Operations -->|Terraform| App - App -->|Provision RDS Cluster| RDSCluster - App -->|Configure CodeBuild| CodeBuild - RDSCluster <-->|Store/Retrieve Data| App - CodeBuild -->|Automate Database Setup| RDSCluster - IAM -->|Manage Permissions| RDSCluster - VPC -->|Network Security| RDSCluster - App -->IAM - App -->VPC - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 2. Container (Level 2) - -The system comprises several AWS services orchestrated through Terraform to provide a secure and scalable relational database environment with automated deployment capabilities. - -```mermaid -flowchart TD - Nitric["Nitric Application"] - Nitric -->A(RDS Cluster) - Nitric -->B(CodeBuild Project) - Nitric -->C(IAM Roles) - Nitric -->D(VPC Configuration) - Nitric -->E(Security Groups) -``` - -## 3. Component (Level 3) - -### RDS Module - -- **random_password.rds_password** - - Generates a secure random password for the RDS cluster. -- **aws_db_subnet_group.rds_subnet_group** - - Creates a subnet group for the RDS instance to ensure it is deployed within the specified private subnets. -- **aws_security_group.rds_security_group** - - Defines a security group for the RDS instance, allowing inbound traffic on port 5432 (PostgreSQL) from within the VPC and allowing all outbound traffic. -- **aws_iam_role.codebuild_role** - - Creates an IAM role for AWS CodeBuild with a trust relationship allowing CodeBuild to assume the role. -- **aws_iam_role_policy_attachment.codebuild_managed_policies** - - Attaches managed IAM policies to the CodeBuild role to grant necessary permissions for CodeBuild operations. -- **aws_rds_cluster.rds_cluster** - - Creates an AWS RDS cluster with Aurora PostgreSQL engine, configuring it for serverless v2 with specified scaling parameters. -- **aws_rds_cluster_instance.rds_cluster_instance** - - Creates an instance within the RDS cluster, specifying the instance class and engine details. -- **aws_codebuild_project.create_database** - - Sets up an AWS CodeBuild project to automate the creation of the database within the RDS cluster. It includes environment variables, VPC configuration, and build specifications. - -## 4. Code (Level 4) - -**Developers** write application code that imports the 'rds' resource from the SDK, configures and connects to an RDS. - -```typescript -import { api, sql } from '@nitric/sdk' -import { PrismaClient } from '@prisma/client' - -const mainApi = api('main') -const db = sql('my-data') - -let prisma -const getClient = async () => { - // ensure we only create the client once - if (!prisma) { - const connectionString = await db.connectionString() - - prisma = new PrismaClient({ - datasourceUrl: connectionString, - }) - } - return prisma -} -``` - -**Operations** will use the provided Terraform module to create and manage the AWS RDS as defined. - -```hcl -# Create a new random password for the RDS cluster -resource "random_password" "rds_password" { - length = 16 - special = false -} - -# Create a subnet group for the RDS instance -resource "aws_db_subnet_group" "rds_subnet_group" { - subnet_ids = var.private_subnet_ids -} - -# Create a security group for the RDS instance -resource "aws_security_group" "rds_security_group" { - vpc_id = var.vpc_id - - ingress { - from_port = 5432 - to_port = 5432 - protocol = "tcp" - self = true - } - - egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - } -} - -# Create a role for the codebuild job -resource "aws_iam_role" "codebuild_role" { - name = "nitric-codebuild-role" - assume_role_policy = jsonencode({ - Version = "2012-10-17", - Statement = [ - { - Effect = "Allow", - Principal = { - Service = "codebuild.amazonaws.com" - }, - Action = "sts:AssumeRole" - } - ] - }) -} - -# Attach managed policies to the codebuild role -locals { - codebuildManagedPolicies = { - "codeBuildAdmin" = "arn:aws:iam::aws:policy/AWSCodeBuildAdminAccess" - "rdsAdmin" = "arn:aws:iam::aws:policy/AmazonRDSFullAccess" - "ec2Admin" = "arn:aws:iam::aws:policy/AmazonEC2FullAccess" - "cloudWatchLogs" = "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess" - "ecrReadonly" = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly" - } -} - -resource "aws_iam_role_policy_attachment" "codebuild_managed_policies" { - for_each = local.codebuildManagedPolicies - - role = aws_iam_role.codebuild_role.name - policy_arn = each.value -} - -# Create an RDS cluster with serverless v2 -resource "aws_rds_cluster" "rds_cluster" { - cluster_identifier = "nitric-rds-cluster" - engine = "aurora-postgresql" - engine_mode = "provisioned" - engine_version = "13.14" - database_name = "nitric" - master_username = "nitric" - master_password = random_password.rds_password.result - db_subnet_group_name = aws_db_subnet_group.rds_subnet_group.id - vpc_security_group_ids = [aws_security_group.rds_security_group.id] - skip_final_snapshot = true - deletion_protection = false - serverlessv2_scaling_configuration { - max_capacity = var.max_capacity - min_capacity = var.min_capacity - } -} - -# Create a rds cluster instance -resource "aws_rds_cluster_instance" "rds_cluster_instance" { - cluster_identifier = aws_rds_cluster.rds_cluster.id - instance_class = "db.serverless" - engine = aws_rds_cluster.rds_cluster.engine - engine_version = aws_rds_cluster.rds_cluster.engine_version - db_subnet_group_name = aws_rds_cluster.rds_cluster.db_subnet_group_name -} - - - -# Create an AWS Codebuild job to create a database on the RDS cluster -resource "aws_codebuild_project" "create_database" { - name = "nitric-create-database" - description = "Create the database on the RDS cluster" - build_timeout = 60 - service_role = aws_iam_role.codebuild_role.arn - - artifacts { - type = "NO_ARTIFACTS" - } - - - environment { - compute_type = "BUILD_GENERAL1_SMALL" - image = "aws/codebuild/amazonlinux2-x86_64-standard:4.0" - type = "LINUX_CONTAINER" - - environment_variable { - name = "DB_PASSWORD" - value = random_password.rds_password.result - type = "PLAINTEXT" - } - } - - - vpc_config { - subnets = var.private_subnet_ids - security_group_ids = aws_rds_cluster.rds_cluster.vpc_security_group_ids - vpc_id = var.vpc_id - } - - source { - type = "NO_SOURCE" - buildspec = jsonencode({ - version = "0.2", - phases = { - build = { - commands = [ - "echo 'Creating database $DB_NAME'", - # FIXME: Store the password in a secret manager - "export PGPASSWORD=$${DB_PASSWORD}", - # "CREATE DATABASE ${DB_NAME}" || echo "database ${DB_NAME} already exists" - "psql -h ${aws_rds_cluster.rds_cluster.endpoint} -U ${aws_rds_cluster.rds_cluster.master_username} -d ${aws_rds_cluster.rds_cluster.database_name} -c \"CREATE DATABASE $${DB_NAME}\" || echo \"database $${DB_NAME} already exists\"" - ] - } - } - }) - } -} -``` diff --git a/docs/guides/c4/c4-schedules.mdx b/docs/guides/c4/c4-schedules.mdx deleted file mode 100644 index 5afd33c78..000000000 --- a/docs/guides/c4/c4-schedules.mdx +++ /dev/null @@ -1,137 +0,0 @@ ---- -description: 'C4 Schedules' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric 'Schedule' Architecture - -## 1. System Context (Level 1) - -- A **Developer** uses Nitric to write and deploy their application, - - App code will import the **Schedule resource** from the Nitric SDK. - - Developers configure the schedule with CRON or rate expressions like '7 days' and implement application logic to be executed. -- **Operations** use default/extended or overridden Terraform modules to provision the neccessary resources to run the schedule. - - **Lambda function** is deployed as a packaged container image uploaded to an Amazon Elastic Container Registry (Amazon ECR). - - **AWS EventBridge** is used to schedule and trigger Lambda functions. - - **AWS IAM** provides the role/policies allowing EventBridge to invoke the Lambda functions securely. - -```mermaid -flowchart TD - Developer["Developer"] - Operations["Operations"] - App["nitric up"] - EventBridge["EventBridge
(AWS Scheduler)"] - Lambda["AWS Lambda
Deployed function(s)"] - IAM["AWS IAM"] - - Developer -->|Code| App - Operations -->|Terraform| App - App -->|Create AWS schedules| EventBridge - App -->|Create AWS IAM Roles / Policies| IAM - EventBridge -->|Invokes| Lambda - IAM -->|Attach Policy| Lambda - App -->|Deploy container app| Lambda - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 2. Container (Level 2) - -Each **Schedule** is deployed as a Lambda function from a container image that has been packaged with either Docker or Podman and uploaded to an Amazon Elastic Container Registry (Amazon ECR) repository. - -```mermaid -flowchart TD - Nitric["Nitric Application"] - Nitric -->B(API 1) - Nitric -->C(Schedule 1) - Nitric -->E(API 2) - Nitric -->F(Schedule 2) - Nitric -->G(...) - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 3. Component (Level 3) - -Schedules Module - -- **aws_iam_role.role** creates the IAM role for `scheduler.amazonaws.com`. -- **aws_iam_role_policy.role_policy** attaches the correct policy (i.e., `lambda:InvokeFunction`) to that role. -- **aws_scheduler_schedule.schedule** configures EventBridge Scheduler with the Cron (or rate) expression, the time zone, and the role ARN. - - When triggered it passes an event payload (`"x-nitric-schedule": var.schedule_name`) in the request. - -## 4. Code (Level 4) - -**Developers** write application code like the following examples that import the 'schedule' resource from the SDK, configure the schedule and implement the application code that will execute. - -```typescript -import { schedule } from '@nitric/sdk' - -// Run every 5 minutes -schedule('process-transactions').every('5 minutes', async (ctx) => { - console.log(`processing at ${new Date().toLocaleString()}`) -}) - -// Run at 22:00 Monday through Friday. -schedule('send-reminder').cron('0 22 * * 1-5', async (ctx) => { - console.log(`reminder at ${new Date().toLocaleString()}`) -}) -``` - -**Operations** will accept or override the default Nitric schedule Terraform provider. - -```hcl -# Create role and policy to allow schedule to invoke lambda -resource "aws_iam_role" "role" { - assume_role_policy = jsonencode({ - Version = "2012-10-17", - Statement = [ - { - Effect = "Allow", - Principal = { - Service = "scheduler.amazonaws.com" - }, - Action = "sts:AssumeRole" - } - ] - }) -} - -resource "aws_iam_role_policy" "role_policy" { - role = aws_iam_role.role.id - policy = jsonencode({ - Version = "2012-10-17", - Statement = [ - { - Effect = "Allow", - Action = "lambda:InvokeFunction", - Resource = var.target_lambda_arn - } - ] - }) -} - -# Create an AWS eventbridge schedule -resource "aws_scheduler_schedule" "schedule" { - flexible_time_window { - mode = "OFF" - } - - schedule_expression_timezone = var.schedule_timezone - - schedule_expression = var.schedule_expression - - target { - arn = var.target_lambda_arn - role_arn = aws_iam_role.role.arn - - input = jsonencode({ - "x-nitric-schedule": var.schedule_name - }) - } -} -``` diff --git a/docs/guides/c4/c4-secrets.mdx b/docs/guides/c4/c4-secrets.mdx deleted file mode 100644 index 91e4222c5..000000000 --- a/docs/guides/c4/c4-secrets.mdx +++ /dev/null @@ -1,89 +0,0 @@ ---- -description: 'C4 Secrets' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric 'Secret' Architecture - -## 1. System Context (Level 1) - -- A **Developer** uses Nitric to manage secrets within their application. - - App code imports the **Secret resource** from the Nitric SDK. - - Developers configure secrets and implement application logic to securely access and manage these secrets. -- **Operations** use default or overridden Terraform modules to provision the necessary AWS Secrets Manager resources. - - **AWS Secrets Manager** stores and manages secrets. - - **AWS IAM** provides roles/policies for secure access to secrets. - -```mermaid -flowchart TD - Developer["Developer"] - Operations["Operations"] - App["nitric up"] - SecretsManager["AWS Secrets Manager"] - IAM["AWS IAM"] - - Developer -->|Code| App - Operations -->|Terraform| App - App -->|Create Secret| SecretsManager - App -->|Access Secret| IAM - SecretsManager -->|Store/Retrieve Secret| App - IAM -->|Provide Access| App - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 2. Container (Level 2) - -Each **Secret** is managed through AWS Secrets Manager and is accessed by the application through securely configured mechanisms provided by Nitric. - -```mermaid -flowchart TD - Nitric["Nitric Application"] - Nitric -->B(Secret 1) - Nitric -->C(Secret 2) - Nitric -->D(...) - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 3. Component (Level 3) - -### Secrets Module - -- **aws_secretsmanager_secret.secret** - - Creates a new secret in AWS Secrets Manager. - - Configures the secret name and tags for identification and management. - -## 4. Code (Level 4) - -**Developers** write application code that imports the 'secret' resource from the SDK, configures the secret, and implements the application logic to access and manage secrets. - -```typescript -import { secret } from '@nitric/sdk' - -// Define a secret with permission to put a new value -const apiKey = secret('api-key').allow('put') - -// Store a new secret value -const latestVersion = await apiKey.put('a new secret value') - -// Retrieve the version ID of the newly stored value -console.log(`Secret version ID: ${latestVersion.version}`) -``` - -**Operations** will use the provided Terraform module to create and manage the AWS Secrets Manager secret as defined. - -```hcl -# Create a new AWS Secrets Manager secret -resource "aws_secretsmanager_secret" "secret" { - name = var.secret_name - tags = { - "x-nitric-${var.stack_id}-name" = var.secret_name - "x-nitric-${var.stack_id}-type" = "secret" - } -} -``` diff --git a/docs/guides/c4/c4-services.mdx b/docs/guides/c4/c4-services.mdx deleted file mode 100644 index 693c62edb..000000000 --- a/docs/guides/c4/c4-services.mdx +++ /dev/null @@ -1,234 +0,0 @@ ---- -description: 'C4 Services' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric 'Service Deployment' Architecture - -## 1. System Context (Level 1) - -- A **Developer** uses Nitric to deploy and manage serverless functions within their application. - - App code interacts with the **Service resource** through defined functions. - - Developers build container images for their Lambda functions and push them to a container registry. -- **Operations** use default or overridden Terraform modules to provision the necessary AWS resources. - - **AWS ECR (Elastic Container Registry)** stores container images for Lambda functions. - - **AWS Lambda** runs serverless functions based on the container images. - - **AWS IAM** manages roles and policies for secure access to AWS resources. - - **Docker** is used to build and tag container images before pushing them to ECR. - -```mermaid -flowchart TD - Developer["Developer"] - Operations["Operations"] - App["nitric up"] - ECR["AWS ECR
(Container Registry)"] - Lambda["AWS Lambda
(Containerized Functions)"] - IAM["AWS IAM"] - Docker["Docker
(Image Building)"] - - Developer -->|Code| App - App -->|Build & Push Image| Docker - Docker -->|Push to| ECR - Operations -->|Terraform| App - - App -->|Access ECR| IAM - ECR -->|Provide Image| Lambda - IAM -->|Manage Permissions| App - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 2. Container (Level 2) - -Each **Service** is containerized, stored in AWS ECR, and deployed using AWS Lambda. The deployment process involves building, tagging, and pushing Docker images to ECR, followed by deploying them as Lambda functions. - -```mermaid -flowchart TD - Nitric["Nitric Application"] - Nitric -->A(Function 1) - Nitric -->B(Function 2) - Nitric -->C(...) - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 3. Component (Level 3) - -### Lambda Deployment Module - -- **terraform `{ required_providers { docker = { source = "kreuzwerker/docker" version = "3.0.2" } } }`** - - Configures Terraform to use the Docker provider for managing Docker images and containers. -- **aws_ecr_repository.repo** - - Creates an AWS ECR repository to store container images for Lambda functions. -- **data.aws_ecr_authorization_token.ecr_auth** - - Retrieves an authorization token for authenticating Docker with AWS ECR. -- **docker_tag.tag** - - Tags the provided Docker image with the ECR repository URL. -- **docker_registry_image.push** - - Pushes the tagged Docker image to the ECR repository. -- **aws_iam_role.role** - - Creates an IAM role for the Lambda function with a trust relationship allowing Lambda to assume the role. -- **aws_iam_role_policy.resource-list-access** - - Attaches a custom IAM policy to the Lambda role, granting permissions to list various AWS resources. -- **aws_iam_role_policy_attachment.basic-execution** - - Attaches the AWSLambdaBasicExecutionRole managed policy to the Lambda role for basic Lambda execution permissions. -- **aws_iam_role_policy_attachment.vpc-access** - - Conditionally attaches the AWSLambdaVPCAccessExecutionRole managed policy to the Lambda role if VPC subnets are provided. -- **aws_lambda_function.function** - - Creates a Lambda function using the container image pushed to ECR. Configures environment variables, memory, timeout, and optionally VPC settings. - -## 4. Code (Level 4) - -**Developers** write application code that implements handlers for the the 'api','bucket','websocket',"topic", "schedule" resources from the SDK. - -```typescript -import { api } from '@nitric/sdk' - -const customerRoute = api('public').route(`/customers`) - -customerRoute.get((ctx) => { - // construct response for the GET: /customers request... - const responseBody = {} - ctx.res.json(responseBody) -}) -``` - -```typescript -import { bucket } from '@nitric/sdk' - -const assets = bucket('assets') - -const accessibleAssets = bucket('assets').allow('delete') - -// The request will contain the name of the file `key` and the type of event `type` -assets.on('delete', '*', (ctx) => { - console.log(`A file named ${ctx.req.key} was deleted`) -}) -``` - -**Operations** will use the provided Terraform module to create and manage the Service deployment as defined. - -```hcl -terraform { - required_providers { - docker = { - source = "kreuzwerker/docker" - version = "3.0.2" - } - } -} - -# Create an ECR repository -resource "aws_ecr_repository" "repo" { - name = var.service_name - image_tag_mutability = "IMMUTABLE" -} - -data "aws_ecr_authorization_token" "ecr_auth" { -} - -# Tag the provided docker image with the ECR repository url -resource "docker_tag" "tag" { - source_image = var.image - target_image = aws_ecr_repository.repo.repository_url -} - -# Push the tagged image to the ECR repository -resource "docker_registry_image" "push" { - name = aws_ecr_repository.repo.repository_url - triggers = { - source_image_id = docker_tag.tag.source_image_id - } -} - -# Create a role for the lambda function -resource "aws_iam_role" "role" { - name = var.service_name - assume_role_policy = jsonencode({ - Version = "2012-10-17" - Statement = [ - { - Effect = "Allow" - Principal = { - Service = "lambda.amazonaws.com" - } - Action = "sts:AssumeRole" - } - ] - }) -} - -# TODO Make a common policy and attach separately -# as a base common compute policy -resource "aws_iam_role_policy" "resource-list-access" { - name = "resource-list-access" - role = aws_iam_role.role.name - - policy = jsonencode({ - Version = "2012-10-17" - Statement = [ - { - Effect = "Allow" - Action = [ - "sns:ListTopics", - "sqs:ListQueues", - "dynamodb:ListTables", - "s3:ListAllMyBuckets", - "tag:GetResources", - "apigateway:GET", - ] - Resource = "*" - } - ] - }) -} - - -resource "aws_iam_role_policy_attachment" "basic-execution" { - role = aws_iam_role.role.name - policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" -} - -# Attach vpc access execution role if subnets are provided -resource "aws_iam_role_policy_attachment" "vpc-access" { - count = length(var.subnet_ids) > 0 ? 1 : 0 - role = aws_iam_role.role.name - policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole" -} - -# Create a lambda function using the pushed image -resource "aws_lambda_function" "function" { - function_name = "${var.service_name}-${var.stack_id}" - role = aws_iam_role.role.arn - image_uri = "${aws_ecr_repository.repo.repository_url}@${docker_registry_image.push.sha256_digest}" - package_type = "Image" - timeout = var.timeout - memory_size = var.memory - ephemeral_storage { - size = var.ephemeral_storage - } - environment { - variables = var.environment - } - - - dynamic "vpc_config" { - for_each = length(var.subnet_ids) > 0 ? ["1"] : [] - content { - subnet_ids = var.subnet_ids - security_group_ids = var.security_group_ids - } - } - - depends_on = [docker_registry_image.push] - - tags = { - "x-nitric-${var.stack_id}-name" = var.service_name, - "x-nitric-${var.stack_id}-type" = "service", - } -} -``` diff --git a/docs/guides/c4/c4-topics.mdx b/docs/guides/c4/c4-topics.mdx deleted file mode 100644 index bd0bdb3c8..000000000 --- a/docs/guides/c4/c4-topics.mdx +++ /dev/null @@ -1,201 +0,0 @@ ---- -description: 'C4 Topics' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric 'Topic' Architecture - -## 1. System Context (Level 1) - -- A **Developer** uses Nitric to manage messaging and event-driven communication within their application. - - App code interacts with the **SNS Topic resource** through defined topics and subscriptions. - - Developers configure SNS topics and implement application logic to publish and consume messages. -- **Operations** use default or overridden Terraform modules to provision the necessary AWS SNS resources. - - **AWS SNS (Simple Notification Service)** serves as the messaging and event notification service. - - **AWS Lambda** functions are subscribed to SNS topics to process incoming messages. - - **AWS IAM** manages roles and policies for secure access to SNS topics and Lambda functions. - - **AWS Step Functions** orchestrate workflows that interact with SNS topics. - -```mermaid -flowchart TD - Developer["Developer"] - Operations["Operations"] - App["nitric up"] - SNSTopic["AWS SNS Topic"] - Lambda["AWS Lambda Functions"] - IAM["AWS IAM"] - StepFunctions["AWS Step Functions"] - - Developer -->|Code| App - Operations -->|Terraform| App - App -->|Create SNS Topic| SNSTopic - App -->|Configure Subscriptions| SNSTopic - App -->|Publish Messages| StepFunctions - SNSTopic -->|Invoke Lambda| Lambda - App -->|Manage Permissions| IAM - StepFunctions -->|Orchestrate Workflows| SNSTopic - Lambda -->|Process Messages| App - IAM -->SNSTopic - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 2. Container (Level 2) - -Each **SNS Topic** is managed through AWS SNS and interacts with subscribed AWS Lambda functions and AWS Step Functions to handle event-driven workflows. - -```mermaid -flowchart TD - Nitric["Nitric Application"] - Nitric -->A(SNS Topic 1) - Nitric -->B(SNS Topic 2) - Nitric -->C(...) - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 3. Component (Level 3) - -### SNS Topic Module - -- **random_id.topic_id** - - Generates a unique random ID for each SNS topic to ensure unique naming. -- **aws_sns_topic.topic** - - Creates an AWS SNS topic with a unique name by appending the generated random ID. - - Configures tags for identification and management. -- **aws_sns_topic_subscription.subscription** - - Subscribes Lambda functions to the SNS topic. - - Iterates over `var.lambda_subscribers` to create subscriptions for each Lambda endpoint. -- **aws_lambda_permission.sns** - - Grants SNS permission to invoke the specified Lambda functions. - - Iterates over `var.lambda_subscribers` to set permissions for each target function. -- **aws_iam_role.sns_publish_role** - - Creates an IAM role for AWS Step Functions to publish messages to the SNS topic. - - Defines a trust relationship allowing Step Functions to assume the role. -- **aws_iam_role_policy.publish_policy** - - Attaches an inline policy to the SNS publish role, granting permissions to publish messages to the SNS topic. -- **aws_sfn_state_machine.publish_to_topic** - - Creates an AWS Step Functions state machine that publishes messages to the SNS topic. - - Defines the workflow with a wait state followed by a publish task. - -## 4. Code (Level 4) - -**Developers** write application code that imports the 'topic' resource from the SDK, and implements the application logic to publish and subscript to topics. - -```typescript -import { topic } from '@nitric/sdk' - -const updates = topic('updates').allow('publish') - -await updates.publish({ - something: 'amazing happened', -}) -``` - -**Operations** will use the provided Terraform module to create and manage the AWS Secrets Manager secret as defined. - -```hcl -# Generate a random id for the topic -resource "random_id" "topic_id" { - byte_length = 8 - - keepers = { - # Generate a new id each time we switch to a new name - topic_name = var.topic_name - } -} - - -# AWS SNS Topic -resource "aws_sns_topic" "topic" { - name = "${var.topic_name}-${random_id.topic_id.hex}" - - tags = { - "x-nitric-${var.stack_id}-name" = var.topic_name - "x-nitric-${var.stack_id}-type" = "topic" - } -} - -# Loop over the subsribers and deploy subscriptions and permissions -resource "aws_sns_topic_subscription" "subscription" { - for_each = var.lambda_subscribers - - topic_arn = aws_sns_topic.topic.arn - protocol = "lambda" - endpoint = each.value -} - -resource "aws_lambda_permission" "sns" { - for_each = var.lambda_subscribers - - action = "lambda:InvokeFunction" - function_name = each.value - principal = "sns.amazonaws.com" - source_arn = aws_sns_topic.topic.arn -} - -resource "aws_iam_role" "sns_publish_role" { - name = "${var.topic_name}-sns-publish-role" - - assume_role_policy = jsonencode({ - Version = "2012-10-17" - Statement = [ - { - Effect = "Allow" - Principal = { - Service = "states.amazonaws.com" - } - Action = "sts:AssumeRole" - } - ] - }) -} - -# Attach the policy to the role inline -resource "aws_iam_role_policy" "publish_policy" { - role = aws_iam_role.sns_publish_role.id - - # Terraform's "jsonencode" function converts a - # Terraform expression result to valid JSON syntax. - policy = jsonencode({ - Version = "2012-10-17" - Statement = [ - { - Effect = "Allow" - Action = "sns:Publish" - Resource = aws_sns_topic.topic.arn - } - ] - }) -} - -# Create a step function that publishes to the topic -resource "aws_sfn_state_machine" "publish_to_topic" { - name = "${var.topic_name}-publish-to-topic" - role_arn = aws_iam_role.sns_publish_role.arn - definition = jsonencode({ - Comment = "", - StartAt = "Wait", - States = { - Wait = { - Type = "Wait", - SecondsPath : "$.seconds", - Next = "Publish" - } - Publish = { - Type = "Task", - Resource = "arn:aws:states:::sns:publish", - Parameters = { - TopicArn = aws_sns_topic.topic.arn, - "Message.$" : "$.message", - }, - End = true - } - } - }) -} -``` diff --git a/docs/guides/c4/c4-websockets.mdx b/docs/guides/c4/c4-websockets.mdx deleted file mode 100644 index f1015c28a..000000000 --- a/docs/guides/c4/c4-websockets.mdx +++ /dev/null @@ -1,207 +0,0 @@ ---- -description: 'C4' -tags: - - C4 -published_at: 2024-07-25 ---- - -# Nitric 'WebSocket API Gateway' Architecture - -## 1. System Context (Level 1) - -- A **Developer** uses Nitric to create and manage WebSocket APIs within their application. - - App code interacts with the **WebSocket API resource** through defined routes and integrations. - - Developers implement backend logic to handle WebSocket connections, messages, and disconnections. -- **Operations** use default or overridden Terraform modules to provision the necessary AWS WebSocket API resources. - - **AWS API Gateway v2** manages WebSocket API endpoints and routes. - - **AWS Lambda** functions handle WebSocket events such as connection, message reception, and disconnection. - - **AWS IAM** manages roles and policies for secure access between API Gateway and Lambda functions. - -```mermaid -flowchart TD - Developer["Developer"] - Operations["Operations"] - App["nitric up"] - APIGateway["AWS API Gateway v2
(WebSocket API)"] - Lambda["AWS Lambda Functions"] - IAM["AWS IAM"] - - Developer -->|Code| App - Operations -->|Terraform| App - App -->|Create WebSocket API| APIGateway - App -->|Configure Integrations| APIGateway - App -->|Deploy Lambda Functions| Lambda - APIGateway -->|Invoke Lambda| Lambda - App -->|Manage Permissions| IAM - IAM -->Lambda - IAM -->APIGateway - Lambda -->|Handle Events| App -``` - -## 2. Container (Level 2) - -The system comprises AWS API Gateway v2 managing WebSocket APIs, which interact with AWS Lambda functions to handle connection, message, and disconnection events. - -```mermaid -flowchart TD - Nitric["Nitric Application"] - Nitric -->A(WebSocket API 1) - Nitric -->B(WebSocket API 2) - Nitric -->C(...) - A(WebSocket API 1) -->D(onConnect) - A(WebSocket API 1) -->E(onDisconnect) - A(WebSocket API 1) -->F(onMessage) - -classDef default line-height:1; -classDef edgeLabel line-height:2; -``` - -## 3. Component (Level 3) - -### WebSocket API Module - -- **random_id.topic_id** - - Generates a unique random ID for each SNS topic to ensure unique naming. -- **aws_apigatewayv2_api.websocket** - - Creates an AWS API Gateway v2 WebSocket API. - - Configures the API name, protocol type, route selection expression, and tags for identification and management. -- **aws_apigatewayv2_integration.default** - - Creates an integration for the `$default` route, linking it to a Lambda function. -- **aws_apigatewayv2_integration.connect** - - Creates an integration for the `$connect` route, linking it to a Lambda function. -- **aws_apigatewayv2_integration.disconnect** - - Creates an integration for the `$disconnect` route, linking it to a Lambda function. -- **aws_apigatewayv2_route.default** - - Creates the default route for the WebSocket API, targeting the default integration. -- **aws_apigatewayv2_route.connect** - - Creates the `$connect` route for the WebSocket API, targeting the connect integration. - - Depends on the default route to prevent concurrent edit conflicts. -- **aws_apigatewayv2_route.disconnect** - - Creates the `$disconnect` route for the WebSocket API, targeting the disconnect integration. - - Depends on the connect route to prevent concurrent edit conflicts. -- **aws_lambda_permission.websocket-message** - - Grants API Gateway permission to invoke the Lambda function handling messages. -- **aws_lambda_permission.websocket-connect** - - Grants API Gateway permission to invoke the Lambda function handling connections. -- **aws_lambda_permission.websocket-disconnect** - - Grants API Gateway permission to invoke the Lambda function handling disconnections. -- **aws_apigatewayv2_stage.stage** - - Creates a stage for the WebSocket API, enabling automatic deployment of changes. - - Configures tags for identification and management. - -## 4. Code (Level 4) - -**Developers** write application code that imports the 'websocket' resource from the SDK and implement backend logic to handle WebSocket connections, messages, and disconnections. - -```typescript -import { websocket } from '@nitric/sdk' - -const socket = websocket('socket') - -socket.on('connect', async (ctx) => { - // handle connections -}) - -socket.on('disconnect', async (ctx) => { - // handle disconnections -}) - -socket.on('message', async (ctx) => { - // handle messages -}) -``` - -**Operations** will use the provided Terraform module to create and manage the AWS Secrets Manager secret as defined. - -```hcl -# Deploy a websocket API gateway - -resource "aws_apigatewayv2_api" "websocket" { - name = var.websocket_name - protocol_type = "WEBSOCKET" - route_selection_expression = "$request.body.action" - tags = { - "x-nitric-${var.stack_id}-name" = var.websocket_name - "x-nitric-${var.stack_id}-type" = "websocket" - } -} - -resource "aws_apigatewayv2_integration" "default" { - api_id = aws_apigatewayv2_api.websocket.id - integration_type = "AWS_PROXY" - integration_uri = var.lambda_message_target -} - -# Create an integration for the connect route -resource "aws_apigatewayv2_integration" "disconnect" { - api_id = aws_apigatewayv2_api.websocket.id - integration_type = "AWS_PROXY" - integration_uri = var.lambda_disconnect_target -} - -# Create an integration for the connect route -resource "aws_apigatewayv2_integration" "connect" { - api_id = aws_apigatewayv2_api.websocket.id - integration_type = "AWS_PROXY" - integration_uri = var.lambda_connect_target -} - -# Create the default route for the websocket -resource "aws_apigatewayv2_route" "default" { - api_id = aws_apigatewayv2_api.websocket.id - route_key = "$default" - target = "integrations/${aws_apigatewayv2_integration.default.id}" -} - -# Create the connect route for the websocket -resource "aws_apigatewayv2_route" "connect" { - api_id = aws_apigatewayv2_api.websocket.id - route_key = "$connect" - target = "integrations/${aws_apigatewayv2_integration.connect.id}" - # Chain routes to prevent Concurrent edit conflict exceptions - depends_on = [ aws_apigatewayv2_route.default ] -} - -# Create the disconnect route for the websocket -resource "aws_apigatewayv2_route" "disconnect" { - api_id = aws_apigatewayv2_api.websocket.id - route_key = "$disconnect" - target = "integrations/${aws_apigatewayv2_integration.disconnect.id}" - # Chain routes to prevent Concurrent edit conflict exceptions - depends_on = [ aws_apigatewayv2_route.connect ] -} - -# Create execution lambda permissions for the websocket -resource "aws_lambda_permission" "websocket-message" { - action = "lambda:InvokeFunction" - function_name = var.lambda_message_target - principal = "apigateway.amazonaws.com" - source_arn = "${aws_apigatewayv2_api.websocket.execution_arn}/*/*" -} - -resource "aws_lambda_permission" "websocket-connect" { - action = "lambda:InvokeFunction" - function_name = var.lambda_connect_target - principal = "apigateway.amazonaws.com" - source_arn = "${aws_apigatewayv2_api.websocket.execution_arn}/*/*" -} - -resource "aws_lambda_permission" "websocket-disconnect" { - action = "lambda:InvokeFunction" - function_name = var.lambda_disconnect_target - principal = "apigateway.amazonaws.com" - source_arn = "${aws_apigatewayv2_api.websocket.execution_arn}/*/*" -} - -# create a stage for the api gateway -resource "aws_apigatewayv2_stage" "stage" { - api_id = aws_apigatewayv2_api.websocket.id - name = "ws" - auto_deploy = true - - tags = { - "x-nitric-${var.stack_id}-name" = "${var.websocket_name}DefaultStage" - "x-nitric-${var.stack_id}-type" = "websocket" - } -} -``` diff --git a/next-env.d.ts b/next-env.d.ts index 40c3d6809..725dd6f24 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,5 +1,6 @@ /// /// +/// // NOTE: This file should not be edited // see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. diff --git a/src/config/index.ts b/src/config/index.ts index 260f54cef..70e4d02c0 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -98,6 +98,71 @@ export const navigation: NavEntry[] = [ }, ], }, + { + title: 'Archictecture', + items: [ + { + title: 'Overview', + href: '/architecture', + }, + { + title: 'Services', + icon: GlobeAltIcon, + href: '/architecture/services', + }, + { + title: 'APIs', + icon: GlobeAltIcon, + href: '/architecture/apis', + }, + { + title: 'Schedules', + icon: ClockIcon, + href: '/architecture/schedules', + }, + { + title: 'Websockets', + icon: CursorArrowRippleIcon, + href: '/architecture/websockets', + }, + { + title: 'Storage', + icon: DocumentDuplicateIcon, + href: '/architecture/buckets', + }, + { + title: 'Key/Value Stores', + icon: ArchiveBoxIcon, + href: '/architecture/keyvalue', + }, + { + title: 'Async Messaging', + items: [ + { + title: 'Queues', + icon: MegaphoneIcon, + href: '/architecture/queues', + }, + { + title: 'Topics', + icon: MegaphoneIcon, + href: '/architecture/topics', + }, + ], + }, + { + title: 'SQL Databases', + icon: CircleStackIcon, + href: '/architecture/sql', + }, + + { + title: 'Secrets', + icon: LockClosedIcon, + href: '/architecture/secrets', + }, + ], + }, ], }, { From a3023dfc16db1a9aaf761bf478bdf2f2465ba749 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Tue, 28 Jan 2025 14:13:16 +1100 Subject: [PATCH 11/38] edits --- docs/architecture/apis.mdx | 15 ++++++++------- docs/architecture/buckets.mdx | 18 +++++++++--------- docs/architecture/keyvalue.mdx | 6 +++--- docs/architecture/queues.mdx | 6 +++--- docs/architecture/schedules.mdx | 2 +- docs/architecture/secrets.mdx | 6 +++--- docs/architecture/services.mdx | 4 ++-- docs/architecture/sql.mdx | 2 +- docs/architecture/topics.mdx | 6 +++--- docs/architecture/websockets.mdx | 4 ++-- next-env.d.ts | 1 - 11 files changed, 35 insertions(+), 35 deletions(-) diff --git a/docs/architecture/apis.mdx b/docs/architecture/apis.mdx index d296a0145..1cc774e48 100644 --- a/docs/architecture/apis.mdx +++ b/docs/architecture/apis.mdx @@ -2,23 +2,24 @@ description: 'Nitric API' --- -# APIS +# APIs ## 1. System Context -**Developers** use Nitric to declare APIs and routes within their application. +**Developers** use Nitric to define required APIs and routes/methods within their application. -- App code uses the [API resource](/apis) through defined endpoints. -- Developers define API specifications and implement backend logic to handle HTTP requests. +- App code uses the [API resource](/apis) to define APIs and their routes/methods. +- Developers define API(s) their application requires, including the specifications and implement logic to handle HTTP requests. +- Authentication, authorization, and middleware can be added to API routes to secure and enhance functionality. -**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. +**Operations** use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud(s), such as API Gateways.
Example AWS Provider - **AWS API Gateway v2** serves as the HTTP API management service. - **AWS Lambda** functions are deployed to handle API requests. -- **AWS IAM** (implicitly assumed) provides roles and policies for secure interaction between API Gateway and Lambda functions. +- **AWS IAM** (automated using IaC) provides roles and policies for secure interaction between API Gateway and Lambda functions. - **AWS ACM** manages TLS certificates for custom domain names. ```mermaid @@ -118,7 +119,7 @@ sequenceDiagram ## 4. Code -**Developers** write application code that uses the [API resource](/apis) from the SDK, configures the api and implement HTTP routes and middleware. +**Developers** write application code that uses the [API resource](/apis) from the SDK, defining the APIs routes, methods, middleware and auth. SDK Reference by language - diff --git a/docs/architecture/buckets.mdx b/docs/architecture/buckets.mdx index 668607ace..6e68015e5 100644 --- a/docs/architecture/buckets.mdx +++ b/docs/architecture/buckets.mdx @@ -2,25 +2,25 @@ description: 'C4 Buckets' --- -# Storage - Buckets +# Storage (Buckets/Object Storage) ## 1. System Context -**Developers** use Nitric to declare buckets within their application. +**Developers** use Nitric to define required buckets within their application. - App code uses the [Bucket resource](/storage) from the Nitric SDK. -- Developers configure buckets and implement application logic to securely access and manipulate bucket data. -- Developers request the level of access they require for the bucket in their application logic e.g. read, write, delete. -- Developers can implement handlers for on events such as read, write or delete. +- Developers define buckets their application requires and implement logic to securely store/retrieve/delete files. +- Developers _request_ the level of access they require for the bucket in their application logic e.g. read, write, delete. +- Developers can implement handlers for file change events such as write or delete. -**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. +**Operations** use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud.
Example AWS Provider - **AWS S3** serves as the storage backend. - **AWS Lambda** functions are used to process events triggered by S3. -- **AWS IAM** provides roles and policies for secure access to S3 buckets and Lambda functions, enforcing least priviledge access based on the developers request. +- **AWS IAM** provides roles and policies for secure access to S3 buckets and Lambda functions, enforcing least privilege access based on the developers request. ```mermaid flowchart TD @@ -113,8 +113,8 @@ sequenceDiagram - Ensures storage buckets have unique names by appending a randomly generated identifier. This avoids naming conflicts and aligns with best practices for globally accessible cloud resources. - Supports the addition of metadata tags for resource identification, management, and tracking, enabling better governance. -- Configures storage bucket notifications to trigger functions or message queues based on specified events (e.g., object creation, update, or deletion). -- Implements least privilege access by dynamically assigning permissions to functions or services that interact with the storage bucket. +- Configures storage bucket notifications to trigger functions or message queues based on specified events (e.g., object update or deletion). +- Implements least privilege access by only assigning requested permissions to functions or services that interact with the storage bucket. - Uses templates or dynamic blocks to handle multiple notification targets, allowing scalability and flexibility for different workflows. ## 4. Code diff --git a/docs/architecture/keyvalue.mdx b/docs/architecture/keyvalue.mdx index a84ed7c81..606cc2eab 100644 --- a/docs/architecture/keyvalue.mdx +++ b/docs/architecture/keyvalue.mdx @@ -6,12 +6,12 @@ description: 'Nitric Key/Value Store' ## 1. System Context -**Developers** use Nitric to declare key/value stores within their application. +**Developers** use Nitric to define required key/value stores within their application. - App code uses the [Key/Value resource](/keyvalue) from the Nitric SDK. -- Developers configure key/value stores and implement application logic to securely access and manipulate data. +- Developers define key/value stores their application requires and implement logic to securely read/write/delete values with unique keys. -**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. +**Operations** use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud.
Example AWS Provider diff --git a/docs/architecture/queues.mdx b/docs/architecture/queues.mdx index 948043da5..49fcd5d6c 100644 --- a/docs/architecture/queues.mdx +++ b/docs/architecture/queues.mdx @@ -6,12 +6,12 @@ description: 'Nitric Queue' ## 1. System Context -**Developers** use Nitric to declare message queues within their application. +**Developers** use Nitric to define required message queues within their application. - App code uses the [Queue resource](/messaging#queues) from the Nitric SDK. -- Developers configure queues and implement application logic to send and receive messages. +- Developers define queues their application requires and implement application logic to send or receive messages. -**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. +**Operations** use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud.
Example AWS Provider diff --git a/docs/architecture/schedules.mdx b/docs/architecture/schedules.mdx index 75f645c53..048313020 100644 --- a/docs/architecture/schedules.mdx +++ b/docs/architecture/schedules.mdx @@ -6,7 +6,7 @@ description: 'Nitric Schedule' ## 1. System Context -**Developers** use Nitric to declare scheduled tasks within their application. +**Developers** use Nitric to defined scheduled tasks within their application. - App code uses the [Schedule resource](/schedules) from the Nitric SDK. - Developers configure the schedule with CRON or rate expressions like '7 days' and implement application logic to be executed when triggered. diff --git a/docs/architecture/secrets.mdx b/docs/architecture/secrets.mdx index 786d05979..b1c460836 100644 --- a/docs/architecture/secrets.mdx +++ b/docs/architecture/secrets.mdx @@ -6,12 +6,12 @@ description: 'Nitric Secret' ## 1. System Context -**Developers** use Nitric to declare secrets within their application. +**Developers** use Nitric to define required secrets within their application. - App code uses the [Secrets resource](/secrets) from the Nitric SDK. -- Developers configure secrets and implement application logic to securely access and manage these secrets. +- Developers define secrets their application requires and implement logic to securely access and/or update secret values. -**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. +**Operations** use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud.
Example AWS Provider diff --git a/docs/architecture/services.mdx b/docs/architecture/services.mdx index 8318980d9..1372a7474 100644 --- a/docs/architecture/services.mdx +++ b/docs/architecture/services.mdx @@ -6,12 +6,12 @@ description: 'Service Deployment' ## 1. System Context -**Developers** use Nitric to deploy services or functions within their application. +**Developers** use Nitric to create services or functions within their application. - Application code is written in files that matches the pattern(s) in the nitric.yaml config file. - The **Nitric CLI** builds container images for their Lambda functions and push them to a container registry. -**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. +**Operations** use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud.
Example AWS Provider diff --git a/docs/architecture/sql.mdx b/docs/architecture/sql.mdx index db6cdb4e1..f9e5b8492 100644 --- a/docs/architecture/sql.mdx +++ b/docs/architecture/sql.mdx @@ -6,7 +6,7 @@ description: 'Nitric SQL' ## 1. System Context -**Developers** use Nitric to declare databases within their application (e.g., referencing a Postgres or MySQL database). +**Developers** use Nitric to define required databases within their application (e.g., referencing a Postgres or MySQL database). - App code uses the [SQL database resources](/sql) from the Nitric SDK. - Developers can use any language specific client or ORM to interact with the databases. diff --git a/docs/architecture/topics.mdx b/docs/architecture/topics.mdx index 26f6aa0a1..627049ee0 100644 --- a/docs/architecture/topics.mdx +++ b/docs/architecture/topics.mdx @@ -6,12 +6,12 @@ description: 'Nitric Topic' ## 1. System Context -**Developers** use Nitric to declare topics to enable event-driven communication within their application. +**Developers** use Nitric to define required topics to enable event-driven communication within their application. - App code interacts with the [Topic resource](/messaging#topics) through defined topics and subscriptions. -- Developers configure topics and implement application logic to publish and consume messages. +- Developers define topics their application requires and implement application logic to publish or subscribe to messages. -**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. +**Operations** use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud.
Example AWS Provider diff --git a/docs/architecture/websockets.mdx b/docs/architecture/websockets.mdx index 4a02f3566..aeb2dd908 100644 --- a/docs/architecture/websockets.mdx +++ b/docs/architecture/websockets.mdx @@ -6,12 +6,12 @@ description: 'Nitric WebSocket API' ## 1. System Context -**Developers** use Nitric to declare WebSocket APIs within their application. +**Developers** use Nitric to define required WebSocket APIs within their application. - App code interacts with the [WebSocket resource](/websocket) through defined routes and integrations. - Developers implement backend logic to handle WebSocket connections, messages, and disconnections. -**Operations** use default or overridden Terraform modules to provision the necessary resources for their target cloud. +**Operations** use default or overridden IaC (e.g Terraform modules) to provision the necessary resources for their target cloud.
Example AWS Provider diff --git a/next-env.d.ts b/next-env.d.ts index 725dd6f24..40c3d6809 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,5 @@ /// /// -/// // NOTE: This file should not be edited // see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. From 4bbf8be816305569cf99f51c0a8d0033466368c7 Mon Sep 17 00:00:00 2001 From: Rak Siva Date: Tue, 4 Feb 2025 11:36:11 -0700 Subject: [PATCH 12/38] wip: feedback --- docs/architecture/services.mdx | 46 +++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/docs/architecture/services.mdx b/docs/architecture/services.mdx index 1372a7474..84be107b9 100644 --- a/docs/architecture/services.mdx +++ b/docs/architecture/services.mdx @@ -81,27 +81,49 @@ classDef edgeLabel line-height:2; General-purpose workers that handle tasks like processing queues, topics, or schedules. Services abstract the runtime’s ability to route tasks and events to application-defined logic. +### API & Event-Driven Communication + ```mermaid flowchart TD A[Service] -->|Manages API calls| B[APIs] - A -->|Schedules tasks| C[Schedules] - A -->|Handles key-value operations| D[KeyValue] - A -->|Manages file storage| E[Storage] A -->|Queues messages| F[Queues] A -->|Broadcasts messages to subscribers| G[Topics] - A -->|Manages secrets securely| H[Secrets] - A -->|Interacts with relational databases| I[SQL Databases] A -->|Handles WebSocket connections| J[WebSockets] B -->|Routes HTTP requests| K[Cloud API Gateway] - C -->|Triggers periodic tasks| L[Cloud Scheduler] - D -->|Stores/retrieves key-value pairs| M[Cloud KeyValue Store] - E -->|Stores/retrieves files| N[Cloud Object Storage] F -->|Processes message queues| O[Cloud Queue Service] G -->|Distributes messages to subscribers| P[Cloud Pub/Sub] + J -->|Facilitates real-time communication| S[WebSocket Gateway] + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +### Data Storage & Management + +```mermaid +flowchart TD + A[Service] -->|Handles key-value operations| D[KeyValue] + A -->|Manages file storage| E[Storage] + A -->|Manages secrets securely| H[Secrets] + A -->|Interacts with relational databases| I[SQL Databases] + + D -->|Stores/retrieves key-value pairs| M[Cloud KeyValue Store] + E -->|Stores/retrieves files| N[Cloud Object Storage] H -->|Stores/retrieves secrets| Q[Cloud Secret Manager] I -->|Executes SQL queries| R[Relational Database] - J -->|Facilitates real-time communication| S[WebSocket Gateway] + +classDef default line-height:1; +classDef edgeLabel line-height:2; +``` + +### Task Execution & Scheduling + +```mermaid +flowchart TD + A[Service] -->|Schedules tasks| C[Schedules] + + C -->|Triggers periodic tasks| L[Cloud Scheduler] classDef default line-height:1; classDef edgeLabel line-height:2; @@ -123,6 +145,8 @@ classDef edgeLabel line-height:2; **Developers** write application code that implements handlers for the [api](/apis), [bucket](/buckets), [websocket](/websockets), [topic](/topics), [schedule](/schedule) resources. This code is written in files that matches the pattern(s) in the nitric.yaml file. +### Nitric service configuration - nitric.yaml + ```json name: service-name services: @@ -132,6 +156,8 @@ services: start: npm run dev:services $SERVICE_PATH ``` +### HTTP Route Handler + ```typescript import { api } from '@nitric/sdk' @@ -144,6 +170,8 @@ customerRoute.get((ctx) => { }) ``` +### Bucket On Read/Write/Delete Handler + ```typescript import { bucket } from '@nitric/sdk' From da876e694dc01db058f8dcb5d80ccd4b81884c22 Mon Sep 17 00:00:00 2001 From: David Moore Date: Fri, 7 Feb 2025 17:53:53 +1100 Subject: [PATCH 13/38] nitric diagram styling wip --- src/mdx/remark.mjs | 14 ++++++++------ src/styles/mermaid.css | 15 +++++++++++---- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/mdx/remark.mjs b/src/mdx/remark.mjs index 2d2baabd1..5fd74b265 100644 --- a/src/mdx/remark.mjs +++ b/src/mdx/remark.mjs @@ -13,13 +13,15 @@ export const remarkPlugins = [ theme: 'base', // TODO: Relocate theme config themeVariables: { - primaryColor: '#242037', - lineColor: '#cad3f5', - secondaryColor: '#42424a', + background: 'white', + primaryColor: '#F9F3FF', + primaryBorderColor: 'var(--secondary-300)', + lineColor: '#000000', + secondaryColor: '#ffffff', tertiaryColor: '#0000ff', - primaryTextColor: '#cad3f5', - fontSize: '14px', - fontFamily: 'Fira Code, monospace', + primaryTextColor: '#000000', + fontSize: '24px', // use with styles in mermaid.css, this zooms out the diagram + fontFamily: 'var(--font-jetbrains-mono), monospace', }, }, }, diff --git a/src/styles/mermaid.css b/src/styles/mermaid.css index 066dd886e..e6e8ed227 100644 --- a/src/styles/mermaid.css +++ b/src/styles/mermaid.css @@ -1,6 +1,13 @@ svg[id^='mermaid-svg-'] { - display: block; - /* width: 100%; */ - margin: auto; - /* padding: 0; */ + @apply mx-auto block rounded-lg bg-white p-4; +} + +svg[id^='mermaid-svg-'] .nodeLabel, +svg[id^='mermaid-svg-'] .edgeLabel, +svg[id^='mermaid-svg-'] tspan { + @apply text-base; +} + +svg[id^='mermaid-svg-'] .edgeLabel { + @apply py-1; } From 09bcffb3710116a11622fe4b09f62db8b5a1e354 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Mon, 10 Feb 2025 10:08:37 +1100 Subject: [PATCH 14/38] split API sequence diagrams between runtime and build time --- docs/architecture/apis.mdx | 67 +++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 15 deletions(-) diff --git a/docs/architecture/apis.mdx b/docs/architecture/apis.mdx index 1cc774e48..533ee2819 100644 --- a/docs/architecture/apis.mdx +++ b/docs/architecture/apis.mdx @@ -86,23 +86,60 @@ classDef edgeLabel line-height:2; ## 2. Sequence +### Build Sequence + +Here is the sequence of events that occur when a developer registers an API with Nitric, including the registration of routes, security, and middleware. + +```mermaid +sequenceDiagram + participant Worker as App Worker(s) + participant SDK as Nitric SDK + participant Nitric as Nitric CLI + participant Provider as Nitric Provider + participant IAC as IaC + + Worker->>SDK: Register API(s) + SDK->>Nitric: Register API(s) + + opt Authentication + Worker->>SDK: Register Security + SDK->>Nitric: Register Security + end + + Worker->>SDK: Register Route Callback(s) + SDK->>Nitric: Register Route(s) + Worker->>SDK: Register Middleware(s) + + Nitric->>Nitric: Generate OpenAPI Spec + Nitric->>Provider: Forward Nitric Spec + Provider->>IAC: Provision API Gateway +``` + +### Runtime Sequence + +Here is the sequence of events that occur at runtime when a client makes an HTTP request to an API registered and deployed using Nitric. + ```mermaid sequenceDiagram - participant Client as Client - participant NitricSDK as Nitric SDK - participant NitricRuntime as Nitric Runtime - participant APIGateway as API Gateway - participant Worker as App Worker - - Client->>NitricSDK: Send HTTP API request - NitricSDK->>NitricRuntime: Forward API request - NitricRuntime->>APIGateway: Register API routes (during deployment) - - APIGateway->>NitricRuntime: Route incoming request - NitricRuntime->>Worker: Forward request to application logic - Worker-->>NitricRuntime: Process request and return response - NitricRuntime-->>APIGateway: Respond with result - APIGateway-->>Client: Return API response + participant Client as Client + participant APIGateway as API Gateway + participant Auth as Auth Provider + participant Nitric as Nitric Runtime + participant SDK as Nitric SDK + participant Worker as App Worker + + Client->>APIGateway: HTTP Request + opt Authentication + APIGateway->>Auth: Verify Token + APIGateway-->>Client: Unauthorized + end + APIGateway->>Nitric: Forward Request + Nitric->>Nitric: Convert Request Format + Nitric->>SDK: Route HTTP Event + SDK->>Worker: Execute Route Callback + + Worker->>Worker: Process Request + Worker-->>Client: Response ``` ## 3. Component From 12f22f21f4dd8e08251ca21ee756eded9bb211d4 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Mon, 10 Feb 2025 11:20:10 +1100 Subject: [PATCH 15/38] update storage sequence diagrams --- docs/architecture/buckets.mdx | 57 ++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/docs/architecture/buckets.mdx b/docs/architecture/buckets.mdx index 6e68015e5..e9e8bfbb9 100644 --- a/docs/architecture/buckets.mdx +++ b/docs/architecture/buckets.mdx @@ -85,28 +85,51 @@ classDef edgeLabel line-height:2; ## 2. Sequence +### Build Sequence + +Below is a sequence diagram showing the sequence of events that occur when a developer registers a bucket with Nitric. Including, optionally registering event handlers for file change events. + ```mermaid sequenceDiagram - participant Client as Client - participant NitricSDK as Nitric SDK - participant NitricRuntime as Nitric Runtime - participant CloudStorage as Cloud Storage (e.g., S3, GCS) - - Client->>NitricSDK: Perform storage operation (e.g., write, read, delete) - NitricSDK->>NitricRuntime: Forward storage API call - NitricRuntime->>CloudStorage: Execute storage operation - - alt Successful Operation - CloudStorage-->>NitricRuntime: Return result (e.g., data or success status) - NitricRuntime-->>NitricSDK: Return result - NitricSDK-->>Client: Return result to client - else Failure - CloudStorage-->>NitricRuntime: Return error - NitricRuntime-->>NitricSDK: Forward error - NitricSDK-->>Client: Return error response + participant Worker as App Worker(s) + participant SDK as Nitric SDK + participant Nitric as Nitric CLI + participant Provider as Nitric Provider + participant IAC as IaC + + Worker->>SDK: Register Bucket + SDK->>Nitric: Register Bucket + + opt Notifications + Worker->>SDK: Register Event Callback + SDK->>Nitric: Register Event Handler + end + + Nitric->>Provider: Forward Nitric Spec + Provider->>IAC: Provision Bucket + + opt Notifications + Provider->>IAC: Provision Event Rule(s) end ``` +### Runtime Sequence + +Below is a sequence diagram showing the runtime flow of a storage operation in a Nitric application, using the Nitric SDK. The SDK forwards the request to the Nitric runtime, which converts the request and forwards it to the cloud storage API. The plugin nature of the Nitric runtime allows for seamless integration with different cloud providers. + +```mermaid +sequenceDiagram + participant Client as App Code + participant SDK as Nitric SDK + participant Nitric as Nitric Runtime + participant CloudAPI as Cloud Storage (e.g. S3) + + Client->>SDK: Read + SDK->>Nitric: Forward Request + Nitric->>Nitric: Convert Request + Nitric->>CloudAPI: Storage API Request +``` + ## 3. Component ### Bucket Module From 909d705403c14b9849c027ba756e791ea97067be Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Mon, 10 Feb 2025 11:57:19 +1100 Subject: [PATCH 16/38] update kv sequences --- docs/architecture/buckets.mdx | 4 +++ docs/architecture/keyvalue.mdx | 53 ++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/docs/architecture/buckets.mdx b/docs/architecture/buckets.mdx index e9e8bfbb9..87b0a5320 100644 --- a/docs/architecture/buckets.mdx +++ b/docs/architecture/buckets.mdx @@ -98,7 +98,9 @@ sequenceDiagram participant IAC as IaC Worker->>SDK: Register Bucket + Worker->>SDK: Register Access Requirements SDK->>Nitric: Register Bucket + SDK->>Nitric: Register Access Requirements opt Notifications Worker->>SDK: Register Event Callback @@ -107,9 +109,11 @@ sequenceDiagram Nitric->>Provider: Forward Nitric Spec Provider->>IAC: Provision Bucket + Provider->>IAC: Provision IAM opt Notifications Provider->>IAC: Provision Event Rule(s) + Provider->>IAC: Provision IAM end ``` diff --git a/docs/architecture/keyvalue.mdx b/docs/architecture/keyvalue.mdx index 606cc2eab..f3b367bab 100644 --- a/docs/architecture/keyvalue.mdx +++ b/docs/architecture/keyvalue.mdx @@ -70,26 +70,43 @@ classDef edgeLabel line-height:2; ## 2. Sequence +### Build Sequence + +Below is a sequence diagram showing the sequence of events when a developer registers a Key/Value store with Nitric. + +```mermaid +sequenceDiagram + participant Worker as App Worker(s) + participant SDK as Nitric SDK + participant Nitric as Nitric CLI + participant Provider as Nitric Provider + participant IAC as IaC + + Worker->>SDK: Register Key/Value Store + Worker->>SDK: Register Access Requirements + SDK->>Nitric: Register Key/Value Store + SDK->>Nitric: Register Access Requirements + + Nitric->>Provider: Forward Nitric Spec + Provider->>IAC: Provision Key/Value Store + Provider->>IAC: Provision IAM +``` + +### Runtime Sequence + +Below is a sequence diagram showing the runtime flow of a key/value store operation using Nitric. The example shows a Get operation, which reads a value by its key. + ```mermaid sequenceDiagram - participant Client as Client - participant NitricSDK as Nitric SDK - participant NitricRuntime as Nitric Runtime - participant DynamoDB as DynamoDB - - Client->>NitricSDK: Request to set/get/delete a key-value - NitricSDK->>NitricRuntime: Forward API call with key, value, or operation - NitricRuntime->>DynamoDB: Perform operation (GetItem, PutItem, DeleteItem, Scan) - - alt Successful Operation - DynamoDB-->>NitricRuntime: Return result (e.g., value, success status) - NitricRuntime-->>NitricSDK: Return result - NitricSDK-->>Client: Return result to client - else Failure - DynamoDB-->>NitricRuntime: Return error (e.g., AccessDenied, NotFound) - NitricRuntime-->>NitricSDK: Forward error - NitricSDK-->>Client: Return error response - end + participant Client as App Code + participant SDK as Nitric SDK + participant Nitric as Nitric Runtime + participant CloudAPI as Document DB + + Client->>SDK: Get(key) + SDK->>Nitric: Forward Request + Nitric->>Nitric: Convert Request + Nitric->>CloudAPI: Key/Value API Request ``` ## 3. Component From 66cab4d778b916552308119967f4cebba23befd9 Mon Sep 17 00:00:00 2001 From: David Moore Date: Mon, 10 Feb 2025 12:17:52 +1100 Subject: [PATCH 17/38] add zoom and panning to mermaid svgs --- package.json | 1 + src/components/GitHubStarCount.tsx | 1 - src/components/MermaidZoom.tsx | 51 ++++++++++++++++++++++++++++++ src/components/mdx.tsx | 11 +++++++ src/styles/mermaid.css | 4 --- yarn.lock | 5 +++ 6 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 src/components/MermaidZoom.tsx diff --git a/package.json b/package.json index 4083031cd..3bd32d22e 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "react-dom": "^18.3.1", "react-highlight-words": "^0.20.0", "react-icons": "^5.3.0", + "react-zoom-pan-pinch": "^3.7.0", "rehype-autolink-headings": "^7.1.0", "remark": "^15.0.1", "remark-gfm": "^4.0.0", diff --git a/src/components/GitHubStarCount.tsx b/src/components/GitHubStarCount.tsx index ef03daf63..908093d54 100644 --- a/src/components/GitHubStarCount.tsx +++ b/src/components/GitHubStarCount.tsx @@ -1,6 +1,5 @@ 'use client' -import { getStarGazers } from '@/lib/stargazers' import clsx from 'clsx' import React, { FC, useEffect, useState } from 'react' diff --git a/src/components/MermaidZoom.tsx b/src/components/MermaidZoom.tsx new file mode 100644 index 000000000..e22ea1c4c --- /dev/null +++ b/src/components/MermaidZoom.tsx @@ -0,0 +1,51 @@ +'use client' + +import { cn } from '@/lib/utils' +import React from 'react' + +import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch' +import { Button } from './ui/button' +import { + ArrowPathIcon, + MagnifyingGlassMinusIcon, + MagnifyingGlassPlusIcon, +} from '@heroicons/react/24/outline' + +interface MermaidZoomProps extends React.ComponentPropsWithoutRef<'svg'> {} + +const MermaidZoom: React.FC = (props) => ( +
+ + {({ zoomIn, zoomOut, resetTransform, instance }) => ( + +
+ + + +
+ + + +
+ )} +
+
+) + +export default MermaidZoom diff --git a/src/components/mdx.tsx b/src/components/mdx.tsx index c0138d3e6..161381567 100644 --- a/src/components/mdx.tsx +++ b/src/components/mdx.tsx @@ -1,6 +1,7 @@ import Link from 'next/link' import clsx from 'clsx' import { Table } from '@/components/ui/table' +import MermaidZoom from './MermaidZoom' export { TableHead as th, @@ -110,4 +111,14 @@ export { CodeTabs } from '@/components/code/CodeTabs' export { Mermaid } from 'mdx-mermaid/Mermaid' +export const svg = (props: React.ComponentPropsWithoutRef<'svg'>) => { + const { id } = props + + if (id?.startsWith('mermaid-svg')) { + return + } + + return +} + // see if we need to remove these diff --git a/src/styles/mermaid.css b/src/styles/mermaid.css index e6e8ed227..3f1a9dce1 100644 --- a/src/styles/mermaid.css +++ b/src/styles/mermaid.css @@ -1,7 +1,3 @@ -svg[id^='mermaid-svg-'] { - @apply mx-auto block rounded-lg bg-white p-4; -} - svg[id^='mermaid-svg-'] .nodeLabel, svg[id^='mermaid-svg-'] .edgeLabel, svg[id^='mermaid-svg-'] tspan { diff --git a/yarn.lock b/yarn.lock index a702138e9..ced72297c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8152,6 +8152,11 @@ react-style-singleton@^2.2.1: invariant "^2.2.4" tslib "^2.0.0" +react-zoom-pan-pinch@^3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/react-zoom-pan-pinch/-/react-zoom-pan-pinch-3.7.0.tgz#7db4d2ec49c316eb20f71c56e9012eeb3ef4b504" + integrity sha512-UmReVZ0TxlKzxSbYiAj+LeGRW8s8LraAFTXRAxzMYnNRgGPsxCudwZKVkjvGmjtx7SW/hZamt69NUmGf4xrkXA== + react@^18.3.1: version "18.3.1" resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891" From 265ad59fc56512c51fcba051b9019024f53f2e9f Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Mon, 10 Feb 2025 13:06:10 +1100 Subject: [PATCH 18/38] update async messaging sequences --- docs/architecture/apis.mdx | 8 ++-- docs/architecture/buckets.mdx | 10 ++--- docs/architecture/keyvalue.mdx | 8 ++-- docs/architecture/queues.mdx | 53 ++++++++++++++++--------- docs/architecture/topics.mdx | 71 ++++++++++++++++++++++++---------- 5 files changed, 99 insertions(+), 51 deletions(-) diff --git a/docs/architecture/apis.mdx b/docs/architecture/apis.mdx index 533ee2819..b1fc58e49 100644 --- a/docs/architecture/apis.mdx +++ b/docs/architecture/apis.mdx @@ -95,8 +95,8 @@ sequenceDiagram participant Worker as App Worker(s) participant SDK as Nitric SDK participant Nitric as Nitric CLI - participant Provider as Nitric Provider - participant IAC as IaC + participant Provider as Nitric Provider
(plugin) + participant IAC as IaC
(e.g. Terraform) Worker->>SDK: Register API(s) SDK->>Nitric: Register API(s) @@ -122,9 +122,9 @@ Here is the sequence of events that occur at runtime when a client makes an HTTP ```mermaid sequenceDiagram participant Client as Client - participant APIGateway as API Gateway + participant APIGateway as API Gateway
(e.g. AWS API Gateway) participant Auth as Auth Provider - participant Nitric as Nitric Runtime + participant Nitric as Nitric Runtime
(plugin) participant SDK as Nitric SDK participant Worker as App Worker diff --git a/docs/architecture/buckets.mdx b/docs/architecture/buckets.mdx index 87b0a5320..b8c7daa24 100644 --- a/docs/architecture/buckets.mdx +++ b/docs/architecture/buckets.mdx @@ -94,8 +94,8 @@ sequenceDiagram participant Worker as App Worker(s) participant SDK as Nitric SDK participant Nitric as Nitric CLI - participant Provider as Nitric Provider - participant IAC as IaC + participant Provider as Nitric Provider
(plugin) + participant IAC as IaC
(e.g. Terraform) Worker->>SDK: Register Bucket Worker->>SDK: Register Access Requirements @@ -125,10 +125,10 @@ Below is a sequence diagram showing the runtime flow of a storage operation in a sequenceDiagram participant Client as App Code participant SDK as Nitric SDK - participant Nitric as Nitric Runtime - participant CloudAPI as Cloud Storage (e.g. S3) + participant Nitric as Nitric Runtime
(plugin) + participant CloudAPI as Cloud Storage
(e.g. AWS S3) - Client->>SDK: Read + Client->>SDK: Read() SDK->>Nitric: Forward Request Nitric->>Nitric: Convert Request Nitric->>CloudAPI: Storage API Request diff --git a/docs/architecture/keyvalue.mdx b/docs/architecture/keyvalue.mdx index f3b367bab..1ee7b4206 100644 --- a/docs/architecture/keyvalue.mdx +++ b/docs/architecture/keyvalue.mdx @@ -79,8 +79,8 @@ sequenceDiagram participant Worker as App Worker(s) participant SDK as Nitric SDK participant Nitric as Nitric CLI - participant Provider as Nitric Provider - participant IAC as IaC + participant Provider as Nitric Provider
(plugin) + participant IAC as IaC
(e.g. Terraform) Worker->>SDK: Register Key/Value Store Worker->>SDK: Register Access Requirements @@ -100,8 +100,8 @@ Below is a sequence diagram showing the runtime flow of a key/value store operat sequenceDiagram participant Client as App Code participant SDK as Nitric SDK - participant Nitric as Nitric Runtime - participant CloudAPI as Document DB + participant Nitric as Nitric Runtime
(plugin) + participant CloudAPI as Document DB
(e.g. AWS DynamoDB) Client->>SDK: Get(key) SDK->>Nitric: Forward Request diff --git a/docs/architecture/queues.mdx b/docs/architecture/queues.mdx index 49fcd5d6c..fa01adec3 100644 --- a/docs/architecture/queues.mdx +++ b/docs/architecture/queues.mdx @@ -67,26 +67,43 @@ classDef edgeLabel line-height:2; ## 2. Sequence +### Build Sequence + +Below is a sequence diagram showing the sequence of events when a developer registers a Queue with Nitric. This is the process that occurs when using the `nitric up` command. + +```mermaid +sequenceDiagram + participant Worker as App Worker(s) + participant SDK as Nitric SDK + participant Nitric as Nitric CLI + participant Provider as Nitric Provider + participant IAC as IaC + + Worker->>SDK: Register Queue + Worker->>SDK: Register Access Requirements + SDK->>Nitric: Register Queue + SDK->>Nitric: Register Access Requirements + + Nitric->>Provider: Forward Nitric Spec + Provider->>IAC: Provision Queue + Provider->>IAC: Provision IAM +``` + +### Runtime Sequence + +Below is the runtime flow when performing operations on a Queue using Nitric, such as enqueueing or dequeueing messages. The example shows an Enqueue operation, which sends a message to the queue. + ```mermaid sequenceDiagram - participant Client as Client - participant NitricSDK as Nitric SDK - participant NitricRuntime as Nitric Runtime - participant QueueService as Cloud Queue Service (e.g., AWS SQS, GCP Pub/Sub) - - Client->>NitricSDK: Send or receive message from queue - NitricSDK->>NitricRuntime: Forward queue API call - NitricRuntime->>QueueService: Perform queue operation (e.g., enqueue, dequeue) - - alt Successful Operation - QueueService-->>NitricRuntime: Return result (e.g., message or success status) - NitricRuntime-->>NitricSDK: Return result - NitricSDK-->>Client: Return result to client - else Failure - QueueService-->>NitricRuntime: Return error - NitricRuntime-->>NitricSDK: Forward error - NitricSDK-->>Client: Return error response - end + participant Client as App Code + participant SDK as Nitric SDK + participant Nitric as Nitric Runtime
(plugin) + participant CloudAPI as Document DB
(e.g. AWS SQS) + + Client->>SDK: Enqueue(message) + SDK->>Nitric: Forward Request + Nitric->>Nitric: Convert Request + Nitric->>CloudAPI: Queue API Request ``` ## 3. Component diff --git a/docs/architecture/topics.mdx b/docs/architecture/topics.mdx index 627049ee0..84449261a 100644 --- a/docs/architecture/topics.mdx +++ b/docs/architecture/topics.mdx @@ -82,28 +82,59 @@ classDef edgeLabel line-height:2; ## 2. Sequence +### Build Sequence + +Below is a sequence diagram showing the sequence of events when a developer registers a Topic with Nitric and optionally registers Subscribers. This is the process that occurs when using the `nitric up` command. + +```mermaid +sequenceDiagram + participant Worker as App Worker(s) + participant SDK as Nitric SDK + participant Nitric as Nitric CLI + participant Provider as Nitric Provider
(plugin) + participant IAC as IaC
(e.g. Terraform) + + Worker->>SDK: Register Queue + Worker->>SDK: Register Access Requirements + SDK->>Nitric: Register Queue + SDK->>Nitric: Register Access Requirements + + opt Subscribers + Worker->>SDK: Register Subscriber Callback + SDK->>Nitric: Register Subscriber + end + + Nitric->>Provider: Forward Nitric Spec + Provider->>IAC: Provision Queue + Provider->>IAC: Provision IAM + + opt Notifications + Provider->>IAC: Provision Event Rule(s) + Provider->>IAC: Provision IAM + end +``` + +### Runtime Sequence + +Below is the runtime flow when performing operations on a Topic using Nitric, such as publishing or subscribing to messages. The example shows both publish and subscribe operations, which send or receive messages to/from the topic. + ```mermaid sequenceDiagram - participant Client as Client - participant NitricSDK as Nitric SDK - participant NitricRuntime as Nitric Runtime - participant TopicService as Cloud Topic Service (e.g., AWS SNS, GCP Pub/Sub) - participant Subscriber as Subscriber (e.g., Queue, Function) - - Client->>NitricSDK: Publish message to topic - NitricSDK->>NitricRuntime: Forward topic API call - NitricRuntime->>TopicService: Publish message to topic - - alt Successful Publish - TopicService-->>NitricRuntime: Confirm message delivery - NitricRuntime-->>NitricSDK: Return success confirmation - NitricSDK-->>Client: Return success to client - TopicService->>Subscriber: Distribute message to subscribers - Subscriber-->>TopicService: Acknowledge receipt of message - else Publish Failure - TopicService-->>NitricRuntime: Return error - NitricRuntime-->>NitricSDK: Forward error - NitricSDK-->>Client: Return error response + participant Client as App Code + participant SDK as Nitric SDK + participant Nitric as Nitric Runtime
(plugin) + participant CloudAPI as Message Broker
(e.g. AWS SNS) + + alt Publisher + Client->>SDK: Publish(message) + SDK->>Nitric: Forward Request + Nitric->>Nitric: Convert Request + Nitric->>CloudAPI: Topic API Request + else Subscriber + CloudAPI->>Nitric: Message + Nitric->>Nitric: Convert Message + Nitric->>SDK: Forward Message + SDK->>Client: Subscription Callback end ``` From ed50b16304d5e4e8f12d237f2e12cec2132c1595 Mon Sep 17 00:00:00 2001 From: David Moore Date: Mon, 10 Feb 2025 13:36:39 +1100 Subject: [PATCH 19/38] remove unused prop --- src/components/MermaidZoom.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MermaidZoom.tsx b/src/components/MermaidZoom.tsx index e22ea1c4c..0c61b4431 100644 --- a/src/components/MermaidZoom.tsx +++ b/src/components/MermaidZoom.tsx @@ -16,7 +16,7 @@ interface MermaidZoomProps extends React.ComponentPropsWithoutRef<'svg'> {} const MermaidZoom: React.FC = (props) => (
- {({ zoomIn, zoomOut, resetTransform, instance }) => ( + {({ zoomIn, zoomOut, resetTransform }) => (
Date: Mon, 10 Feb 2025 13:49:02 +1100 Subject: [PATCH 20/38] update schedule sequences --- docs/architecture/schedules.mdx | 51 ++++++++++++++++++++++++--------- docs/architecture/topics.mdx | 6 +++- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/docs/architecture/schedules.mdx b/docs/architecture/schedules.mdx index 048313020..df3211aa6 100644 --- a/docs/architecture/schedules.mdx +++ b/docs/architecture/schedules.mdx @@ -74,22 +74,45 @@ classDef edgeLabel line-height:2; ## 2. Sequence +Below is the sequence of events that occur when a developer registers a schedule and a callback function with Nitric. + +```mermaid +sequenceDiagram + participant Worker as App Worker(s) + participant SDK as Nitric SDK + participant Nitric as Nitric CLI + participant Provider as Nitric Provider
(plugin) + participant IAC as IaC
(e.g. Terraform) + + Worker->>SDK: Register Schedule + Worker->>SDK: Register Schedule Callback + SDK->>Nitric: Register Schedule + + Nitric->>Provider: Forward Nitric Spec + + opt Convert CRON + Provider->>Provider: Convert CRON / Rate Format + end + + Provider->>IAC: Provision Schedule + Provider->>IAC: Provision IAM +``` + +### Runtime Sequence + +Below is the runtime flow of a schedule service triggering a Nitric service and executing the application logic in the schedule callback. + ```mermaid sequenceDiagram - participant Developer as Developer - participant NitricSDK as Nitric SDK - participant NitricRuntime as Nitric Runtime - participant Scheduler as Cloud Scheduler - participant Worker as Application Worker - - Developer->>NitricSDK: Define schedule (e.g., CRON job) - NitricSDK->>NitricRuntime: Deploy schedule configuration - NitricRuntime->>Scheduler: Create schedule in cloud scheduler - - Scheduler->>NitricRuntime: Trigger scheduled task (e.g., CRON event) - NitricRuntime->>Worker: Forward scheduled event with payload - Worker-->>NitricRuntime: Process task and return result - NitricRuntime-->>Scheduler: Confirm execution (success or error) + participant CloudAPI as Cloud Schedule
(e.g. CloudWatch) + participant Nitric as Nitric Runtime
(plugin) + participant SDK as Nitric SDK + participant Client as App Code + + CloudAPI->>Nitric: Scheduled Event + Nitric->>Nitric: Convert Format + Nitric->>SDK: Forward Event + SDK->>Client: Execute Callback ``` ## 3. Component diff --git a/docs/architecture/topics.mdx b/docs/architecture/topics.mdx index 84449261a..ce7abaf63 100644 --- a/docs/architecture/topics.mdx +++ b/docs/architecture/topics.mdx @@ -112,6 +112,10 @@ sequenceDiagram Provider->>IAC: Provision Event Rule(s) Provider->>IAC: Provision IAM end + + opt Delayed Messaging + Provider->>IAC: Provision Delayed Messaging + end ``` ### Runtime Sequence @@ -129,7 +133,7 @@ sequenceDiagram Client->>SDK: Publish(message) SDK->>Nitric: Forward Request Nitric->>Nitric: Convert Request - Nitric->>CloudAPI: Topic API Request + Nitric->>CloudAPI: Send Message to Topic else Subscriber CloudAPI->>Nitric: Message Nitric->>Nitric: Convert Message From ab5823355541d833bd54bed53736222dedee4af6 Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Mon, 10 Feb 2025 14:16:32 +1100 Subject: [PATCH 21/38] Update secrets sequences --- docs/architecture/buckets.mdx | 4 +-- docs/architecture/secrets.mdx | 53 +++++++++++++++++++++++------------ 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/docs/architecture/buckets.mdx b/docs/architecture/buckets.mdx index b8c7daa24..029cd3ade 100644 --- a/docs/architecture/buckets.mdx +++ b/docs/architecture/buckets.mdx @@ -87,7 +87,7 @@ classDef edgeLabel line-height:2; ### Build Sequence -Below is a sequence diagram showing the sequence of events that occur when a developer registers a bucket with Nitric. Including, optionally registering event handlers for file change events. +Below is the sequence of events that occur when a developer registers a bucket with Nitric. Including, optionally registering event handlers for file change events. ```mermaid sequenceDiagram @@ -119,7 +119,7 @@ sequenceDiagram ### Runtime Sequence -Below is a sequence diagram showing the runtime flow of a storage operation in a Nitric application, using the Nitric SDK. The SDK forwards the request to the Nitric runtime, which converts the request and forwards it to the cloud storage API. The plugin nature of the Nitric runtime allows for seamless integration with different cloud providers. +Below is the runtime flow of a storage operation in a Nitric application, using the Nitric SDK. The SDK forwards the request to the Nitric runtime, which converts the request and forwards it to the cloud storage API. The plugin nature of the Nitric runtime allows for seamless integration with different cloud providers. ```mermaid sequenceDiagram diff --git a/docs/architecture/secrets.mdx b/docs/architecture/secrets.mdx index b1c460836..309a7f502 100644 --- a/docs/architecture/secrets.mdx +++ b/docs/architecture/secrets.mdx @@ -70,26 +70,43 @@ classDef edgeLabel line-height:2; ## 2. Sequence +### Build Sequence + +Below is the sequence of events that occur when a developer registers a secret with Nitric. This includes defining the secret and its access requirements, which are then provisioned by the Nitric provider using IaC. + +```mermaid +sequenceDiagram + participant Worker as App Worker(s) + participant SDK as Nitric SDK + participant Nitric as Nitric CLI + participant Provider as Nitric Provider
(plugin) + participant IAC as IaC
(e.g. Terraform) + + Worker->>SDK: Register Secret + Worker->>SDK: Register Access Requirements + SDK->>Nitric: Register Secret + SDK->>Nitric: Register Access Requirements + + Nitric->>Provider: Forward Nitric Spec + Provider->>IAC: Provision Secret + Provider->>IAC: Provision IAM +``` + +### Runtime Sequence + +Below is a sequence diagram showing the runtime flow of a secret operation in a Nitric application, using the Nitric SDK. The SDK forwards the request to the Nitric runtime, which converts the request and forwards it to the cloud secrets management API. The plugin nature of the Nitric runtime allows for seamless integration with different cloud providers. + ```mermaid sequenceDiagram - participant Client as Client - participant NitricSDK as Nitric SDK - participant NitricRuntime as Nitric Runtime - participant SecretManager as Cloud Secret Manager (e.g., AWS Secrets Manager, GCP Secret Manager) - - Client->>NitricSDK: Perform secret operation (e.g., get, set, delete) - NitricSDK->>NitricRuntime: Forward secret API call - NitricRuntime->>SecretManager: Execute secret operation - - alt Successful Operation - SecretManager-->>NitricRuntime: Return result (e.g., secret value, success status) - NitricRuntime-->>NitricSDK: Return result - NitricSDK-->>Client: Return result to client - else Failure - SecretManager-->>NitricRuntime: Return error - NitricRuntime-->>NitricSDK: Forward error - NitricSDK-->>Client: Return error response - end + participant Client as App Code + participant SDK as Nitric SDK + participant Nitric as Nitric Runtime
(plugin) + participant CloudAPI as Secrets Management
(e.g. AWS Secrets Manager) + + Client->>SDK: Access() + SDK->>Nitric: Forward Request + Nitric->>Nitric: Convert Request + Nitric->>CloudAPI: Secrets Management Request ``` ## 3. Component From 73fca98c70a119b074dd62d74b085ec51014c7ac Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Mon, 10 Feb 2025 14:41:31 +1100 Subject: [PATCH 22/38] update ws and sql sequences --- docs/architecture/apis.mdx | 1 + docs/architecture/sql.mdx | 56 +++++++++++++++++--------- docs/architecture/websockets.mdx | 67 ++++++++++++++++++++++++-------- 3 files changed, 89 insertions(+), 35 deletions(-) diff --git a/docs/architecture/apis.mdx b/docs/architecture/apis.mdx index b1fc58e49..0c6d18df9 100644 --- a/docs/architecture/apis.mdx +++ b/docs/architecture/apis.mdx @@ -113,6 +113,7 @@ sequenceDiagram Nitric->>Nitric: Generate OpenAPI Spec Nitric->>Provider: Forward Nitric Spec Provider->>IAC: Provision API Gateway + Provider->>IAC: Provision IAM ``` ### Runtime Sequence diff --git a/docs/architecture/sql.mdx b/docs/architecture/sql.mdx index f9e5b8492..2df32c9e8 100644 --- a/docs/architecture/sql.mdx +++ b/docs/architecture/sql.mdx @@ -52,28 +52,46 @@ classDef edgeLabel line-height:2;
-## 2. Sequence Diagram (Level 2) +## 2. Sequence + +### Build Sequence + +Below is the sequence of events that occur when a developer registers a SQL database with Nitric. + +```mermaid +sequenceDiagram + participant Worker as App Worker(s) + participant SDK as Nitric SDK + participant Nitric as Nitric CLI + participant Provider as Nitric Provider
(plugin) + participant IAC as IaC
(e.g. Terraform) + + Worker->>SDK: Register SQL Database + SDK->>Nitric: Register SQL Database + + Nitric->>Provider: Forward Nitric Spec + Provider->>IAC: Provision Database Cluster + Provider->>IAC: Provision Database Instance + Provider->>IAC: Provision IAM +``` + +### Runtime Sequence + +Below is the runtime flow of a database operation in a Nitric application, using the Nitric SDK. The SDK provides access to the connection details for the SQL database. All database operations are performed as usual, without any additional Nitric-specific steps. ```mermaid sequenceDiagram - participant Client as Client - participant NitricSDK as Nitric SDK - participant NitricRuntime as Nitric Runtime - participant SQLDatabase as SQL Database (e.g., PostgreSQL, MySQL) - - Client->>NitricSDK: Perform SQL operation (e.g., query, insert, update) - NitricSDK->>NitricRuntime: Forward SQL API call - NitricRuntime->>SQLDatabase: Execute SQL operation - - alt Successful Operation - SQLDatabase-->>NitricRuntime: Return result (e.g., query data or success status) - NitricRuntime-->>NitricSDK: Return result - NitricSDK-->>Client: Return result to client - else Failure - SQLDatabase-->>NitricRuntime: Return error - NitricRuntime-->>NitricSDK: Forward error - NitricSDK-->>Client: Return error response - end + participant Client as App Code + participant SDK as Nitric SDK + participant Nitric as Nitric Runtime
(plugin) + participant CloudAPI as Cloud DMBS
(e.g. AWS RDS) + + Client->>SDK: connectionString() + SDK->>Nitric: Forward Request + Nitric->>Nitric: Convert Request + Nitric->>CloudAPI: Retrieve Connection String + + Client->>CloudAPI: Execute SQL Query ``` ## 3. Component diff --git a/docs/architecture/websockets.mdx b/docs/architecture/websockets.mdx index aeb2dd908..34d2cd7a6 100644 --- a/docs/architecture/websockets.mdx +++ b/docs/architecture/websockets.mdx @@ -47,31 +47,66 @@ classDef edgeLabel line-height:2; ## 2. Sequence +### Build Sequence + +Here is the sequence of events that occur when a developer registers an Websocket API with Nitric, including the registration of handlers for connection, message, and disconnection events. + +```mermaid +sequenceDiagram + participant Worker as App Worker(s) + participant SDK as Nitric SDK + participant Nitric as Nitric CLI + participant Provider as Nitric Provider
(plugin) + participant IAC as IaC
(e.g. Terraform) + + Worker->>SDK: Register Websocket(s) + SDK->>Nitric: Register Websocket(s) + + Worker->>SDK: Register Connection Handler + SDK->>Nitric: Register Connection Handler + Worker->>SDK: Register Message Handler + SDK->>Nitric: Register Message Handler + Worker->>SDK: Register Disconnection Handler + SDK->>Nitric: Register Disconnection Handler + + Nitric->>Provider: Forward Nitric Spec + Provider->>IAC: Provision Websocket API + Provider->>IAC: Provision IAM +``` + +### Runtime Sequence + +Here is the sequence of events that occur at runtime when a websocket connection is established, messages are sent and received, and the connection is closed. + ```mermaid sequenceDiagram participant Client as Client + participant WSGateway as WebSocket Gateway
(e.g. AWS API Gateway) + participant NitricRuntime as Nitric Runtime
(plugin) participant NitricSDK as Nitric SDK - participant NitricRuntime as Nitric Runtime - participant WebSocketGateway as Cloud WebSocket Gateway (e.g., AWS API Gateway, GCP WebSocket Gateway) + participant App as App Code - Client->>NitricSDK: Connect to WebSocket endpoint - NitricSDK->>NitricRuntime: Forward connection request - NitricRuntime->>WebSocketGateway: Establish WebSocket connection + Client->>WSGateway: Connect to ws:// endpoint + WSGateway->>NitricRuntime: Forward Connection Event + NitricRuntime->>NitricSDK: Connection Callback loop Real-Time Communication - Client->>NitricSDK: Send or receive WebSocket message - NitricSDK->>NitricRuntime: Forward message - NitricRuntime->>WebSocketGateway: Relay message - WebSocketGateway-->>NitricRuntime: Forward response or broadcast message - NitricRuntime-->>NitricSDK: Relay message to the client - NitricSDK-->>Client: Deliver message + alt Client Message + Client->>WSGateway: Send WS Message + WSGateway->>NitricRuntime: Forward Message + NitricRuntime->>NitricSDK: Forward Message + NitricSDK->>App: Message Callback + else Server Message + App->>NitricSDK: Send WS Message + NitricSDK->>NitricRuntime: Forward Message + NitricRuntime->>WSGateway: Forward Message + WSGateway->>Client: Deliver Message + end end - alt Disconnect - Client->>NitricSDK: Disconnect from WebSocket - NitricSDK->>NitricRuntime: Notify runtime - NitricRuntime->>WebSocketGateway: Close WebSocket connection - end + Client->>WSGateway: Disconnect + WSGateway->>NitricRuntime: Forward Disconnection Event + NitricRuntime->>NitricSDK: Disconnection Callback ``` ## 3. Component From cf5f77e56b607edf20c50183496004d1f987c03d Mon Sep 17 00:00:00 2001 From: David Moore Date: Tue, 11 Feb 2025 09:38:48 +1100 Subject: [PATCH 23/38] add aria-label to mermaid zoom buttons --- src/components/MermaidZoom.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/MermaidZoom.tsx b/src/components/MermaidZoom.tsx index 0c61b4431..51cf66445 100644 --- a/src/components/MermaidZoom.tsx +++ b/src/components/MermaidZoom.tsx @@ -19,13 +19,24 @@ const MermaidZoom: React.FC = (props) => ( {({ zoomIn, zoomOut, resetTransform }) => (
- -