From dd2b07c6f49574ea5f0a8f74be227dd418a7f052 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Fri, 6 Sep 2024 12:58:48 -0500 Subject: [PATCH 01/14] chore(api-ref): Uplift API reference docs: - Adapts code from @jstirnaman's demo site to generate Hugo pages from OpenAPI paths in the InfluxDB spec files. - Uses Rapidoc to render the OpenAPI path in a page--effectively treating each endpoint as a standalone API for faster loading. - Run yarn install and then Executing: api-docs/getswagger.sh cloud-v2 -B No URL was provided. I'll rebuild from the existing spec /Users/ja/Documents/github/docs-v2/api-docs/cloud/v2/ref.yml 10.8.2 Generating OpenAPI path files in static/openapi/influxdb-cloud-v2/paths.... Generating OpenAPI article data in data/article-data/influxdb/cloud-v2... Executing: HUGO_DATAPAGES_DATA_PATH=data/article-data/influxdb/cloud-v2 HUGO_DATAPAGES_ELEMENT=articles HUGO_DATAPAGES_TYPE=api HUGO_DATAPAGES_CONTENT_PATH=content/influxdb/cloud/api/v2 node hugo-data-to-pages/hugo.js clean --force Removing data-generated files... Removed folder: ./content/influxdb/cloud/api/v2/api-v2-authorizations Removed folder: ./content/influxdb/cloud/api/v2/api-v2-buckets Removed folder: ./content/influxdb/cloud/api/v2/api-v2-checks Removed folder: ./content/influxdb/cloud/api/v2/api-v2-dashboards Removed folder: ./content/influxdb/cloud/api/v2/api-v2-dbrps Removed folder: ./content/influxdb/cloud/api/v2/api-v2-delete Removed folder: ./content/influxdb/cloud/api/v2/api-v2-flags Removed folder: ./content/influxdb/cloud/api/v2/api-v2-labels Removed folder: ./content/influxdb/cloud/api/v2/api-v2-maps Removed folder: ./content/influxdb/cloud/api/v2/api-v2-me Removed folder: ./content/influxdb/cloud/api/v2/api-v2-notificationEndpoints Removed folder: ./content/influxdb/cloud/api/v2/api-v2-notificationRules Removed folder: ./content/influxdb/cloud/api/v2/api-v2-orgs Removed folder: ./content/influxdb/cloud/api/v2/api-v2-query Removed folder: ./content/influxdb/cloud/api/v2/api-v2-resources Removed folder: ./content/influxdb/cloud/api/v2/api-v2-scripts Removed folder: ./content/influxdb/cloud/api/v2/api-v2-setup Removed folder: ./content/influxdb/cloud/api/v2/api-v2-signin Removed folder: ./content/influxdb/cloud/api/v2/api-v2-signout Removed folder: ./content/influxdb/cloud/api/v2/api-v2-stacks Removed folder: ./content/influxdb/cloud/api/v2/api-v2-tasks Removed folder: ./content/influxdb/cloud/api/v2/api-v2-telegraf Removed folder: ./content/influxdb/cloud/api/v2/api-v2-telegrafs Removed folder: ./content/influxdb/cloud/api/v2/api-v2-templates Removed folder: ./content/influxdb/cloud/api/v2/api-v2-users Removed folder: ./content/influxdb/cloud/api/v2/api-v2-variables Removed folder: ./content/influxdb/cloud/api/v2/api-v2-write Removed folder: ./content/influxdb/cloud/api/v2/api-v2 Removed folder: ./content/influxdb/cloud/api/v2/legacy-authorizations Removed folder: ./content/influxdb/cloud/api/v2/ping Removed folder: ./content/influxdb/cloud/api/v2/query Removed folder: ./content/influxdb/cloud/api/v2/write Done! Executing: HUGO_DATAPAGES_DATA_PATH=data/article-data/influxdb/cloud-v2 HUGO_DATAPAGES_ELEMENT=articles HUGO_DATAPAGES_TYPE=api HUGO_DATAPAGES_CONTENT_PATH=content/influxdb/cloud/api/v2 node hugo-data-to-pages/hugo.js generate Building data-generated files... Created file: ./content/influxdb/cloud/api/v2/api-v2-authorizations/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-buckets/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-checks/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-dashboards/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-dbrps/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-delete/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-flags/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-labels/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-maps/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-me/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-notificationEndpoints/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-notificationRules/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-orgs/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-query/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-resources/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-scripts/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-setup/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-signin/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-signout/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-stacks/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-tasks/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-telegraf/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-telegrafs/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-templates/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-users/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-variables/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2-write/index.md Created file: ./content/influxdb/cloud/api/v2/api-v2/index.md Created file: ./content/influxdb/cloud/api/v2/legacy-authorizations/index.md Created file: ./content/influxdb/cloud/api/v2/ping/index.md Created file: ./content/influxdb/cloud/api/v2/query/index.md Created file: ./content/influxdb/cloud/api/v2/write/index.md Done! Executing: api-docs/getswagger.sh oss-v2 -B No URL was provided. I'll rebuild from the existing spec /Users/ja/Documents/github/docs-v2/api-docs/v2/ref.yml 10.8.2 Generating OpenAPI path files in static/openapi/influxdb-oss-v2/paths.... Generating OpenAPI article data in data/article-data/influxdb/oss-v2... Executing: HUGO_DATAPAGES_DATA_PATH=data/article-data/influxdb/oss-v2 HUGO_DATAPAGES_ELEMENT=articles HUGO_DATAPAGES_TYPE=api HUGO_DATAPAGES_CONTENT_PATH=content/influxdb/v2/api/v2 node hugo-data-to-pages/hugo.js clean --force Removing data-generated files... Removed folder: ./content/influxdb/v2/api/v2/api-v2-authorizations Removed folder: ./content/influxdb/v2/api/v2/api-v2-backup Removed folder: ./content/influxdb/v2/api/v2/api-v2-buckets Removed folder: ./content/influxdb/v2/api/v2/api-v2-checks Removed folder: ./content/influxdb/v2/api/v2/api-v2-config Removed folder: ./content/influxdb/v2/api/v2/api-v2-dashboards Removed folder: ./content/influxdb/v2/api/v2/api-v2-dbrps Removed folder: ./content/influxdb/v2/api/v2/api-v2-delete Removed folder: ./content/influxdb/v2/api/v2/api-v2-flags Removed folder: ./content/influxdb/v2/api/v2/api-v2-labels Removed folder: ./content/influxdb/v2/api/v2/api-v2-maps Removed folder: ./content/influxdb/v2/api/v2/api-v2-me Removed folder: ./content/influxdb/v2/api/v2/api-v2-notificationEndpoints Removed folder: ./content/influxdb/v2/api/v2/api-v2-notificationRules Removed folder: ./content/influxdb/v2/api/v2/api-v2-orgs Removed folder: ./content/influxdb/v2/api/v2/api-v2-query Removed folder: ./content/influxdb/v2/api/v2/api-v2-remotes Removed folder: ./content/influxdb/v2/api/v2/api-v2-replications Removed folder: ./content/influxdb/v2/api/v2/api-v2-resources Removed folder: ./content/influxdb/v2/api/v2/api-v2-restore Removed folder: ./content/influxdb/v2/api/v2/api-v2-scrapers Removed folder: ./content/influxdb/v2/api/v2/api-v2-setup Removed folder: ./content/influxdb/v2/api/v2/api-v2-signin Removed folder: ./content/influxdb/v2/api/v2/api-v2-signout Removed folder: ./content/influxdb/v2/api/v2/api-v2-sources Removed folder: ./content/influxdb/v2/api/v2/api-v2-stacks Removed folder: ./content/influxdb/v2/api/v2/api-v2-tasks Removed folder: ./content/influxdb/v2/api/v2/api-v2-telegraf Removed folder: ./content/influxdb/v2/api/v2/api-v2-telegrafs Removed folder: ./content/influxdb/v2/api/v2/api-v2-templates Removed folder: ./content/influxdb/v2/api/v2/api-v2-users Removed folder: ./content/influxdb/v2/api/v2/api-v2-variables Removed folder: ./content/influxdb/v2/api/v2/api-v2-write Removed folder: ./content/influxdb/v2/api/v2/api-v2 Removed folder: ./content/influxdb/v2/api/v2/debug-pprof-all Removed folder: ./content/influxdb/v2/api/v2/debug-pprof-allocs Removed folder: ./content/influxdb/v2/api/v2/debug-pprof-block Removed folder: ./content/influxdb/v2/api/v2/debug-pprof-cmdline Removed folder: ./content/influxdb/v2/api/v2/debug-pprof-goroutine Removed folder: ./content/influxdb/v2/api/v2/debug-pprof-heap Removed folder: ./content/influxdb/v2/api/v2/debug-pprof-mutex Removed folder: ./content/influxdb/v2/api/v2/debug-pprof-profile Removed folder: ./content/influxdb/v2/api/v2/debug-pprof-threadcreate Removed folder: ./content/influxdb/v2/api/v2/debug-pprof-trace Removed folder: ./content/influxdb/v2/api/v2/health Removed folder: ./content/influxdb/v2/api/v2/legacy-authorizations Removed folder: ./content/influxdb/v2/api/v2/metrics Removed folder: ./content/influxdb/v2/api/v2/ping Removed folder: ./content/influxdb/v2/api/v2/query Removed folder: ./content/influxdb/v2/api/v2/ready Removed folder: ./content/influxdb/v2/api/v2/write Done! Executing: HUGO_DATAPAGES_DATA_PATH=data/article-data/influxdb/oss-v2 HUGO_DATAPAGES_ELEMENT=articles HUGO_DATAPAGES_TYPE=api HUGO_DATAPAGES_CONTENT_PATH=content/influxdb/v2/api/v2 node hugo-data-to-pages/hugo.js generate Building data-generated files... Created file: ./content/influxdb/v2/api/v2/api-v2-authorizations/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-backup/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-buckets/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-checks/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-config/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-dashboards/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-dbrps/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-delete/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-flags/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-labels/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-maps/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-me/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-notificationEndpoints/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-notificationRules/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-orgs/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-query/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-remotes/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-replications/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-resources/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-restore/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-scrapers/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-setup/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-signin/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-signout/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-sources/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-stacks/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-tasks/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-telegraf/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-telegrafs/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-templates/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-users/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-variables/index.md Created file: ./content/influxdb/v2/api/v2/api-v2-write/index.md Created file: ./content/influxdb/v2/api/v2/api-v2/index.md Created file: ./content/influxdb/v2/api/v2/debug-pprof-all/index.md Created file: ./content/influxdb/v2/api/v2/debug-pprof-allocs/index.md Created file: ./content/influxdb/v2/api/v2/debug-pprof-block/index.md Created file: ./content/influxdb/v2/api/v2/debug-pprof-cmdline/index.md Created file: ./content/influxdb/v2/api/v2/debug-pprof-goroutine/index.md Created file: ./content/influxdb/v2/api/v2/debug-pprof-heap/index.md Created file: ./content/influxdb/v2/api/v2/debug-pprof-mutex/index.md Created file: ./content/influxdb/v2/api/v2/debug-pprof-profile/index.md Created file: ./content/influxdb/v2/api/v2/debug-pprof-threadcreate/index.md Created file: ./content/influxdb/v2/api/v2/debug-pprof-trace/index.md Created file: ./content/influxdb/v2/api/v2/health/index.md Created file: ./content/influxdb/v2/api/v2/legacy-authorizations/index.md Created file: ./content/influxdb/v2/api/v2/metrics/index.md Created file: ./content/influxdb/v2/api/v2/ping/index.md Created file: ./content/influxdb/v2/api/v2/query/index.md Created file: ./content/influxdb/v2/api/v2/ready/index.md Created file: ./content/influxdb/v2/api/v2/write/index.md Done! to generate the paths, metadata, and pages. --- .gitignore | 2 + api-docs/cloud/v2/ref.yml | 25 +- api-docs/getswagger.sh | 90 ++- api-docs/package.json | 3 +- api-docs/scripts/generate-openapi-articles.js | 79 ++ .../scripts/openapi-paths-to-hugo-data/cli.js | 62 ++ .../openapi-paths-to-hugo-data/index.js | 133 +++ .../openapi-paths-to-hugo-data/package.json | 19 + api-docs/v2/ref.yml | 16 +- .../influxdb/cloud-v2/articles.yml | 499 ++++++++++++ .../article-data/influxdb/oss-v2/articles.yml | 757 ++++++++++++++++++ hugo-data-to-pages/.gitignore | 7 + hugo-data-to-pages/LICENSE.md | 21 + hugo-data-to-pages/README.md | 46 ++ hugo-data-to-pages/hugo.js | 125 +++ hugo-data-to-pages/package.json | 22 + layouts/_default/api.html | 41 +- layouts/_default/old-api.html | 1 + layouts/api/single.html | 39 + 19 files changed, 1924 insertions(+), 63 deletions(-) create mode 100644 api-docs/scripts/generate-openapi-articles.js create mode 100644 api-docs/scripts/openapi-paths-to-hugo-data/cli.js create mode 100644 api-docs/scripts/openapi-paths-to-hugo-data/index.js create mode 100644 api-docs/scripts/openapi-paths-to-hugo-data/package.json create mode 100644 data/article-data/influxdb/cloud-v2/articles.yml create mode 100644 data/article-data/influxdb/oss-v2/articles.yml create mode 100644 hugo-data-to-pages/.gitignore create mode 100644 hugo-data-to-pages/LICENSE.md create mode 100644 hugo-data-to-pages/README.md create mode 100755 hugo-data-to-pages/hugo.js create mode 100644 hugo-data-to-pages/package.json create mode 100644 layouts/_default/old-api.html create mode 100644 layouts/api/single.html diff --git a/.gitignore b/.gitignore index 254ec132e7..aced39f60d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ node_modules .hugo_build.lock /content/influxdb/*/api/**/*.html /api-docs/redoc-static.html* +/content/influxdb/*/api/** +/static/openapi .vscode/* .idea **/config.toml diff --git a/api-docs/cloud/v2/ref.yml b/api-docs/cloud/v2/ref.yml index df84bf180b..2866b2efef 100644 --- a/api-docs/cloud/v2/ref.yml +++ b/api-docs/cloud/v2/ref.yml @@ -12,14 +12,7 @@ info: url: https://opensource.org/licenses/MIT summary: The InfluxDB v2 HTTP API provides a programmatic interface for all interactions with InfluxDB v2. servers: - - url: https://{baseurl} - description: InfluxDB Cloud API URL - variables: - baseurl: - enum: - - us-east-1-1.aws.cloud2.influxdata.com - default: us-east-1-1.aws.cloud2.influxdata.com - description: InfluxDB Cloud URL + - url: / security: - TokenAuthentication: [] tags: @@ -14600,9 +14593,9 @@ components: properties: results: description: | - A resultset object that contains the `statement_id` and the `series` array. + A resultset object that contains the `statement_id` and the `series` array. - Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. + Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. items: properties: error: @@ -14651,12 +14644,12 @@ components: type: integer type: object oneOf: - - required: - - statement_id - - error - - required: - - statement_id - - series + - required: + - statement_id + - error + - required: + - statement_id + - series type: array type: object IntegerLiteral: diff --git a/api-docs/getswagger.sh b/api-docs/getswagger.sh index 8d0fd3061a..1b7581a7e2 100755 --- a/api-docs/getswagger.sh +++ b/api-docs/getswagger.sh @@ -21,10 +21,13 @@ # sh ./getswagger.sh -c -o -B # # Examples: -# sh ./getswagger.sh cloud-serverless +# sh ./getswagger.sh cloud-serverless-v2 # sh ./getswagger.sh clustered -B -# sh ./getswagger.sh cloud -# sh ./getswagger.sh -c v2 -o v2.0 -b file:///Users/johnsmith/github/openapi +# sh ./getswagger.sh cloud-v2 +# sh ./getswagger.sh -c oss-v2 -b file:///Users/johnsmith/github/openapi + +DOCS_ROOT=$(git rev-parse --show-toplevel) +API_DOCS_ROOT=$DOCS_ROOT/api-docs versionDirs=($(ls -d */)) latestOSS=${versionDirs[${#versionDirs[@]}-1]} @@ -62,7 +65,7 @@ function showHelp { subcommand=$1 case "$subcommand" in - cloud-dedicated-v2|cloud-dedicated-management|cloud-serverless-v2|clustered-v2|cloud-v2|v2|v1-compat|all) + cloud-dedicated-v2|cloud-dedicated-management|cloud-serverless-v2|clustered-v2|cloud-v2|oss-v2|v2|v1-compat|all) product=$1 shift @@ -117,7 +120,6 @@ function postProcess() { api="$3" openapiCLI=" @redocly/cli" - currentPath=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # TODO: Move some of this into the plugin: @@ -131,101 +133,112 @@ function postProcess() { npx --version INFLUXDB_PRODUCT=$(dirname "$configPath") \ INFLUXDB_API_NAME=$(echo "$api" | sed 's/@.*//g;') \ - API_DOCS_ROOT_PATH=$currentPath \ + API_DOCS_ROOT_PATH=$API_DOCS_ROOT \ npm_config_yes=true \ npx $openapiCLI bundle $specPath \ -o $specPath \ --config=$configPath } - function updateCloudV2 { - outFile="cloud/v2/ref.yml" +function updateOSS { + outFile="$API_DOCS_ROOT/v2/ref.yml" + if [[ -z "$baseUrlOSS" ]]; + then + echo "No URL was provided. I'll rebuild from the existing spec $outFile" + else + curl $UPDATE_OPTIONS ${baseUrlOSS}/contracts/ref/oss.yml -o $outFile + fi + postProcess $outFile "$API_DOCS_ROOT/v2/.config.yml" '@2' +} + +function updateCloudV2 { + outFile="$API_DOCS_ROOT/cloud/v2/ref.yml" if [[ -z "$baseUrl" ]]; then - echo "Using existing $outFile" + echo "No URL was provided. I'll rebuild from the existing spec $outFile" else curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/cloud.yml -o $outFile fi - postProcess $outFile 'cloud/.config.yml' v2@2 + postProcess $outFile "$API_DOCS_ROOT/cloud/.config.yml" v2@2 } function updateCloudDedicatedManagement { - outFile="cloud-dedicated/management/openapi.yml" + outFile="$API_DOCS_ROOT/cloud-dedicated/management/openapi.yml" if [[ -z "$baseUrl" ]]; then - echo "Using existing $outFile" + echo "No URL was provided. I'll rebuild from the existing spec $outFile" else curl $UPDATE_OPTIONS https://raw.githubusercontent.com/influxdata/granite/ab7ee2aceacfae7f415d15ffbcf8c9d0f6f3e015/openapi.yaml -o $outFile fi - postProcess $outFile 'cloud-dedicated/.config.yml' management@0 + postProcess $outFile "$API_DOCS_ROOT/cloud-dedicated/.config.yml" management@0 } function updateCloudDedicatedV2 { - outFile="cloud-dedicated/v2/ref.yml" + outFile="$API_DOCS_ROOT/cloud-dedicated/v2/ref.yml" if [[ -z "$baseUrl" ]]; then - echo "Using existing $outFile" + echo "No URL was provided. I'll rebuild from the existing spec $outFile" else curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/cloud.yml -o $outFile fi - postProcess $outFile 'cloud-dedicated/.config.yml' v2@2 + postProcess $outFile "$API_DOCS_ROOT/cloud-dedicated/.config.yml" v2@2 } function updateClusteredV2 { - outFile="clustered/v2/ref.yml" + outFile="$API_DOCS_ROOT/clustered/v2/ref.yml" if [[ -z "$baseUrl" ]]; then - echo "Using existing $outFile" + echo "No URL was provided. I'll rebuild from the existing spec $outFile" else curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/cloud.yml -o $outFile fi - postProcess $outFile 'clustered/.config.yml' v2@2 + postProcess $outFile "$API_DOCS_ROOT/clustered/.config.yml" v2@2 } function updateCloudServerlessV2 { - outFile="cloud-serverless/v2/ref.yml" + outFile="$API_DOCS_ROOT/cloud-serverless/v2/ref.yml" if [[ -z "$baseUrl" ]]; then - echo "Using existing $outFile" + echo "No URL was provided. I'll rebuild from the existing spec $outFile" else curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/cloud.yml -o $outFile fi - postProcess $outFile 'cloud-serverless/.config.yml' v2@2 + postProcess $outFile "$API_DOCS_ROOT/cloud-serverless/.config.yml" v2@2 } function updateOSSV2 { - outFile="v2/ref.yml" + outFile="$API_DOCS_ROOT/v2/ref.yml" if [[ -z "$baseUrlOSS" ]]; then - echo "Using existing $outFile" + echo "No URL was provided. I'll rebuild from the existing spec $outFile" else curl $UPDATE_OPTIONS ${baseUrlOSS}/contracts/ref/oss.yml -o $outFile fi - postProcess $outFile 'v2/.config.yml' '@2' + postProcess $outFile "$API_DOCS_ROOT/v2/.config.yml" '@2' } -function updateV1Compat { - outFile="cloud/v1-compatibility/swaggerV1Compat.yml" +function updateV1Compat { + outFile="$API_DOCS_ROOT/cloud/v1-compatibility/swaggerV1Compat.yml" if [[ -z "$baseUrl" ]]; then - echo "Using existing $outFile" + echo "No URL was provided. I'll rebuild from the existing spec $outFile" else curl $UPDATE_OPTIONS ${baseUrl}/contracts/swaggerV1Compat.yml -o $outFile fi - postProcess $outFile 'cloud/.config.yml' 'v1-compatibility' + postProcess $outFile "$API_DOCS_ROOT/cloud/.config.yml" 'v1-compatibility' - outFile="v2/v1-compatibility/swaggerV1Compat.yml" + outFile="$API_DOCS_ROOT/v2/v1-compatibility/swaggerV1Compat.yml" cp cloud/v1-compatibility/swaggerV1Compat.yml $outFile - postProcess $outFile 'v2/.config.yml' 'v1-compatibility' + postProcess $outFile "$API_DOCS_ROOT/v2/.config.yml" 'v1-compatibility' - outFile="cloud-dedicated/v1-compatibility/swaggerV1Compat.yml" - postProcess $outFile 'cloud-dedicated/.config.yml' 'v1-compatibility' + outFile="$API_DOCS_ROOT/cloud-dedicated/v1-compatibility/swaggerV1Compat.yml" + postProcess $outFile "$API_DOCS_ROOT/cloud-dedicated/.config.yml" 'v1-compatibility' - outFile="cloud-serverless/v1-compatibility/swaggerV1Compat.yml" - postProcess $outFile 'cloud-serverless/.config.yml' 'v1-compatibility' + outFile="$API_DOCS_ROOT/cloud-serverless/v1-compatibility/swaggerV1Compat.yml" + postProcess $outFile "$API_DOCS_ROOT/cloud-serverless/.config.yml" 'v1-compatibility' - outFile="clustered/v1-compatibility/swaggerV1Compat.yml" - postProcess $outFile 'clustered/.config.yml' 'v1-compatibility' + outFile="$API_DOCS_ROOT/clustered/v1-compatibility/swaggerV1Compat.yml" + postProcess $outFile "$API_DOCS_ROOT/clustered/.config.yml" 'v1-compatibility' } UPDATE_OPTIONS="--fail" @@ -252,6 +265,9 @@ then elif [ "$product" = "clustered-v2" ]; then updateClusteredV2 +elif [ "$product" = "oss-v2" ]; +then + updateOSSV2 elif [ "$product" = "v2" ]; then updateOSSV2 diff --git a/api-docs/package.json b/api-docs/package.json index 1e81d828db..7c69bc2e08 100755 --- a/api-docs/package.json +++ b/api-docs/package.json @@ -5,6 +5,7 @@ "description": "InfluxDB API documentation", "license": "MIT", "dependencies": { - "js-yaml": "^4.1.0" + "js-yaml": "^4.1.0", + "hugo-data-to-pages": "file:../hugo-data-to-pages/hugo.js" } } diff --git a/api-docs/scripts/generate-openapi-articles.js b/api-docs/scripts/generate-openapi-articles.js new file mode 100644 index 0000000000..3e151e972f --- /dev/null +++ b/api-docs/scripts/generate-openapi-articles.js @@ -0,0 +1,79 @@ +const { execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const openapiPathsToHugo = require('./openapi-paths-to-hugo-data/index.js'); + +// Calculate the relative paths +const DOCS_ROOT = '.'; +const API_DOCS_ROOT = 'api-docs'; + +// Function to execute shell commands +const execCommand = (command) => { + try { + console.log(`Executing: ${command}`); + execSync(command, { stdio: 'inherit' }); + } catch (error) { + console.error(`Error executing command: ${command}`); + process.exit(1); + } +}; + + + +// Function to generate data from OpenAPI +function generateDataFromOpenAPI(specFile, dataOutPath, articleOutPath) { + if (!fs.existsSync(dataOutPath)) { + fs.mkdirSync(dataOutPath, { recursive: true }); + } + + openapiPathsToHugo.generateHugoData({ + dataOutPath, + articleOutPath, + specFile + }); +}; + +// Example usage of generateDataFromOpenAPI function +// generateDataFromOpenAPI('path/to/openapi-file.yml', 'path/to/paths-output-folder', 'path/to/metadata-output-folder'); + +function generatePagesFromArticleData(articlesPath, contentPath) { + execCommand( + `HUGO_DATAPAGES_DATA_PATH=${articlesPath} \ + HUGO_DATAPAGES_ELEMENT=articles \ + HUGO_DATAPAGES_TYPE=api \ + HUGO_DATAPAGES_CONTENT_PATH=${contentPath} \ + node ${path.join(DOCS_ROOT, '/hugo-data-to-pages/hugo.js')} clean --force` + ) + execCommand( + `HUGO_DATAPAGES_DATA_PATH=${articlesPath} \ + HUGO_DATAPAGES_ELEMENT=articles \ + HUGO_DATAPAGES_TYPE=api \ + HUGO_DATAPAGES_CONTENT_PATH=${contentPath} \ + node ${path.join(DOCS_ROOT, '/hugo-data-to-pages/hugo.js')} generate` + ) +} + +const api_reference_paths = { + 'cloud-v2': { + spec_file: path.join(API_DOCS_ROOT, '/cloud/v2/ref.yml'), + pages_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2'), + }, + 'oss-v2': { + spec_file: path.join(API_DOCS_ROOT, '/v2/ref.yml'), + pages_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2'), + } +} + +Object.keys(api_reference_paths).forEach((key) => { + const api = api_reference_paths[key]; + const staticPath = path.join(DOCS_ROOT, '/static/openapi'); + const staticSpecPath = path.join(staticPath, `/influxdb-${key}.yml`); + const staticPathsPath = path.join(staticPath, `/influxdb-${key}/paths`); + const articlesPath = path.join(DOCS_ROOT, `/data/article-data/influxdb/${key}`); + // Execute the getswagger.sh script + execCommand(`${path.join(API_DOCS_ROOT, 'getswagger.sh')} ${key} -B`); + // Copy the generated OpenAPI spec to the static folder + fs.copyFileSync(api.spec_file, staticSpecPath); + generateDataFromOpenAPI(api.spec_file, staticPathsPath, articlesPath); + generatePagesFromArticleData(articlesPath, api.pages_dir); +}); diff --git a/api-docs/scripts/openapi-paths-to-hugo-data/cli.js b/api-docs/scripts/openapi-paths-to-hugo-data/cli.js new file mode 100644 index 0000000000..983f346a60 --- /dev/null +++ b/api-docs/scripts/openapi-paths-to-hugo-data/cli.js @@ -0,0 +1,62 @@ +const path = require('path'); +const argparse = require('argparse'); +const openapiPathsToHugo = require('./index.js'); + +const cli = new argparse.ArgumentParser({ + prog: 'openapi-docs', + add_help: true +}); + +cli.add_argument('--hugo', { + help: 'Generate Hugo data from OpenAPI paths', + dest: 'generateHugoData' +}); + +cli.add_argument('-d', '--data-output', { + help: 'Filepath where generated OpenAPI data output will be written.', + dest: 'dataOutPath' +}); + +cli.add_argument('-o', '--article-data-output', { + help: 'Filepath where generated article metadata output will be written.', + dest: 'articleOutPath' +}); + +cli.add_argument('-pre', '--path-prefix', { + help: 'A path to use as the prefix for the path property in each generated article.', + dest: 'pathPrefix' +}); + +cli.add_argument('file', { + help: 'File to read, utf-8 encoded without BOM', + nargs: '?', + default: '-' +}); + + +//////////////////////////////////////////////////////////////////////////////// + + +var options = cli.parse_args(); + + +/* Usage examples + * + node ./openapi-paths-to-hugo-data/index.js \ + ./data/influxdb/cloud/openapi.yaml \ + -d ./data/influxdb/cloud/path-apis \ + -o ./data/article-data/influxdb/cloud + + node ./openapi-paths-to-hugo-data/index.js \ + ./data/influxdb/oss/openapi.yaml \ + -d ./data/influxdb/oss/path-apis \ + -o ./data/article-data/influxdb/oss + * + */ + +//////////////////////////////////////////////////////////////////////////////// + + +if (options.generateHugoData) { + openapiPathsToHugo.generateHugoData(options); +} diff --git a/api-docs/scripts/openapi-paths-to-hugo-data/index.js b/api-docs/scripts/openapi-paths-to-hugo-data/index.js new file mode 100644 index 0000000000..5c3407fc8b --- /dev/null +++ b/api-docs/scripts/openapi-paths-to-hugo-data/index.js @@ -0,0 +1,133 @@ +const yaml = require('js-yaml'); +const fs = require('fs'); +const path = require('path'); + + +function readFile(filepath, encoding, callback) { + return yaml.load(fs.readFileSync(filepath, encoding)); +} + +function writeDataFile(data, outputTo, callback) { + fs.writeFileSync(outputTo, yaml.dump(data)); +} + +const openapiUtils = { + isPlaceholderFragment: function(str) { + const placeholderRegex = new RegExp('^\{.*\}$'); + return placeholderRegex.test(str); + } +} + +function writePathOpenapis(openapi, prefix, outPath) { + const pathGroups = {}; + Object.keys(openapi.paths).sort() + .forEach((p) => { + const delimiter = '/'; + let key = p.split(delimiter); + + let isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]); + if(isItemPath) { + key = key.slice(0, -1); + } + key = (key.slice(0, 4)) + + isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]); + if(isItemPath) { + key = key.slice(0, -1); + } + const groupKey = key.join('/'); + pathGroups[groupKey] = pathGroups[groupKey] || {}; + pathGroups[groupKey][p] = openapi.paths[p]; + }) + + Object.keys(pathGroups).forEach(pg => { + // Deep copy openapi. + let doc = JSON.stringify(openapi); + doc = JSON.parse(doc); + doc.paths = pathGroups[pg]; + doc.info.title = `${pg}\n${doc.info.title}`; + doc['x-pathGroup'] = pg; + try { + if (!fs.existsSync(outPath)) { + fs.mkdirSync(outPath, {recursive: true}); + } + const realOutPath = path.resolve(outPath, `${prefix}${pg.replaceAll('/', '-').replace(/^-/, '')}.yaml`); + writeDataFile(doc, realOutPath); + } catch (err) { + console.error(err); + } + }) +} + +function createArticleDataForPathGroup(openapi) { + const article = { + path: '', + fields: { + name: openapi['x-pathGroup'], + describes: Object.keys(openapi.paths) + } + }; + const snakifyPath = (p) => { + if(!path) { + return; + } + return p.replace(/^\//, '') + .replaceAll('/', '-'); + } + article.path = snakifyPath(openapi['x-pathGroup']); + article.fields.title = openapi.info && openapi.info.title; + article.fields.description = openapi.description; + const pathGroupFrags = path.parse(openapi['x-pathGroup']); + article.fields.tags = ([pathGroupFrags?.dir, pathGroupFrags?.name]).map( + t => snakifyPath(t) + ) + return article; +} + +function writeOpenapiArticleData(sourcePath, targetPath, opts) { + const isFile = filePath => { + return fs.lstatSync(filePath).isFile(); + }; + + const matchesPattern = filePath => { + return opts.filePattern ? path.parse(filePath).name.startsWith(opts.filePattern) : true; + }; + + try { + const articles = fs.readdirSync(sourcePath) + .map(fileName => { + return path.join(sourcePath, fileName); + }) + .filter(matchesPattern) + .filter(isFile) + .map(filePath => { + const openapi = readFile(filePath); + const article = createArticleDataForPathGroup(openapi); + article.fields.source = filePath; + article.fields.staticFilePath = filePath.replace(/^static\//, '/'); // This might appear counterintuitive; Hugo omits "/static" from the URI when serving files stored in the "./static" directory. + return article; + }); + if (!fs.existsSync(targetPath)) { + fs.mkdirSync(targetPath, {recursive: true}); + } + const articlePath = path.resolve(targetPath, 'articles.yml'); + writeDataFile({ articles }, articlePath); + } catch(e) { + console.log(e); + } +} + +function generateHugoData(options) { + const filenamePrefix = `${path.parse(options.specFile).name}-`; + + const sourceFile = readFile(options.specFile, 'utf8'); + console.log(`Generating OpenAPI path files in ${options.dataOutPath}....`); + writePathOpenapis(sourceFile, filenamePrefix, options.dataOutPath); + + console.log(`Generating OpenAPI article data in ${options.articleOutPath}...`); + writeOpenapiArticleData(options.dataOutPath, options.articleOutPath, {filePattern: filenamePrefix}); +} + +module.exports = { + generateHugoData +}; \ No newline at end of file diff --git a/api-docs/scripts/openapi-paths-to-hugo-data/package.json b/api-docs/scripts/openapi-paths-to-hugo-data/package.json new file mode 100644 index 0000000000..5c69626487 --- /dev/null +++ b/api-docs/scripts/openapi-paths-to-hugo-data/package.json @@ -0,0 +1,19 @@ +{ + "name": "openapi-paths-to-hugo-data", + "version": "1.0.0", + "description": "A tool to convert OpenAPI v3 paths to Hugo data.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "OpenAPI", + "Hugo", + "YAML" + ], + "author": "Jason Stirnaman", + "license": "ISC", + "dependencies": { + "js-yaml": "^4.1.0" + } +} diff --git a/api-docs/v2/ref.yml b/api-docs/v2/ref.yml index 28fbe371e2..2179ecd684 100644 --- a/api-docs/v2/ref.yml +++ b/api-docs/v2/ref.yml @@ -15515,9 +15515,9 @@ components: properties: results: description: | - A resultset object that contains the `statement_id` and the `series` array. + A resultset object that contains the `statement_id` and the `series` array. - Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. + Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. items: properties: error: @@ -15566,12 +15566,12 @@ components: type: integer type: object oneOf: - - required: - - statement_id - - error - - required: - - statement_id - - series + - required: + - statement_id + - error + - required: + - statement_id + - series type: array type: object IntegerLiteral: diff --git a/data/article-data/influxdb/cloud-v2/articles.yml b/data/article-data/influxdb/cloud-v2/articles.yml new file mode 100644 index 0000000000..9aa1d5a54a --- /dev/null +++ b/data/article-data/influxdb/cloud-v2/articles.yml @@ -0,0 +1,499 @@ +articles: + - path: api-v2-authorizations + fields: + name: /api/v2/authorizations + describes: + - /api/v2/authorizations + - /api/v2/authorizations/{authID} + title: |- + /api/v2/authorizations + InfluxDB Cloud API Service + tags: + - api-v2 + - authorizations + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-authorizations.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-authorizations.yaml + - path: api-v2-buckets + fields: + name: /api/v2/buckets + describes: + - /api/v2/buckets + - /api/v2/buckets/{bucketID} + - /api/v2/buckets/{bucketID}/labels + - /api/v2/buckets/{bucketID}/labels/{labelID} + - /api/v2/buckets/{bucketID}/members + - /api/v2/buckets/{bucketID}/members/{userID} + - /api/v2/buckets/{bucketID}/owners + - /api/v2/buckets/{bucketID}/owners/{userID} + - /api/v2/buckets/{bucketID}/schema/measurements + - /api/v2/buckets/{bucketID}/schema/measurements/{measurementID} + title: |- + /api/v2/buckets + InfluxDB Cloud API Service + tags: + - api-v2 + - buckets + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-buckets.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-buckets.yaml + - path: api-v2-checks + fields: + name: /api/v2/checks + describes: + - /api/v2/checks + - /api/v2/checks/{checkID} + - /api/v2/checks/{checkID}/labels + - /api/v2/checks/{checkID}/labels/{labelID} + - /api/v2/checks/{checkID}/query + title: |- + /api/v2/checks + InfluxDB Cloud API Service + tags: + - api-v2 + - checks + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-checks.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-checks.yaml + - path: api-v2-dashboards + fields: + name: /api/v2/dashboards + describes: + - /api/v2/dashboards + - /api/v2/dashboards/{dashboardID} + - /api/v2/dashboards/{dashboardID}/cells + - /api/v2/dashboards/{dashboardID}/cells/{cellID} + - /api/v2/dashboards/{dashboardID}/cells/{cellID}/view + - /api/v2/dashboards/{dashboardID}/labels + - /api/v2/dashboards/{dashboardID}/labels/{labelID} + - /api/v2/dashboards/{dashboardID}/members + - /api/v2/dashboards/{dashboardID}/members/{userID} + - /api/v2/dashboards/{dashboardID}/owners + - /api/v2/dashboards/{dashboardID}/owners/{userID} + title: |- + /api/v2/dashboards + InfluxDB Cloud API Service + tags: + - api-v2 + - dashboards + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-dashboards.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-dashboards.yaml + - path: api-v2-dbrps + fields: + name: /api/v2/dbrps + describes: + - /api/v2/dbrps + - /api/v2/dbrps/{dbrpID} + title: |- + /api/v2/dbrps + InfluxDB Cloud API Service + tags: + - api-v2 + - dbrps + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-dbrps.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-dbrps.yaml + - path: api-v2-delete + fields: + name: /api/v2/delete + describes: + - /api/v2/delete + title: |- + /api/v2/delete + InfluxDB Cloud API Service + tags: + - api-v2 + - delete + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-delete.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-delete.yaml + - path: api-v2-flags + fields: + name: /api/v2/flags + describes: + - /api/v2/flags + title: |- + /api/v2/flags + InfluxDB Cloud API Service + tags: + - api-v2 + - flags + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-flags.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-flags.yaml + - path: api-v2-labels + fields: + name: /api/v2/labels + describes: + - /api/v2/labels + - /api/v2/labels/{labelID} + title: |- + /api/v2/labels + InfluxDB Cloud API Service + tags: + - api-v2 + - labels + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-labels.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-labels.yaml + - path: api-v2-maps + fields: + name: /api/v2/maps + describes: + - /api/v2/maps/mapToken + title: |- + /api/v2/maps + InfluxDB Cloud API Service + tags: + - api-v2 + - maps + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-maps.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-maps.yaml + - path: api-v2-me + fields: + name: /api/v2/me + describes: + - /api/v2/me + - /api/v2/me/password + title: |- + /api/v2/me + InfluxDB Cloud API Service + tags: + - api-v2 + - me + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-me.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-me.yaml + - path: api-v2-notificationEndpoints + fields: + name: /api/v2/notificationEndpoints + describes: + - /api/v2/notificationEndpoints + - /api/v2/notificationEndpoints/{endpointID} + - /api/v2/notificationEndpoints/{endpointID}/labels + - /api/v2/notificationEndpoints/{endpointID}/labels/{labelID} + title: |- + /api/v2/notificationEndpoints + InfluxDB Cloud API Service + tags: + - api-v2 + - notificationEndpoints + source: >- + static/openapi/influxdb-cloud-v2/paths/ref-api-v2-notificationEndpoints.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-notificationEndpoints.yaml + - path: api-v2-notificationRules + fields: + name: /api/v2/notificationRules + describes: + - /api/v2/notificationRules + - /api/v2/notificationRules/{ruleID} + - /api/v2/notificationRules/{ruleID}/labels + - /api/v2/notificationRules/{ruleID}/labels/{labelID} + - /api/v2/notificationRules/{ruleID}/query + title: |- + /api/v2/notificationRules + InfluxDB Cloud API Service + tags: + - api-v2 + - notificationRules + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-notificationRules.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-notificationRules.yaml + - path: api-v2-orgs + fields: + name: /api/v2/orgs + describes: + - /api/v2/orgs + - /api/v2/orgs/{orgID} + - /api/v2/orgs/{orgID}/limits + - /api/v2/orgs/{orgID}/members + - /api/v2/orgs/{orgID}/members/{userID} + - /api/v2/orgs/{orgID}/owners + - /api/v2/orgs/{orgID}/owners/{userID} + - /api/v2/orgs/{orgID}/secrets + - /api/v2/orgs/{orgID}/secrets/delete + - /api/v2/orgs/{orgID}/secrets/{secretID} + - /api/v2/orgs/{orgID}/usage + title: |- + /api/v2/orgs + InfluxDB Cloud API Service + tags: + - api-v2 + - orgs + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-orgs.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-orgs.yaml + - path: api-v2-query + fields: + name: /api/v2/query + describes: + - /api/v2/query + - /api/v2/query/analyze + - /api/v2/query/ast + - /api/v2/query/suggestions + - /api/v2/query/suggestions/{name} + title: |- + /api/v2/query + InfluxDB Cloud API Service + tags: + - api-v2 + - query + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-query.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-query.yaml + - path: api-v2-resources + fields: + name: /api/v2/resources + describes: + - /api/v2/resources + title: |- + /api/v2/resources + InfluxDB Cloud API Service + tags: + - api-v2 + - resources + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-resources.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-resources.yaml + - path: api-v2-scripts + fields: + name: /api/v2/scripts + describes: + - /api/v2/scripts + - /api/v2/scripts/{scriptID} + - /api/v2/scripts/{scriptID}/invoke + - /api/v2/scripts/{scriptID}/params + title: |- + /api/v2/scripts + InfluxDB Cloud API Service + tags: + - api-v2 + - scripts + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-scripts.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-scripts.yaml + - path: api-v2-setup + fields: + name: /api/v2/setup + describes: + - /api/v2/setup + - /api/v2/setup/user + title: |- + /api/v2/setup + InfluxDB Cloud API Service + tags: + - api-v2 + - setup + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-setup.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-setup.yaml + - path: api-v2-signin + fields: + name: /api/v2/signin + describes: + - /api/v2/signin + title: |- + /api/v2/signin + InfluxDB Cloud API Service + tags: + - api-v2 + - signin + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-signin.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-signin.yaml + - path: api-v2-signout + fields: + name: /api/v2/signout + describes: + - /api/v2/signout + title: |- + /api/v2/signout + InfluxDB Cloud API Service + tags: + - api-v2 + - signout + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-signout.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-signout.yaml + - path: api-v2-stacks + fields: + name: /api/v2/stacks + describes: + - /api/v2/stacks + - /api/v2/stacks/{stack_id} + - /api/v2/stacks/{stack_id}/uninstall + title: |- + /api/v2/stacks + InfluxDB Cloud API Service + tags: + - api-v2 + - stacks + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-stacks.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-stacks.yaml + - path: api-v2-tasks + fields: + name: /api/v2/tasks + describes: + - /api/v2/tasks + - /api/v2/tasks/{taskID} + - /api/v2/tasks/{taskID}/labels + - /api/v2/tasks/{taskID}/labels/{labelID} + - /api/v2/tasks/{taskID}/logs + - /api/v2/tasks/{taskID}/members + - /api/v2/tasks/{taskID}/members/{userID} + - /api/v2/tasks/{taskID}/owners + - /api/v2/tasks/{taskID}/owners/{userID} + - /api/v2/tasks/{taskID}/runs + - /api/v2/tasks/{taskID}/runs/{runID} + - /api/v2/tasks/{taskID}/runs/{runID}/logs + - /api/v2/tasks/{taskID}/runs/{runID}/retry + title: |- + /api/v2/tasks + InfluxDB Cloud API Service + tags: + - api-v2 + - tasks + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-tasks.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-tasks.yaml + - path: api-v2-telegraf + fields: + name: /api/v2/telegraf + describes: + - /api/v2/telegraf/plugins + title: |- + /api/v2/telegraf + InfluxDB Cloud API Service + tags: + - api-v2 + - telegraf + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-telegraf.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-telegraf.yaml + - path: api-v2-telegrafs + fields: + name: /api/v2/telegrafs + describes: + - /api/v2/telegrafs + - /api/v2/telegrafs/{telegrafID} + - /api/v2/telegrafs/{telegrafID}/labels + - /api/v2/telegrafs/{telegrafID}/labels/{labelID} + - /api/v2/telegrafs/{telegrafID}/members + - /api/v2/telegrafs/{telegrafID}/members/{userID} + - /api/v2/telegrafs/{telegrafID}/owners + - /api/v2/telegrafs/{telegrafID}/owners/{userID} + title: |- + /api/v2/telegrafs + InfluxDB Cloud API Service + tags: + - api-v2 + - telegrafs + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-telegrafs.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-telegrafs.yaml + - path: api-v2-templates + fields: + name: /api/v2/templates + describes: + - /api/v2/templates/apply + - /api/v2/templates/export + title: |- + /api/v2/templates + InfluxDB Cloud API Service + tags: + - api-v2 + - templates + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-templates.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-templates.yaml + - path: api-v2-users + fields: + name: /api/v2/users + describes: + - /api/v2/users + - /api/v2/users/{userID} + - /api/v2/users/{userID}/password + title: |- + /api/v2/users + InfluxDB Cloud API Service + tags: + - api-v2 + - users + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-users.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-users.yaml + - path: api-v2-variables + fields: + name: /api/v2/variables + describes: + - /api/v2/variables + - /api/v2/variables/{variableID} + - /api/v2/variables/{variableID}/labels + - /api/v2/variables/{variableID}/labels/{labelID} + title: |- + /api/v2/variables + InfluxDB Cloud API Service + tags: + - api-v2 + - variables + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-variables.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-variables.yaml + - path: api-v2-write + fields: + name: /api/v2/write + describes: + - /api/v2/write + title: |- + /api/v2/write + InfluxDB Cloud API Service + tags: + - api-v2 + - write + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-write.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-write.yaml + - path: api-v2 + fields: + name: /api/v2 + describes: + - /api/v2 + title: |- + /api/v2 + InfluxDB Cloud API Service + tags: + - api + - v2 + source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2.yaml + - path: legacy-authorizations + fields: + name: /legacy/authorizations + describes: + - /legacy/authorizations + - /legacy/authorizations/{authID} + - /legacy/authorizations/{authID}/password + title: |- + /legacy/authorizations + InfluxDB Cloud API Service + tags: + - legacy + - authorizations + source: static/openapi/influxdb-cloud-v2/paths/ref-legacy-authorizations.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-legacy-authorizations.yaml + - path: ping + fields: + name: /ping + describes: + - /ping + title: |- + /ping + InfluxDB Cloud API Service + tags: + - '' + - ping + source: static/openapi/influxdb-cloud-v2/paths/ref-ping.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-ping.yaml + - path: query + fields: + name: /query + describes: + - /query + title: |- + /query + InfluxDB Cloud API Service + tags: + - '' + - query + source: static/openapi/influxdb-cloud-v2/paths/ref-query.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-query.yaml + - path: write + fields: + name: /write + describes: + - /write + title: |- + /write + InfluxDB Cloud API Service + tags: + - '' + - write + source: static/openapi/influxdb-cloud-v2/paths/ref-write.yaml + staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-write.yaml diff --git a/data/article-data/influxdb/oss-v2/articles.yml b/data/article-data/influxdb/oss-v2/articles.yml new file mode 100644 index 0000000000..caac683787 --- /dev/null +++ b/data/article-data/influxdb/oss-v2/articles.yml @@ -0,0 +1,757 @@ +articles: + - path: api-v2-authorizations + fields: + name: /api/v2/authorizations + describes: + - /api/v2/authorizations + - /api/v2/authorizations/{authID} + title: |- + /api/v2/authorizations + InfluxDB OSS API Service + tags: + - api-v2 + - authorizations + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-authorizations.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-authorizations.yaml + - path: api-v2-backup + fields: + name: /api/v2/backup + describes: + - /api/v2/backup/kv + - /api/v2/backup/metadata + - /api/v2/backup/shards/{shardID} + title: |- + /api/v2/backup + InfluxDB OSS API Service + tags: + - api-v2 + - backup + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-backup.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-backup.yaml + - path: api-v2-buckets + fields: + name: /api/v2/buckets + describes: + - /api/v2/buckets + - /api/v2/buckets/{bucketID} + - /api/v2/buckets/{bucketID}/labels + - /api/v2/buckets/{bucketID}/labels/{labelID} + - /api/v2/buckets/{bucketID}/members + - /api/v2/buckets/{bucketID}/members/{userID} + - /api/v2/buckets/{bucketID}/owners + - /api/v2/buckets/{bucketID}/owners/{userID} + title: |- + /api/v2/buckets + InfluxDB OSS API Service + tags: + - api-v2 + - buckets + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-buckets.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-buckets.yaml + - path: api-v2-checks + fields: + name: /api/v2/checks + describes: + - /api/v2/checks + - /api/v2/checks/{checkID} + - /api/v2/checks/{checkID}/labels + - /api/v2/checks/{checkID}/labels/{labelID} + - /api/v2/checks/{checkID}/query + title: |- + /api/v2/checks + InfluxDB OSS API Service + tags: + - api-v2 + - checks + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-checks.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-checks.yaml + - path: api-v2-config + fields: + name: /api/v2/config + describes: + - /api/v2/config + title: |- + /api/v2/config + InfluxDB OSS API Service + tags: + - api-v2 + - config + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-config.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-config.yaml + - path: api-v2-dashboards + fields: + name: /api/v2/dashboards + describes: + - /api/v2/dashboards + - /api/v2/dashboards/{dashboardID} + - /api/v2/dashboards/{dashboardID}/cells + - /api/v2/dashboards/{dashboardID}/cells/{cellID} + - /api/v2/dashboards/{dashboardID}/cells/{cellID}/view + - /api/v2/dashboards/{dashboardID}/labels + - /api/v2/dashboards/{dashboardID}/labels/{labelID} + - /api/v2/dashboards/{dashboardID}/members + - /api/v2/dashboards/{dashboardID}/members/{userID} + - /api/v2/dashboards/{dashboardID}/owners + - /api/v2/dashboards/{dashboardID}/owners/{userID} + title: |- + /api/v2/dashboards + InfluxDB OSS API Service + tags: + - api-v2 + - dashboards + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-dashboards.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-dashboards.yaml + - path: api-v2-dbrps + fields: + name: /api/v2/dbrps + describes: + - /api/v2/dbrps + - /api/v2/dbrps/{dbrpID} + title: |- + /api/v2/dbrps + InfluxDB OSS API Service + tags: + - api-v2 + - dbrps + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-dbrps.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-dbrps.yaml + - path: api-v2-delete + fields: + name: /api/v2/delete + describes: + - /api/v2/delete + title: |- + /api/v2/delete + InfluxDB OSS API Service + tags: + - api-v2 + - delete + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-delete.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-delete.yaml + - path: api-v2-flags + fields: + name: /api/v2/flags + describes: + - /api/v2/flags + title: |- + /api/v2/flags + InfluxDB OSS API Service + tags: + - api-v2 + - flags + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-flags.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-flags.yaml + - path: api-v2-labels + fields: + name: /api/v2/labels + describes: + - /api/v2/labels + - /api/v2/labels/{labelID} + title: |- + /api/v2/labels + InfluxDB OSS API Service + tags: + - api-v2 + - labels + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-labels.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-labels.yaml + - path: api-v2-maps + fields: + name: /api/v2/maps + describes: + - /api/v2/maps/mapToken + title: |- + /api/v2/maps + InfluxDB OSS API Service + tags: + - api-v2 + - maps + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-maps.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-maps.yaml + - path: api-v2-me + fields: + name: /api/v2/me + describes: + - /api/v2/me + - /api/v2/me/password + title: |- + /api/v2/me + InfluxDB OSS API Service + tags: + - api-v2 + - me + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-me.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-me.yaml + - path: api-v2-notificationEndpoints + fields: + name: /api/v2/notificationEndpoints + describes: + - /api/v2/notificationEndpoints + - /api/v2/notificationEndpoints/{endpointID} + - /api/v2/notificationEndpoints/{endpointID}/labels + - /api/v2/notificationEndpoints/{endpointID}/labels/{labelID} + title: |- + /api/v2/notificationEndpoints + InfluxDB OSS API Service + tags: + - api-v2 + - notificationEndpoints + source: >- + static/openapi/influxdb-oss-v2/paths/ref-api-v2-notificationEndpoints.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-notificationEndpoints.yaml + - path: api-v2-notificationRules + fields: + name: /api/v2/notificationRules + describes: + - /api/v2/notificationRules + - /api/v2/notificationRules/{ruleID} + - /api/v2/notificationRules/{ruleID}/labels + - /api/v2/notificationRules/{ruleID}/labels/{labelID} + - /api/v2/notificationRules/{ruleID}/query + title: |- + /api/v2/notificationRules + InfluxDB OSS API Service + tags: + - api-v2 + - notificationRules + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-notificationRules.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-notificationRules.yaml + - path: api-v2-orgs + fields: + name: /api/v2/orgs + describes: + - /api/v2/orgs + - /api/v2/orgs/{orgID} + - /api/v2/orgs/{orgID}/members + - /api/v2/orgs/{orgID}/members/{userID} + - /api/v2/orgs/{orgID}/owners + - /api/v2/orgs/{orgID}/owners/{userID} + - /api/v2/orgs/{orgID}/secrets + - /api/v2/orgs/{orgID}/secrets/delete + - /api/v2/orgs/{orgID}/secrets/{secretID} + title: |- + /api/v2/orgs + InfluxDB OSS API Service + tags: + - api-v2 + - orgs + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-orgs.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-orgs.yaml + - path: api-v2-query + fields: + name: /api/v2/query + describes: + - /api/v2/query + - /api/v2/query/analyze + - /api/v2/query/ast + - /api/v2/query/suggestions + - /api/v2/query/suggestions/{name} + title: |- + /api/v2/query + InfluxDB OSS API Service + tags: + - api-v2 + - query + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-query.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-query.yaml + - path: api-v2-remotes + fields: + name: /api/v2/remotes + describes: + - /api/v2/remotes + - /api/v2/remotes/{remoteID} + title: |- + /api/v2/remotes + InfluxDB OSS API Service + tags: + - api-v2 + - remotes + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-remotes.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-remotes.yaml + - path: api-v2-replications + fields: + name: /api/v2/replications + describes: + - /api/v2/replications + - /api/v2/replications/{replicationID} + - /api/v2/replications/{replicationID}/validate + title: |- + /api/v2/replications + InfluxDB OSS API Service + tags: + - api-v2 + - replications + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-replications.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-replications.yaml + - path: api-v2-resources + fields: + name: /api/v2/resources + describes: + - /api/v2/resources + title: |- + /api/v2/resources + InfluxDB OSS API Service + tags: + - api-v2 + - resources + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-resources.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-resources.yaml + - path: api-v2-restore + fields: + name: /api/v2/restore + describes: + - /api/v2/restore/bucket/{bucketID} + - /api/v2/restore/bucketMetadata + - /api/v2/restore/kv + - /api/v2/restore/shards/{shardID} + - /api/v2/restore/sql + title: |- + /api/v2/restore + InfluxDB OSS API Service + tags: + - api-v2 + - restore + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-restore.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-restore.yaml + - path: api-v2-scrapers + fields: + name: /api/v2/scrapers + describes: + - /api/v2/scrapers + - /api/v2/scrapers/{scraperTargetID} + - /api/v2/scrapers/{scraperTargetID}/labels + - /api/v2/scrapers/{scraperTargetID}/labels/{labelID} + - /api/v2/scrapers/{scraperTargetID}/members + - /api/v2/scrapers/{scraperTargetID}/members/{userID} + - /api/v2/scrapers/{scraperTargetID}/owners + - /api/v2/scrapers/{scraperTargetID}/owners/{userID} + title: |- + /api/v2/scrapers + InfluxDB OSS API Service + tags: + - api-v2 + - scrapers + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-scrapers.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-scrapers.yaml + - path: api-v2-setup + fields: + name: /api/v2/setup + describes: + - /api/v2/setup + title: |- + /api/v2/setup + InfluxDB OSS API Service + tags: + - api-v2 + - setup + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-setup.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-setup.yaml + - path: api-v2-signin + fields: + name: /api/v2/signin + describes: + - /api/v2/signin + title: |- + /api/v2/signin + InfluxDB OSS API Service + tags: + - api-v2 + - signin + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-signin.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-signin.yaml + - path: api-v2-signout + fields: + name: /api/v2/signout + describes: + - /api/v2/signout + title: |- + /api/v2/signout + InfluxDB OSS API Service + tags: + - api-v2 + - signout + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-signout.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-signout.yaml + - path: api-v2-sources + fields: + name: /api/v2/sources + describes: + - /api/v2/sources + - /api/v2/sources/{sourceID} + - /api/v2/sources/{sourceID}/buckets + - /api/v2/sources/{sourceID}/health + title: |- + /api/v2/sources + InfluxDB OSS API Service + tags: + - api-v2 + - sources + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-sources.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-sources.yaml + - path: api-v2-stacks + fields: + name: /api/v2/stacks + describes: + - /api/v2/stacks + - /api/v2/stacks/{stack_id} + - /api/v2/stacks/{stack_id}/uninstall + title: |- + /api/v2/stacks + InfluxDB OSS API Service + tags: + - api-v2 + - stacks + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-stacks.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-stacks.yaml + - path: api-v2-tasks + fields: + name: /api/v2/tasks + describes: + - /api/v2/tasks + - /api/v2/tasks/{taskID} + - /api/v2/tasks/{taskID}/labels + - /api/v2/tasks/{taskID}/labels/{labelID} + - /api/v2/tasks/{taskID}/logs + - /api/v2/tasks/{taskID}/members + - /api/v2/tasks/{taskID}/members/{userID} + - /api/v2/tasks/{taskID}/owners + - /api/v2/tasks/{taskID}/owners/{userID} + - /api/v2/tasks/{taskID}/runs + - /api/v2/tasks/{taskID}/runs/{runID} + - /api/v2/tasks/{taskID}/runs/{runID}/logs + - /api/v2/tasks/{taskID}/runs/{runID}/retry + title: |- + /api/v2/tasks + InfluxDB OSS API Service + tags: + - api-v2 + - tasks + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-tasks.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-tasks.yaml + - path: api-v2-telegraf + fields: + name: /api/v2/telegraf + describes: + - /api/v2/telegraf/plugins + title: |- + /api/v2/telegraf + InfluxDB OSS API Service + tags: + - api-v2 + - telegraf + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-telegraf.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-telegraf.yaml + - path: api-v2-telegrafs + fields: + name: /api/v2/telegrafs + describes: + - /api/v2/telegrafs + - /api/v2/telegrafs/{telegrafID} + - /api/v2/telegrafs/{telegrafID}/labels + - /api/v2/telegrafs/{telegrafID}/labels/{labelID} + - /api/v2/telegrafs/{telegrafID}/members + - /api/v2/telegrafs/{telegrafID}/members/{userID} + - /api/v2/telegrafs/{telegrafID}/owners + - /api/v2/telegrafs/{telegrafID}/owners/{userID} + title: |- + /api/v2/telegrafs + InfluxDB OSS API Service + tags: + - api-v2 + - telegrafs + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-telegrafs.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-telegrafs.yaml + - path: api-v2-templates + fields: + name: /api/v2/templates + describes: + - /api/v2/templates/apply + - /api/v2/templates/export + title: |- + /api/v2/templates + InfluxDB OSS API Service + tags: + - api-v2 + - templates + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-templates.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-templates.yaml + - path: api-v2-users + fields: + name: /api/v2/users + describes: + - /api/v2/users + - /api/v2/users/{userID} + - /api/v2/users/{userID}/password + title: |- + /api/v2/users + InfluxDB OSS API Service + tags: + - api-v2 + - users + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-users.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-users.yaml + - path: api-v2-variables + fields: + name: /api/v2/variables + describes: + - /api/v2/variables + - /api/v2/variables/{variableID} + - /api/v2/variables/{variableID}/labels + - /api/v2/variables/{variableID}/labels/{labelID} + title: |- + /api/v2/variables + InfluxDB OSS API Service + tags: + - api-v2 + - variables + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-variables.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-variables.yaml + - path: api-v2-write + fields: + name: /api/v2/write + describes: + - /api/v2/write + title: |- + /api/v2/write + InfluxDB OSS API Service + tags: + - api-v2 + - write + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-write.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-write.yaml + - path: api-v2 + fields: + name: /api/v2 + describes: + - /api/v2 + title: |- + /api/v2 + InfluxDB OSS API Service + tags: + - api + - v2 + source: static/openapi/influxdb-oss-v2/paths/ref-api-v2.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2.yaml + - path: debug-pprof-all + fields: + name: /debug/pprof/all + describes: + - /debug/pprof/all + title: |- + /debug/pprof/all + InfluxDB OSS API Service + tags: + - debug-pprof + - all + source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-all.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-all.yaml + - path: debug-pprof-allocs + fields: + name: /debug/pprof/allocs + describes: + - /debug/pprof/allocs + title: |- + /debug/pprof/allocs + InfluxDB OSS API Service + tags: + - debug-pprof + - allocs + source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-allocs.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-allocs.yaml + - path: debug-pprof-block + fields: + name: /debug/pprof/block + describes: + - /debug/pprof/block + title: |- + /debug/pprof/block + InfluxDB OSS API Service + tags: + - debug-pprof + - block + source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-block.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-block.yaml + - path: debug-pprof-cmdline + fields: + name: /debug/pprof/cmdline + describes: + - /debug/pprof/cmdline + title: |- + /debug/pprof/cmdline + InfluxDB OSS API Service + tags: + - debug-pprof + - cmdline + source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-cmdline.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-cmdline.yaml + - path: debug-pprof-goroutine + fields: + name: /debug/pprof/goroutine + describes: + - /debug/pprof/goroutine + title: |- + /debug/pprof/goroutine + InfluxDB OSS API Service + tags: + - debug-pprof + - goroutine + source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-goroutine.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-goroutine.yaml + - path: debug-pprof-heap + fields: + name: /debug/pprof/heap + describes: + - /debug/pprof/heap + title: |- + /debug/pprof/heap + InfluxDB OSS API Service + tags: + - debug-pprof + - heap + source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-heap.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-heap.yaml + - path: debug-pprof-mutex + fields: + name: /debug/pprof/mutex + describes: + - /debug/pprof/mutex + title: |- + /debug/pprof/mutex + InfluxDB OSS API Service + tags: + - debug-pprof + - mutex + source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-mutex.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-mutex.yaml + - path: debug-pprof-profile + fields: + name: /debug/pprof/profile + describes: + - /debug/pprof/profile + title: |- + /debug/pprof/profile + InfluxDB OSS API Service + tags: + - debug-pprof + - profile + source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-profile.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-profile.yaml + - path: debug-pprof-threadcreate + fields: + name: /debug/pprof/threadcreate + describes: + - /debug/pprof/threadcreate + title: |- + /debug/pprof/threadcreate + InfluxDB OSS API Service + tags: + - debug-pprof + - threadcreate + source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-threadcreate.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-threadcreate.yaml + - path: debug-pprof-trace + fields: + name: /debug/pprof/trace + describes: + - /debug/pprof/trace + title: |- + /debug/pprof/trace + InfluxDB OSS API Service + tags: + - debug-pprof + - trace + source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-trace.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-trace.yaml + - path: health + fields: + name: /health + describes: + - /health + title: |- + /health + InfluxDB OSS API Service + tags: + - '' + - health + source: static/openapi/influxdb-oss-v2/paths/ref-health.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-health.yaml + - path: legacy-authorizations + fields: + name: /legacy/authorizations + describes: + - /legacy/authorizations + - /legacy/authorizations/{authID} + - /legacy/authorizations/{authID}/password + title: |- + /legacy/authorizations + InfluxDB OSS API Service + tags: + - legacy + - authorizations + source: static/openapi/influxdb-oss-v2/paths/ref-legacy-authorizations.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-legacy-authorizations.yaml + - path: metrics + fields: + name: /metrics + describes: + - /metrics + title: |- + /metrics + InfluxDB OSS API Service + tags: + - '' + - metrics + source: static/openapi/influxdb-oss-v2/paths/ref-metrics.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-metrics.yaml + - path: ping + fields: + name: /ping + describes: + - /ping + title: |- + /ping + InfluxDB OSS API Service + tags: + - '' + - ping + source: static/openapi/influxdb-oss-v2/paths/ref-ping.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-ping.yaml + - path: query + fields: + name: /query + describes: + - /query + title: |- + /query + InfluxDB OSS API Service + tags: + - '' + - query + source: static/openapi/influxdb-oss-v2/paths/ref-query.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-query.yaml + - path: ready + fields: + name: /ready + describes: + - /ready + title: |- + /ready + InfluxDB OSS API Service + tags: + - '' + - ready + source: static/openapi/influxdb-oss-v2/paths/ref-ready.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-ready.yaml + - path: write + fields: + name: /write + describes: + - /write + title: |- + /write + InfluxDB OSS API Service + tags: + - '' + - write + source: static/openapi/influxdb-oss-v2/paths/ref-write.yaml + staticFilePath: /openapi/influxdb-oss-v2/paths/ref-write.yaml diff --git a/hugo-data-to-pages/.gitignore b/hugo-data-to-pages/.gitignore new file mode 100644 index 0000000000..547bc1cbdf --- /dev/null +++ b/hugo-data-to-pages/.gitignore @@ -0,0 +1,7 @@ + +# Hugo default output directory +/example/public +# Hugo generated resources directory +/example/resources + +node_modules/* diff --git a/hugo-data-to-pages/LICENSE.md b/hugo-data-to-pages/LICENSE.md new file mode 100644 index 0000000000..926b4caa5a --- /dev/null +++ b/hugo-data-to-pages/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Asaf Zamir + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/hugo-data-to-pages/README.md b/hugo-data-to-pages/README.md new file mode 100644 index 0000000000..c118a93348 --- /dev/null +++ b/hugo-data-to-pages/README.md @@ -0,0 +1,46 @@ +# Hugo Data to Pages + +Allows for generating pages (or any archetypes) from data (json/yaml) on [Hugo](https://github.com/gohugoio/hugo). +Related to issues [#140](https://github.com/gohugoio/hugo/issues/140) and [5074](https://github.com/gohugoio/hugo/issues/5074). + +## Getting Started + +This script is a simple wrapper that: +- Generates the pages under your content folder +- Runs Hugo +- And finally, removes the generated pages + +The entire script is in `hugo.js`, the `example/` is just an example hugo site. + +### Prerequisites + +- hugo +- node & npm + +### Installing & Running + +- Run `npm install` to install dependencies +- Run `node hugo.js` to build +- (optional) Run `chmod +x hugo.js` to allow for direct execution, i.e. `./hugo.js` +- Go to `localhost:1313` to see links to the generated pages + +#### Commands + +There are 3 available commands: + +- `./hugo.js` (basically hugo build to public directory) +- `./hugo.js generate` (only generate folders/files from data, same as above but without executing hugo build) +- `./hugo.js server` (basically hugo server, with cleanup on exit) +- `./hugo.js clean` (trigger cleanup in case the script didn't remove the generated folders) + +Flags: +- `-c FILE.json` or `--configFile FILE.json` flag to override default config (check hugoConfig-example.json) +- `-f` or `--force` flag to skip folder removal prompts (be careful with this one!) + +## Author + +[kidsil](https://github.com/kidsil) + +## License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details \ No newline at end of file diff --git a/hugo-data-to-pages/hugo.js b/hugo-data-to-pages/hugo.js new file mode 100755 index 0000000000..10fc52fc78 --- /dev/null +++ b/hugo-data-to-pages/hugo.js @@ -0,0 +1,125 @@ +#!/usr/bin/env node +'use strict'; + +let config = { + root: '', //Root hugo folder, can be empty + dataFolder: process.env.HUGO_DATAPAGES_DATA_PATH, //Data folder path (will fetch ALL files from here) + type: process.env.HUGO_DATAPAGES_TYPE, //Type name [basically layout] (save it under "layouts/NAME/single.html" or themes/THEME/layouts/NAME/single.html). Can be overridden on individual pages by defining "type" under "fields" + pages: process.env.HUGO_DATAPAGES_ELEMENT, //Pages element in your data, in case it's "posts" or "articles" etc. + contentPath: process.env.HUGO_DATAPAGES_CONTENT_PATH, //Path to content directory (in case it's not "content") + hugoPath: '../node_modules/.bin/hugo-extended' //Path to hugo binary (if global, e.g. /snap/bin/hugo) +} + +const fs = require('fs'); +const fse = require('fs-extra'); +const prompts = require('prompts'); + +const converToObject = (file) => { + const jsyml = require('js-yaml'); + const jstml = require('toml'); + const filetype = file.split('.').pop(); + const fileContent = fs.readFileSync(config.root + config.dataFolder + '/' + file, 'utf8'); + if (filetype === 'json') return JSON.parse(fileContent); + if (filetype === 'yml' || filetype === 'yaml') return jsyml.safeLoad(fileContent); + if (filetype === 'toml') return jstml.parse(fileContent); +}; +const build = async (add, force) => { + if (typeof add === 'undefined') add = true; + if (typeof force === 'undefined') force = false; + if (!config.contentPath || config.contentPath === '/') return console.log('Error: config.contentPath cannot be \'\' or \'/\')!'); + let dataFiles; + try { + dataFiles = fs.readdirSync(config.root + config.dataFolder); + } catch (e) { + return console.log('e', e); + } + if (dataFiles.length < 1) return console.log('No data files'); + for (let i in dataFiles) { + let data = converToObject(dataFiles[i]); + let pages = config.pages ? data[config.pages] : data; + for (let j in pages) { + if (!pages[j].path) return console.log('Error: Pages must include path!'); + if (!pages[j].fields) return console.log('Error: Pages must include fields!'); + if (!pages[j].fields.type) pages[j].fields.type = config.type; + + const pagePath = config.root + config.contentPath + '/' + pages[j].path; + if (add) { + fse.ensureDirSync(pagePath); + fs.writeFileSync(pagePath + '/index.md', JSON.stringify(pages[j].fields) + '\n'); + console.log('Created file: ' + pagePath + '/index.md'); + } else if (fs.existsSync(pagePath)) { + let response; + if (!force) { + response = await prompts({ + type: 'confirm', + name: 'value', + message: 'Delete ' + pagePath + ' ?' + }); + } + + if (force || response.value) { + fse.removeSync(pagePath); + console.log('Removed folder: ' + pagePath); + } + } + } + } + +}; +const main = async (argvs) => { + const mode = typeof argvs._[0] === 'undefined' ? 'default' : argvs._[0]; + const force = typeof argvs['force'] === 'undefined' ? false : true; + const configFile = typeof argvs['configFile'] === 'undefined' ? false : require('./' + argvs['configFile']); + Object.assign(config, configFile); //overriding default settings + config.root = (!!config.root ? config.root : '.') + '/'; + const { execSync } = require('child_process'); + if (mode === 'server') { + //server mode - create data-generated files, run hugo server, remove data-generated files on stop + console.log('Building data-generated files...'); + await build(); + console.log('Running Hugo Server...'); + process.on('SIGINT', () => {}); //Not exiting on ctrl+c (instead, going to "catch" clause) + try { + await execSync('(cd ' + config.root + ' && ' + config.hugoPath + ' server)'); + } catch (e) { + console.log('Removing data-generated files...'); + await build(false, force); + } + } else if (mode === 'generate') { + //generate - just create data-generated files (no hugo running, and no removal) + console.log('Building data-generated files...'); + await build(); + } else if (mode === 'clean') { + //clean - just remove data-generated files + console.log('Removing data-generated files...'); + await build(false, force); + } else { + //default behavior - create data-generated files, run hugo build, remove data-generated files + console.log('Building data-generated files...'); + await build(); + console.log('Running Hugo (build)...'); + await execSync('(cd ' + config.root + ' && ' + config.hugoPath + ')'); + console.log('Removing data-generated files...'); + await build(false, force); + } + + console.log('Done!'); +}; + +// Defining commands and flags +const argvs = require('yargs') + .command('$0', 'Generate folders/files from data, then run `hugo build`') + .command('generate', 'Generate folders/files from data (does not run hugo build)') + .command('server', 'Generate folders/files from data, run `hugo server`, then cleanup on exit') + .command('clean', 'Trigger cleanup manually') + .option('force', { + alias: 'f', + description: 'Use this flag to skip folder removal prompts (be careful with this one!)' + }) + .option('configFile', { + alias: 'c', + description: 'Optionally use an external config file (JSON format only)' + }) + .argv; + +main(argvs); \ No newline at end of file diff --git a/hugo-data-to-pages/package.json b/hugo-data-to-pages/package.json new file mode 100644 index 0000000000..8fad156146 --- /dev/null +++ b/hugo-data-to-pages/package.json @@ -0,0 +1,22 @@ +{ + "name": "hugo-data-to-pages", + "version": "1.0.0", + "description": "", + "main": "hugo.js", + "directories": { + "example": "example" + }, + "dependencies": { + "fs-extra": "^8.1.0", + "js-yaml": "^3.14.1", + "prompts": "^2.4.1", + "toml": "^3.0.0", + "yargs": "^13.3.2" + }, + "devDependencies": {}, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC" +} diff --git a/layouts/_default/api.html b/layouts/_default/api.html index 68a09ae661..6c07e82099 100644 --- a/layouts/_default/api.html +++ b/layouts/_default/api.html @@ -1 +1,40 @@ -{{ .Content }} + + +{{ partial "header.html" . }} +{{ partial "topnav.html" . }} + +
+ {{ partial "sidebar.html" . }} +
+ + +

{{ .Params.title }}

+ + + +
+ +
+
+ +{{ partial "footer.html" . }} \ No newline at end of file diff --git a/layouts/_default/old-api.html b/layouts/_default/old-api.html new file mode 100644 index 0000000000..68a09ae661 --- /dev/null +++ b/layouts/_default/old-api.html @@ -0,0 +1 @@ +{{ .Content }} diff --git a/layouts/api/single.html b/layouts/api/single.html new file mode 100644 index 0000000000..36d78fbec6 --- /dev/null +++ b/layouts/api/single.html @@ -0,0 +1,39 @@ + + +{{ partial "header.html" . }} +{{ partial "topnav.html" . }} + +
+ {{ partial "sidebar.html" . }} +
+ + +

{{ .Params.title }}

+ + + +
+ +
+
+ +{{ partial "footer.html" . }} \ No newline at end of file From fe603d6c56fac35686826556d25c65a7aa8c3ec4 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Tue, 10 Sep 2024 11:36:24 -0500 Subject: [PATCH 02/14] fix(api): Use forked hugo-data-to-pages. Add async. - Replaces hugo-data-to-pages with forked repo that accepts a config object and uses a more recent version of js-yaml. - Uses async to wait for scripts to complete. --- api-docs/package.json | 11 - api-docs/scripts/generate-openapi-articles.js | 27 +-- api-docs/yarn.lock | 15 -- hugo-data-to-pages/.gitignore | 7 - hugo-data-to-pages/LICENSE.md | 21 -- hugo-data-to-pages/README.md | 46 ---- hugo-data-to-pages/hugo.js | 125 ----------- hugo-data-to-pages/package.json | 22 -- package.json | 1 + yarn.lock | 199 +++++++++++++++++- 10 files changed, 212 insertions(+), 262 deletions(-) delete mode 100755 api-docs/package.json delete mode 100644 api-docs/yarn.lock delete mode 100644 hugo-data-to-pages/.gitignore delete mode 100644 hugo-data-to-pages/LICENSE.md delete mode 100644 hugo-data-to-pages/README.md delete mode 100755 hugo-data-to-pages/hugo.js delete mode 100644 hugo-data-to-pages/package.json diff --git a/api-docs/package.json b/api-docs/package.json deleted file mode 100755 index 7c69bc2e08..0000000000 --- a/api-docs/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "private": true, - "name": "api-docs", - "version": "1.0.0", - "description": "InfluxDB API documentation", - "license": "MIT", - "dependencies": { - "js-yaml": "^4.1.0", - "hugo-data-to-pages": "file:../hugo-data-to-pages/hugo.js" - } -} diff --git a/api-docs/scripts/generate-openapi-articles.js b/api-docs/scripts/generate-openapi-articles.js index 3e151e972f..664a0c8806 100644 --- a/api-docs/scripts/generate-openapi-articles.js +++ b/api-docs/scripts/generate-openapi-articles.js @@ -18,8 +18,6 @@ const execCommand = (command) => { } }; - - // Function to generate data from OpenAPI function generateDataFromOpenAPI(specFile, dataOutPath, articleOutPath) { if (!fs.existsSync(dataOutPath)) { @@ -36,20 +34,23 @@ function generateDataFromOpenAPI(specFile, dataOutPath, articleOutPath) { // Example usage of generateDataFromOpenAPI function // generateDataFromOpenAPI('path/to/openapi-file.yml', 'path/to/paths-output-folder', 'path/to/metadata-output-folder'); -function generatePagesFromArticleData(articlesPath, contentPath) { +const generatePagesFromArticleData = async (articlesPath, contentPath) => { + let config = { + root: '.', //Root hugo folder, can be empty + dataFolder: articlesPath, //Data folder path (will fetch ALL files from here) + type: "api", //Type name [basically layout] (save it under "layouts/NAME/single.html" or themes/THEME/layouts/NAME/single.html). Can be overridden on individual pages by defining "type" under "fields" + pages: "articles", //Pages element in your data, in case it's "posts" or "articles" etc. + contentPath: contentPath, //Path to content directory (in case it's not "content") + hugoPath: `${DOCS_ROOT}/node_modules/.bin/hugo-extended` //Path to hugo binary (if global, e.g. /snap/bin/hugo) + } + configJson = `'${JSON.stringify(config)}'`; + console.log('Clean...') execCommand( - `HUGO_DATAPAGES_DATA_PATH=${articlesPath} \ - HUGO_DATAPAGES_ELEMENT=articles \ - HUGO_DATAPAGES_TYPE=api \ - HUGO_DATAPAGES_CONTENT_PATH=${contentPath} \ - node ${path.join(DOCS_ROOT, '/hugo-data-to-pages/hugo.js')} clean --force` + `node ./node_modules/hugo-data-to-pages/hugo.js clean --force --config=${configJson}` ) + console.log('Generate...') execCommand( - `HUGO_DATAPAGES_DATA_PATH=${articlesPath} \ - HUGO_DATAPAGES_ELEMENT=articles \ - HUGO_DATAPAGES_TYPE=api \ - HUGO_DATAPAGES_CONTENT_PATH=${contentPath} \ - node ${path.join(DOCS_ROOT, '/hugo-data-to-pages/hugo.js')} generate` + `node ./node_modules/hugo-data-to-pages/hugo.js generate --config=${configJson}` ) } diff --git a/api-docs/yarn.lock b/api-docs/yarn.lock deleted file mode 100644 index e79302e282..0000000000 --- a/api-docs/yarn.lock +++ /dev/null @@ -1,15 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" diff --git a/hugo-data-to-pages/.gitignore b/hugo-data-to-pages/.gitignore deleted file mode 100644 index 547bc1cbdf..0000000000 --- a/hugo-data-to-pages/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ - -# Hugo default output directory -/example/public -# Hugo generated resources directory -/example/resources - -node_modules/* diff --git a/hugo-data-to-pages/LICENSE.md b/hugo-data-to-pages/LICENSE.md deleted file mode 100644 index 926b4caa5a..0000000000 --- a/hugo-data-to-pages/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Asaf Zamir - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/hugo-data-to-pages/README.md b/hugo-data-to-pages/README.md deleted file mode 100644 index c118a93348..0000000000 --- a/hugo-data-to-pages/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Hugo Data to Pages - -Allows for generating pages (or any archetypes) from data (json/yaml) on [Hugo](https://github.com/gohugoio/hugo). -Related to issues [#140](https://github.com/gohugoio/hugo/issues/140) and [5074](https://github.com/gohugoio/hugo/issues/5074). - -## Getting Started - -This script is a simple wrapper that: -- Generates the pages under your content folder -- Runs Hugo -- And finally, removes the generated pages - -The entire script is in `hugo.js`, the `example/` is just an example hugo site. - -### Prerequisites - -- hugo -- node & npm - -### Installing & Running - -- Run `npm install` to install dependencies -- Run `node hugo.js` to build -- (optional) Run `chmod +x hugo.js` to allow for direct execution, i.e. `./hugo.js` -- Go to `localhost:1313` to see links to the generated pages - -#### Commands - -There are 3 available commands: - -- `./hugo.js` (basically hugo build to public directory) -- `./hugo.js generate` (only generate folders/files from data, same as above but without executing hugo build) -- `./hugo.js server` (basically hugo server, with cleanup on exit) -- `./hugo.js clean` (trigger cleanup in case the script didn't remove the generated folders) - -Flags: -- `-c FILE.json` or `--configFile FILE.json` flag to override default config (check hugoConfig-example.json) -- `-f` or `--force` flag to skip folder removal prompts (be careful with this one!) - -## Author - -[kidsil](https://github.com/kidsil) - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details \ No newline at end of file diff --git a/hugo-data-to-pages/hugo.js b/hugo-data-to-pages/hugo.js deleted file mode 100755 index 10fc52fc78..0000000000 --- a/hugo-data-to-pages/hugo.js +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -let config = { - root: '', //Root hugo folder, can be empty - dataFolder: process.env.HUGO_DATAPAGES_DATA_PATH, //Data folder path (will fetch ALL files from here) - type: process.env.HUGO_DATAPAGES_TYPE, //Type name [basically layout] (save it under "layouts/NAME/single.html" or themes/THEME/layouts/NAME/single.html). Can be overridden on individual pages by defining "type" under "fields" - pages: process.env.HUGO_DATAPAGES_ELEMENT, //Pages element in your data, in case it's "posts" or "articles" etc. - contentPath: process.env.HUGO_DATAPAGES_CONTENT_PATH, //Path to content directory (in case it's not "content") - hugoPath: '../node_modules/.bin/hugo-extended' //Path to hugo binary (if global, e.g. /snap/bin/hugo) -} - -const fs = require('fs'); -const fse = require('fs-extra'); -const prompts = require('prompts'); - -const converToObject = (file) => { - const jsyml = require('js-yaml'); - const jstml = require('toml'); - const filetype = file.split('.').pop(); - const fileContent = fs.readFileSync(config.root + config.dataFolder + '/' + file, 'utf8'); - if (filetype === 'json') return JSON.parse(fileContent); - if (filetype === 'yml' || filetype === 'yaml') return jsyml.safeLoad(fileContent); - if (filetype === 'toml') return jstml.parse(fileContent); -}; -const build = async (add, force) => { - if (typeof add === 'undefined') add = true; - if (typeof force === 'undefined') force = false; - if (!config.contentPath || config.contentPath === '/') return console.log('Error: config.contentPath cannot be \'\' or \'/\')!'); - let dataFiles; - try { - dataFiles = fs.readdirSync(config.root + config.dataFolder); - } catch (e) { - return console.log('e', e); - } - if (dataFiles.length < 1) return console.log('No data files'); - for (let i in dataFiles) { - let data = converToObject(dataFiles[i]); - let pages = config.pages ? data[config.pages] : data; - for (let j in pages) { - if (!pages[j].path) return console.log('Error: Pages must include path!'); - if (!pages[j].fields) return console.log('Error: Pages must include fields!'); - if (!pages[j].fields.type) pages[j].fields.type = config.type; - - const pagePath = config.root + config.contentPath + '/' + pages[j].path; - if (add) { - fse.ensureDirSync(pagePath); - fs.writeFileSync(pagePath + '/index.md', JSON.stringify(pages[j].fields) + '\n'); - console.log('Created file: ' + pagePath + '/index.md'); - } else if (fs.existsSync(pagePath)) { - let response; - if (!force) { - response = await prompts({ - type: 'confirm', - name: 'value', - message: 'Delete ' + pagePath + ' ?' - }); - } - - if (force || response.value) { - fse.removeSync(pagePath); - console.log('Removed folder: ' + pagePath); - } - } - } - } - -}; -const main = async (argvs) => { - const mode = typeof argvs._[0] === 'undefined' ? 'default' : argvs._[0]; - const force = typeof argvs['force'] === 'undefined' ? false : true; - const configFile = typeof argvs['configFile'] === 'undefined' ? false : require('./' + argvs['configFile']); - Object.assign(config, configFile); //overriding default settings - config.root = (!!config.root ? config.root : '.') + '/'; - const { execSync } = require('child_process'); - if (mode === 'server') { - //server mode - create data-generated files, run hugo server, remove data-generated files on stop - console.log('Building data-generated files...'); - await build(); - console.log('Running Hugo Server...'); - process.on('SIGINT', () => {}); //Not exiting on ctrl+c (instead, going to "catch" clause) - try { - await execSync('(cd ' + config.root + ' && ' + config.hugoPath + ' server)'); - } catch (e) { - console.log('Removing data-generated files...'); - await build(false, force); - } - } else if (mode === 'generate') { - //generate - just create data-generated files (no hugo running, and no removal) - console.log('Building data-generated files...'); - await build(); - } else if (mode === 'clean') { - //clean - just remove data-generated files - console.log('Removing data-generated files...'); - await build(false, force); - } else { - //default behavior - create data-generated files, run hugo build, remove data-generated files - console.log('Building data-generated files...'); - await build(); - console.log('Running Hugo (build)...'); - await execSync('(cd ' + config.root + ' && ' + config.hugoPath + ')'); - console.log('Removing data-generated files...'); - await build(false, force); - } - - console.log('Done!'); -}; - -// Defining commands and flags -const argvs = require('yargs') - .command('$0', 'Generate folders/files from data, then run `hugo build`') - .command('generate', 'Generate folders/files from data (does not run hugo build)') - .command('server', 'Generate folders/files from data, run `hugo server`, then cleanup on exit') - .command('clean', 'Trigger cleanup manually') - .option('force', { - alias: 'f', - description: 'Use this flag to skip folder removal prompts (be careful with this one!)' - }) - .option('configFile', { - alias: 'c', - description: 'Optionally use an external config file (JSON format only)' - }) - .argv; - -main(argvs); \ No newline at end of file diff --git a/hugo-data-to-pages/package.json b/hugo-data-to-pages/package.json deleted file mode 100644 index 8fad156146..0000000000 --- a/hugo-data-to-pages/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "hugo-data-to-pages", - "version": "1.0.0", - "description": "", - "main": "hugo.js", - "directories": { - "example": "example" - }, - "dependencies": { - "fs-extra": "^8.1.0", - "js-yaml": "^3.14.1", - "prompts": "^2.4.1", - "toml": "^3.0.0", - "yargs": "^13.3.2" - }, - "devDependencies": {}, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC" -} diff --git a/package.json b/package.json index e51fa8ed19..c9778b4768 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ }, "dependencies": { "axios": "^1.7.4", + "hugo-data-to-pages": "https://github.com/jstirnaman/hugo-data-to-pages", "js-yaml": "^4.1.0" }, "scripts": { diff --git a/yarn.lock b/yarn.lock index d69914fd1c..19b54d4e7a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -105,6 +105,11 @@ tar "^6.1.15" unzipper "^0.10.14" +ansi-regex@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.1.tgz#164daac87ab2d6f6db3a29875e2d1766582dabed" + integrity sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g== + ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" @@ -115,7 +120,7 @@ ansi-regex@^6.0.1: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a" integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA== -ansi-styles@^3.2.1: +ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== @@ -305,6 +310,11 @@ cacheable-request@^10.2.8: normalize-url "^8.0.0" responselike "^3.0.0" +camelcase@^5.0.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + caniuse-lite@^1.0.30001646: version "1.0.30001651" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz#52de59529e8b02b1aedcaaf5c05d9e23c0c28138" @@ -363,6 +373,15 @@ chownr@^2.0.0: resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + cliui@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" @@ -441,6 +460,11 @@ debug@^4.3.4: dependencies: ms "2.1.2" +decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== + decompress-response@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" @@ -538,6 +562,11 @@ electron-to-chromium@^1.5.4: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz#1abf0410c5344b2b829b7247e031f02810d442e6" integrity sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q== +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -619,6 +648,13 @@ fill-range@^7.1.1: dependencies: to-regex-range "^5.0.1" +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + find-up@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-6.3.0.tgz#2abab3d3280b2dc7ac10199ef324c4e002c8c790" @@ -673,6 +709,15 @@ fs-extra@^11.0.0, fs-extra@^11.1.1: jsonfile "^6.0.1" universalify "^2.0.0" +fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-minipass@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb" @@ -705,7 +750,7 @@ function-bind@^1.1.2: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== -get-caller-file@^2.0.5: +get-caller-file@^2.0.1, get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== @@ -830,6 +875,15 @@ http2-wrapper@^2.1.10: quick-lru "^5.1.1" resolve-alpn "^1.2.0" +"hugo-data-to-pages@file:../hugo-data-to-pages": + version "1.0.0" + dependencies: + fs-extra "^8.1.0" + js-yaml "^4.1.0" + prompts "^2.4.1" + toml "^3.0.0" + yargs "^13.3.2" + hugo-extended@>=0.101.0: version "0.133.0" resolved "https://registry.yarnpkg.com/hugo-extended/-/hugo-extended-0.133.0.tgz#77ad49e1e394634337b7ce198053e670969fe836" @@ -886,6 +940,11 @@ is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w== + is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -969,6 +1028,13 @@ json-parse-even-better-errors@^2.3.0: 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== +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg== + optionalDependencies: + graceful-fs "^4.1.6" + jsonfile@^6.0.1: version "6.1.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" @@ -990,6 +1056,11 @@ keyv@^4.5.3: dependencies: json-buffer "3.0.1" +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + lilconfig@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.2.tgz#e4a7c3cb549e3a606c8dcc32e5ae1005e62c05cb" @@ -1005,6 +1076,14 @@ listenercount@~1.0.1: resolved "https://registry.yarnpkg.com/listenercount/-/listenercount-1.0.1.tgz#84c8a72ab59c4725321480c975e6508342e70937" integrity sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ== +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + locate-path@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-7.2.0.tgz#69cb1779bd90b35ab1e771e1f2f89a202c2a8a8a" @@ -1214,6 +1293,13 @@ p-cancelable@^3.0.0: resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== +p-limit@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + p-limit@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-4.0.0.tgz#914af6544ed32bfa54670b061cafcbd04984b644" @@ -1221,6 +1307,13 @@ p-limit@^4.0.0: dependencies: yocto-queue "^1.0.0" +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + p-locate@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-6.0.0.tgz#3da9a49d4934b901089dca3302fa65dc5a05c04f" @@ -1228,6 +1321,11 @@ p-locate@^6.0.0: dependencies: p-limit "^4.0.0" +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + package-json-from-dist@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz#e501cd3094b278495eb4258d4c9f6d5ac3019f00" @@ -1243,6 +1341,11 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ== + path-exists@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-5.0.0.tgz#a6aad9489200b21fab31e49cf09277e5116fb9e7" @@ -1381,6 +1484,14 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== +prompts@^2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" + integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== + dependencies: + kleur "^3.0.3" + sisteransi "^1.0.5" + 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" @@ -1460,6 +1571,11 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + resolve-alpn@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" @@ -1525,6 +1641,11 @@ semver@^7.3.4: resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== + setimmediate@~1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" @@ -1547,6 +1668,11 @@ signal-exit@^4.0.1: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== +sisteransi@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" + integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== + slash@^5.0.0, slash@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/slash/-/slash-5.1.0.tgz#be3adddcdf09ac38eebe8dcdc7b1a57a75b095ce" @@ -1601,6 +1727,15 @@ sql-formatter@^15.0.2: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -1633,6 +1768,13 @@ string_decoder@~1.1.1: dependencies: ansi-regex "^5.0.1" +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -1723,6 +1865,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +toml@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee" + integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w== + "traverse@>=0.3.0 <0.4": version "0.3.9" resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9" @@ -1763,6 +1910,11 @@ unique-string@^3.0.0: dependencies: crypto-random-string "^4.0.0" +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + universalify@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" @@ -1805,6 +1957,11 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +which-module@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.1.tgz#776b1fe35d90aebe99e8ac15eb24093389a4a409" + integrity sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ== + which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -1821,6 +1978,15 @@ which@^2.0.1: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" @@ -1849,6 +2015,11 @@ xtend@^4.0.0: resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== +y18n@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" + integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== + y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" @@ -1864,11 +2035,35 @@ yaml@^2.4.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.0.tgz#c6165a721cf8000e91c36490a41d7be25176cf5d" integrity sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw== +yargs-parser@^13.1.2: + version "13.1.2" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" + integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== +yargs@^13.3.2: + version "13.3.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" + integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.2" + yargs@^17.0.0: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" From 83f3cf7b131a7eb4ecd17e0dbe00f9d72260ac18 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Wed, 11 Sep 2024 16:46:06 -0500 Subject: [PATCH 03/14] Add configuration. Store output paths and metadata in /data. Refactors and simplifying module and function names. --- .gitignore | 2 +- api-docs/scripts/generate-openapi-articles.js | 50 +- .../cli.js | 17 +- .../index.js | 15 +- .../package.json | 2 +- .../influxdb/cloud-v2/articles.yml | 499 ------------ .../article-data/influxdb/oss-v2/articles.yml | 757 ------------------ yarn.lock | 3 +- 8 files changed, 49 insertions(+), 1296 deletions(-) rename api-docs/scripts/{openapi-paths-to-hugo-data => openapi-docs}/cli.js (76%) rename api-docs/scripts/{openapi-paths-to-hugo-data => openapi-docs}/index.js (91%) rename api-docs/scripts/{openapi-paths-to-hugo-data => openapi-docs}/package.json (89%) delete mode 100644 data/article-data/influxdb/cloud-v2/articles.yml delete mode 100644 data/article-data/influxdb/oss-v2/articles.yml diff --git a/.gitignore b/.gitignore index aced39f60d..7732be83bb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,8 @@ node_modules .hugo_build.lock /content/influxdb/*/api/**/*.html /api-docs/redoc-static.html* +/data/api* /content/influxdb/*/api/** -/static/openapi .vscode/* .idea **/config.toml diff --git a/api-docs/scripts/generate-openapi-articles.js b/api-docs/scripts/generate-openapi-articles.js index 664a0c8806..49f3b145ed 100644 --- a/api-docs/scripts/generate-openapi-articles.js +++ b/api-docs/scripts/generate-openapi-articles.js @@ -1,7 +1,7 @@ const { execSync } = require('child_process'); const path = require('path'); const fs = require('fs'); -const openapiPathsToHugo = require('./openapi-paths-to-hugo-data/index.js'); +const openapiDocs = require('./openapi-docs/index.js'); // Calculate the relative paths const DOCS_ROOT = '.'; @@ -24,7 +24,7 @@ function generateDataFromOpenAPI(specFile, dataOutPath, articleOutPath) { fs.mkdirSync(dataOutPath, { recursive: true }); } - openapiPathsToHugo.generateHugoData({ + openapiDocs.openapiToData({ dataOutPath, articleOutPath, specFile @@ -54,27 +54,33 @@ const generatePagesFromArticleData = async (articlesPath, contentPath) => { ) } -const api_reference_paths = { - 'cloud-v2': { - spec_file: path.join(API_DOCS_ROOT, '/cloud/v2/ref.yml'), - pages_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2'), - }, - 'oss-v2': { - spec_file: path.join(API_DOCS_ROOT, '/v2/ref.yml'), - pages_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2'), - } +// To output to a public folder where JavaScript can access it, use /static/--for example: /static/openapi/ +const config = { + dataOutPath: path.join(DOCS_ROOT, '/data/api/influxdb'), + metadataOutPath: path.join(DOCS_ROOT, `/data/api-metadata/influxdb`), + apis: [ + { + name: 'cloud-v2', + spec_file: path.join(API_DOCS_ROOT, '/cloud/v2/ref.yml'), + pages_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2'), + }, + { + name: 'oss-v2', + spec_file: path.join(API_DOCS_ROOT, '/v2/ref.yml'), + pages_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2'), + } + ] } -Object.keys(api_reference_paths).forEach((key) => { - const api = api_reference_paths[key]; - const staticPath = path.join(DOCS_ROOT, '/static/openapi'); - const staticSpecPath = path.join(staticPath, `/influxdb-${key}.yml`); - const staticPathsPath = path.join(staticPath, `/influxdb-${key}/paths`); - const articlesPath = path.join(DOCS_ROOT, `/data/article-data/influxdb/${key}`); +config.apis.forEach(api => { // Execute the getswagger.sh script - execCommand(`${path.join(API_DOCS_ROOT, 'getswagger.sh')} ${key} -B`); - // Copy the generated OpenAPI spec to the static folder - fs.copyFileSync(api.spec_file, staticSpecPath); - generateDataFromOpenAPI(api.spec_file, staticPathsPath, articlesPath); - generatePagesFromArticleData(articlesPath, api.pages_dir); + execCommand(`${path.join(API_DOCS_ROOT, 'getswagger.sh')} ${api.name} -B`); + const dataOut = path.join(config.dataOutPath, api.name); + const metadataOut = path.join(config.metadataOutPath, api.name); + if (!fs.existsSync(dataOut)) { + fs.mkdirSync(dataOut, { recursive: true }); + } + fs.copyFileSync(api.spec_file, path.join(dataOut, api.name + '.yml')); + generateDataFromOpenAPI(api.spec_file, dataOut, metadataOut); + generatePagesFromArticleData(metadataOut, api.pages_dir); }); diff --git a/api-docs/scripts/openapi-paths-to-hugo-data/cli.js b/api-docs/scripts/openapi-docs/cli.js similarity index 76% rename from api-docs/scripts/openapi-paths-to-hugo-data/cli.js rename to api-docs/scripts/openapi-docs/cli.js index 983f346a60..6c8f9dae0f 100644 --- a/api-docs/scripts/openapi-paths-to-hugo-data/cli.js +++ b/api-docs/scripts/openapi-docs/cli.js @@ -1,15 +1,14 @@ -const path = require('path'); const argparse = require('argparse'); -const openapiPathsToHugo = require('./index.js'); +const apiDocs = require('./index.js'); const cli = new argparse.ArgumentParser({ - prog: 'openapi-docs', + prog: 'api-docs', add_help: true }); cli.add_argument('--hugo', { - help: 'Generate Hugo data from OpenAPI paths', - dest: 'generateHugoData' + help: 'Generate a data file with objects (e.g. for Hugo data) from OpenAPI paths', + dest: 'generateData' }); cli.add_argument('-d', '--data-output', { @@ -42,12 +41,12 @@ var options = cli.parse_args(); /* Usage examples * - node ./openapi-paths-to-hugo-data/index.js \ + node ./api-docs-data/index.js \ ./data/influxdb/cloud/openapi.yaml \ -d ./data/influxdb/cloud/path-apis \ -o ./data/article-data/influxdb/cloud - node ./openapi-paths-to-hugo-data/index.js \ + node ./api-docs-data/index.js \ ./data/influxdb/oss/openapi.yaml \ -d ./data/influxdb/oss/path-apis \ -o ./data/article-data/influxdb/oss @@ -57,6 +56,6 @@ var options = cli.parse_args(); //////////////////////////////////////////////////////////////////////////////// -if (options.generateHugoData) { - openapiPathsToHugo.generateHugoData(options); +if (options.generateData) { + apiDocs.openapiToData(options); } diff --git a/api-docs/scripts/openapi-paths-to-hugo-data/index.js b/api-docs/scripts/openapi-docs/index.js similarity index 91% rename from api-docs/scripts/openapi-paths-to-hugo-data/index.js rename to api-docs/scripts/openapi-docs/index.js index 5c3407fc8b..af9e9a53ab 100644 --- a/api-docs/scripts/openapi-paths-to-hugo-data/index.js +++ b/api-docs/scripts/openapi-docs/index.js @@ -18,7 +18,7 @@ const openapiUtils = { } } -function writePathOpenapis(openapi, prefix, outPath) { +function openapiPaths(openapi, prefix, outPath) { const pathGroups = {}; Object.keys(openapi.paths).sort() .forEach((p) => { @@ -84,7 +84,7 @@ function createArticleDataForPathGroup(openapi) { return article; } -function writeOpenapiArticleData(sourcePath, targetPath, opts) { +function openapiMetadata(sourcePath, targetPath, opts) { const isFile = filePath => { return fs.lstatSync(filePath).isFile(); }; @@ -117,17 +117,20 @@ function writeOpenapiArticleData(sourcePath, targetPath, opts) { } } -function generateHugoData(options) { +function openapiToData(options) { const filenamePrefix = `${path.parse(options.specFile).name}-`; const sourceFile = readFile(options.specFile, 'utf8'); console.log(`Generating OpenAPI path files in ${options.dataOutPath}....`); - writePathOpenapis(sourceFile, filenamePrefix, options.dataOutPath); + openapiPaths(sourceFile, filenamePrefix, options.dataOutPath); console.log(`Generating OpenAPI article data in ${options.articleOutPath}...`); - writeOpenapiArticleData(options.dataOutPath, options.articleOutPath, {filePattern: filenamePrefix}); + openapiMetadata(options.dataOutPath, options.articleOutPath, {filePattern: filenamePrefix}); } module.exports = { - generateHugoData + openapiToData, + openapiPaths, + openapiMetadata + }; \ No newline at end of file diff --git a/api-docs/scripts/openapi-paths-to-hugo-data/package.json b/api-docs/scripts/openapi-docs/package.json similarity index 89% rename from api-docs/scripts/openapi-paths-to-hugo-data/package.json rename to api-docs/scripts/openapi-docs/package.json index 5c69626487..066fa3f6d2 100644 --- a/api-docs/scripts/openapi-paths-to-hugo-data/package.json +++ b/api-docs/scripts/openapi-docs/package.json @@ -1,5 +1,5 @@ { - "name": "openapi-paths-to-hugo-data", + "name": "api-docs-data", "version": "1.0.0", "description": "A tool to convert OpenAPI v3 paths to Hugo data.", "main": "index.js", diff --git a/data/article-data/influxdb/cloud-v2/articles.yml b/data/article-data/influxdb/cloud-v2/articles.yml deleted file mode 100644 index 9aa1d5a54a..0000000000 --- a/data/article-data/influxdb/cloud-v2/articles.yml +++ /dev/null @@ -1,499 +0,0 @@ -articles: - - path: api-v2-authorizations - fields: - name: /api/v2/authorizations - describes: - - /api/v2/authorizations - - /api/v2/authorizations/{authID} - title: |- - /api/v2/authorizations - InfluxDB Cloud API Service - tags: - - api-v2 - - authorizations - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-authorizations.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-authorizations.yaml - - path: api-v2-buckets - fields: - name: /api/v2/buckets - describes: - - /api/v2/buckets - - /api/v2/buckets/{bucketID} - - /api/v2/buckets/{bucketID}/labels - - /api/v2/buckets/{bucketID}/labels/{labelID} - - /api/v2/buckets/{bucketID}/members - - /api/v2/buckets/{bucketID}/members/{userID} - - /api/v2/buckets/{bucketID}/owners - - /api/v2/buckets/{bucketID}/owners/{userID} - - /api/v2/buckets/{bucketID}/schema/measurements - - /api/v2/buckets/{bucketID}/schema/measurements/{measurementID} - title: |- - /api/v2/buckets - InfluxDB Cloud API Service - tags: - - api-v2 - - buckets - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-buckets.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-buckets.yaml - - path: api-v2-checks - fields: - name: /api/v2/checks - describes: - - /api/v2/checks - - /api/v2/checks/{checkID} - - /api/v2/checks/{checkID}/labels - - /api/v2/checks/{checkID}/labels/{labelID} - - /api/v2/checks/{checkID}/query - title: |- - /api/v2/checks - InfluxDB Cloud API Service - tags: - - api-v2 - - checks - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-checks.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-checks.yaml - - path: api-v2-dashboards - fields: - name: /api/v2/dashboards - describes: - - /api/v2/dashboards - - /api/v2/dashboards/{dashboardID} - - /api/v2/dashboards/{dashboardID}/cells - - /api/v2/dashboards/{dashboardID}/cells/{cellID} - - /api/v2/dashboards/{dashboardID}/cells/{cellID}/view - - /api/v2/dashboards/{dashboardID}/labels - - /api/v2/dashboards/{dashboardID}/labels/{labelID} - - /api/v2/dashboards/{dashboardID}/members - - /api/v2/dashboards/{dashboardID}/members/{userID} - - /api/v2/dashboards/{dashboardID}/owners - - /api/v2/dashboards/{dashboardID}/owners/{userID} - title: |- - /api/v2/dashboards - InfluxDB Cloud API Service - tags: - - api-v2 - - dashboards - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-dashboards.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-dashboards.yaml - - path: api-v2-dbrps - fields: - name: /api/v2/dbrps - describes: - - /api/v2/dbrps - - /api/v2/dbrps/{dbrpID} - title: |- - /api/v2/dbrps - InfluxDB Cloud API Service - tags: - - api-v2 - - dbrps - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-dbrps.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-dbrps.yaml - - path: api-v2-delete - fields: - name: /api/v2/delete - describes: - - /api/v2/delete - title: |- - /api/v2/delete - InfluxDB Cloud API Service - tags: - - api-v2 - - delete - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-delete.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-delete.yaml - - path: api-v2-flags - fields: - name: /api/v2/flags - describes: - - /api/v2/flags - title: |- - /api/v2/flags - InfluxDB Cloud API Service - tags: - - api-v2 - - flags - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-flags.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-flags.yaml - - path: api-v2-labels - fields: - name: /api/v2/labels - describes: - - /api/v2/labels - - /api/v2/labels/{labelID} - title: |- - /api/v2/labels - InfluxDB Cloud API Service - tags: - - api-v2 - - labels - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-labels.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-labels.yaml - - path: api-v2-maps - fields: - name: /api/v2/maps - describes: - - /api/v2/maps/mapToken - title: |- - /api/v2/maps - InfluxDB Cloud API Service - tags: - - api-v2 - - maps - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-maps.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-maps.yaml - - path: api-v2-me - fields: - name: /api/v2/me - describes: - - /api/v2/me - - /api/v2/me/password - title: |- - /api/v2/me - InfluxDB Cloud API Service - tags: - - api-v2 - - me - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-me.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-me.yaml - - path: api-v2-notificationEndpoints - fields: - name: /api/v2/notificationEndpoints - describes: - - /api/v2/notificationEndpoints - - /api/v2/notificationEndpoints/{endpointID} - - /api/v2/notificationEndpoints/{endpointID}/labels - - /api/v2/notificationEndpoints/{endpointID}/labels/{labelID} - title: |- - /api/v2/notificationEndpoints - InfluxDB Cloud API Service - tags: - - api-v2 - - notificationEndpoints - source: >- - static/openapi/influxdb-cloud-v2/paths/ref-api-v2-notificationEndpoints.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-notificationEndpoints.yaml - - path: api-v2-notificationRules - fields: - name: /api/v2/notificationRules - describes: - - /api/v2/notificationRules - - /api/v2/notificationRules/{ruleID} - - /api/v2/notificationRules/{ruleID}/labels - - /api/v2/notificationRules/{ruleID}/labels/{labelID} - - /api/v2/notificationRules/{ruleID}/query - title: |- - /api/v2/notificationRules - InfluxDB Cloud API Service - tags: - - api-v2 - - notificationRules - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-notificationRules.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-notificationRules.yaml - - path: api-v2-orgs - fields: - name: /api/v2/orgs - describes: - - /api/v2/orgs - - /api/v2/orgs/{orgID} - - /api/v2/orgs/{orgID}/limits - - /api/v2/orgs/{orgID}/members - - /api/v2/orgs/{orgID}/members/{userID} - - /api/v2/orgs/{orgID}/owners - - /api/v2/orgs/{orgID}/owners/{userID} - - /api/v2/orgs/{orgID}/secrets - - /api/v2/orgs/{orgID}/secrets/delete - - /api/v2/orgs/{orgID}/secrets/{secretID} - - /api/v2/orgs/{orgID}/usage - title: |- - /api/v2/orgs - InfluxDB Cloud API Service - tags: - - api-v2 - - orgs - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-orgs.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-orgs.yaml - - path: api-v2-query - fields: - name: /api/v2/query - describes: - - /api/v2/query - - /api/v2/query/analyze - - /api/v2/query/ast - - /api/v2/query/suggestions - - /api/v2/query/suggestions/{name} - title: |- - /api/v2/query - InfluxDB Cloud API Service - tags: - - api-v2 - - query - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-query.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-query.yaml - - path: api-v2-resources - fields: - name: /api/v2/resources - describes: - - /api/v2/resources - title: |- - /api/v2/resources - InfluxDB Cloud API Service - tags: - - api-v2 - - resources - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-resources.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-resources.yaml - - path: api-v2-scripts - fields: - name: /api/v2/scripts - describes: - - /api/v2/scripts - - /api/v2/scripts/{scriptID} - - /api/v2/scripts/{scriptID}/invoke - - /api/v2/scripts/{scriptID}/params - title: |- - /api/v2/scripts - InfluxDB Cloud API Service - tags: - - api-v2 - - scripts - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-scripts.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-scripts.yaml - - path: api-v2-setup - fields: - name: /api/v2/setup - describes: - - /api/v2/setup - - /api/v2/setup/user - title: |- - /api/v2/setup - InfluxDB Cloud API Service - tags: - - api-v2 - - setup - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-setup.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-setup.yaml - - path: api-v2-signin - fields: - name: /api/v2/signin - describes: - - /api/v2/signin - title: |- - /api/v2/signin - InfluxDB Cloud API Service - tags: - - api-v2 - - signin - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-signin.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-signin.yaml - - path: api-v2-signout - fields: - name: /api/v2/signout - describes: - - /api/v2/signout - title: |- - /api/v2/signout - InfluxDB Cloud API Service - tags: - - api-v2 - - signout - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-signout.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-signout.yaml - - path: api-v2-stacks - fields: - name: /api/v2/stacks - describes: - - /api/v2/stacks - - /api/v2/stacks/{stack_id} - - /api/v2/stacks/{stack_id}/uninstall - title: |- - /api/v2/stacks - InfluxDB Cloud API Service - tags: - - api-v2 - - stacks - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-stacks.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-stacks.yaml - - path: api-v2-tasks - fields: - name: /api/v2/tasks - describes: - - /api/v2/tasks - - /api/v2/tasks/{taskID} - - /api/v2/tasks/{taskID}/labels - - /api/v2/tasks/{taskID}/labels/{labelID} - - /api/v2/tasks/{taskID}/logs - - /api/v2/tasks/{taskID}/members - - /api/v2/tasks/{taskID}/members/{userID} - - /api/v2/tasks/{taskID}/owners - - /api/v2/tasks/{taskID}/owners/{userID} - - /api/v2/tasks/{taskID}/runs - - /api/v2/tasks/{taskID}/runs/{runID} - - /api/v2/tasks/{taskID}/runs/{runID}/logs - - /api/v2/tasks/{taskID}/runs/{runID}/retry - title: |- - /api/v2/tasks - InfluxDB Cloud API Service - tags: - - api-v2 - - tasks - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-tasks.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-tasks.yaml - - path: api-v2-telegraf - fields: - name: /api/v2/telegraf - describes: - - /api/v2/telegraf/plugins - title: |- - /api/v2/telegraf - InfluxDB Cloud API Service - tags: - - api-v2 - - telegraf - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-telegraf.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-telegraf.yaml - - path: api-v2-telegrafs - fields: - name: /api/v2/telegrafs - describes: - - /api/v2/telegrafs - - /api/v2/telegrafs/{telegrafID} - - /api/v2/telegrafs/{telegrafID}/labels - - /api/v2/telegrafs/{telegrafID}/labels/{labelID} - - /api/v2/telegrafs/{telegrafID}/members - - /api/v2/telegrafs/{telegrafID}/members/{userID} - - /api/v2/telegrafs/{telegrafID}/owners - - /api/v2/telegrafs/{telegrafID}/owners/{userID} - title: |- - /api/v2/telegrafs - InfluxDB Cloud API Service - tags: - - api-v2 - - telegrafs - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-telegrafs.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-telegrafs.yaml - - path: api-v2-templates - fields: - name: /api/v2/templates - describes: - - /api/v2/templates/apply - - /api/v2/templates/export - title: |- - /api/v2/templates - InfluxDB Cloud API Service - tags: - - api-v2 - - templates - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-templates.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-templates.yaml - - path: api-v2-users - fields: - name: /api/v2/users - describes: - - /api/v2/users - - /api/v2/users/{userID} - - /api/v2/users/{userID}/password - title: |- - /api/v2/users - InfluxDB Cloud API Service - tags: - - api-v2 - - users - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-users.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-users.yaml - - path: api-v2-variables - fields: - name: /api/v2/variables - describes: - - /api/v2/variables - - /api/v2/variables/{variableID} - - /api/v2/variables/{variableID}/labels - - /api/v2/variables/{variableID}/labels/{labelID} - title: |- - /api/v2/variables - InfluxDB Cloud API Service - tags: - - api-v2 - - variables - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-variables.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-variables.yaml - - path: api-v2-write - fields: - name: /api/v2/write - describes: - - /api/v2/write - title: |- - /api/v2/write - InfluxDB Cloud API Service - tags: - - api-v2 - - write - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2-write.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2-write.yaml - - path: api-v2 - fields: - name: /api/v2 - describes: - - /api/v2 - title: |- - /api/v2 - InfluxDB Cloud API Service - tags: - - api - - v2 - source: static/openapi/influxdb-cloud-v2/paths/ref-api-v2.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-api-v2.yaml - - path: legacy-authorizations - fields: - name: /legacy/authorizations - describes: - - /legacy/authorizations - - /legacy/authorizations/{authID} - - /legacy/authorizations/{authID}/password - title: |- - /legacy/authorizations - InfluxDB Cloud API Service - tags: - - legacy - - authorizations - source: static/openapi/influxdb-cloud-v2/paths/ref-legacy-authorizations.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-legacy-authorizations.yaml - - path: ping - fields: - name: /ping - describes: - - /ping - title: |- - /ping - InfluxDB Cloud API Service - tags: - - '' - - ping - source: static/openapi/influxdb-cloud-v2/paths/ref-ping.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-ping.yaml - - path: query - fields: - name: /query - describes: - - /query - title: |- - /query - InfluxDB Cloud API Service - tags: - - '' - - query - source: static/openapi/influxdb-cloud-v2/paths/ref-query.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-query.yaml - - path: write - fields: - name: /write - describes: - - /write - title: |- - /write - InfluxDB Cloud API Service - tags: - - '' - - write - source: static/openapi/influxdb-cloud-v2/paths/ref-write.yaml - staticFilePath: /openapi/influxdb-cloud-v2/paths/ref-write.yaml diff --git a/data/article-data/influxdb/oss-v2/articles.yml b/data/article-data/influxdb/oss-v2/articles.yml deleted file mode 100644 index caac683787..0000000000 --- a/data/article-data/influxdb/oss-v2/articles.yml +++ /dev/null @@ -1,757 +0,0 @@ -articles: - - path: api-v2-authorizations - fields: - name: /api/v2/authorizations - describes: - - /api/v2/authorizations - - /api/v2/authorizations/{authID} - title: |- - /api/v2/authorizations - InfluxDB OSS API Service - tags: - - api-v2 - - authorizations - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-authorizations.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-authorizations.yaml - - path: api-v2-backup - fields: - name: /api/v2/backup - describes: - - /api/v2/backup/kv - - /api/v2/backup/metadata - - /api/v2/backup/shards/{shardID} - title: |- - /api/v2/backup - InfluxDB OSS API Service - tags: - - api-v2 - - backup - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-backup.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-backup.yaml - - path: api-v2-buckets - fields: - name: /api/v2/buckets - describes: - - /api/v2/buckets - - /api/v2/buckets/{bucketID} - - /api/v2/buckets/{bucketID}/labels - - /api/v2/buckets/{bucketID}/labels/{labelID} - - /api/v2/buckets/{bucketID}/members - - /api/v2/buckets/{bucketID}/members/{userID} - - /api/v2/buckets/{bucketID}/owners - - /api/v2/buckets/{bucketID}/owners/{userID} - title: |- - /api/v2/buckets - InfluxDB OSS API Service - tags: - - api-v2 - - buckets - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-buckets.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-buckets.yaml - - path: api-v2-checks - fields: - name: /api/v2/checks - describes: - - /api/v2/checks - - /api/v2/checks/{checkID} - - /api/v2/checks/{checkID}/labels - - /api/v2/checks/{checkID}/labels/{labelID} - - /api/v2/checks/{checkID}/query - title: |- - /api/v2/checks - InfluxDB OSS API Service - tags: - - api-v2 - - checks - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-checks.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-checks.yaml - - path: api-v2-config - fields: - name: /api/v2/config - describes: - - /api/v2/config - title: |- - /api/v2/config - InfluxDB OSS API Service - tags: - - api-v2 - - config - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-config.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-config.yaml - - path: api-v2-dashboards - fields: - name: /api/v2/dashboards - describes: - - /api/v2/dashboards - - /api/v2/dashboards/{dashboardID} - - /api/v2/dashboards/{dashboardID}/cells - - /api/v2/dashboards/{dashboardID}/cells/{cellID} - - /api/v2/dashboards/{dashboardID}/cells/{cellID}/view - - /api/v2/dashboards/{dashboardID}/labels - - /api/v2/dashboards/{dashboardID}/labels/{labelID} - - /api/v2/dashboards/{dashboardID}/members - - /api/v2/dashboards/{dashboardID}/members/{userID} - - /api/v2/dashboards/{dashboardID}/owners - - /api/v2/dashboards/{dashboardID}/owners/{userID} - title: |- - /api/v2/dashboards - InfluxDB OSS API Service - tags: - - api-v2 - - dashboards - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-dashboards.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-dashboards.yaml - - path: api-v2-dbrps - fields: - name: /api/v2/dbrps - describes: - - /api/v2/dbrps - - /api/v2/dbrps/{dbrpID} - title: |- - /api/v2/dbrps - InfluxDB OSS API Service - tags: - - api-v2 - - dbrps - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-dbrps.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-dbrps.yaml - - path: api-v2-delete - fields: - name: /api/v2/delete - describes: - - /api/v2/delete - title: |- - /api/v2/delete - InfluxDB OSS API Service - tags: - - api-v2 - - delete - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-delete.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-delete.yaml - - path: api-v2-flags - fields: - name: /api/v2/flags - describes: - - /api/v2/flags - title: |- - /api/v2/flags - InfluxDB OSS API Service - tags: - - api-v2 - - flags - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-flags.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-flags.yaml - - path: api-v2-labels - fields: - name: /api/v2/labels - describes: - - /api/v2/labels - - /api/v2/labels/{labelID} - title: |- - /api/v2/labels - InfluxDB OSS API Service - tags: - - api-v2 - - labels - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-labels.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-labels.yaml - - path: api-v2-maps - fields: - name: /api/v2/maps - describes: - - /api/v2/maps/mapToken - title: |- - /api/v2/maps - InfluxDB OSS API Service - tags: - - api-v2 - - maps - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-maps.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-maps.yaml - - path: api-v2-me - fields: - name: /api/v2/me - describes: - - /api/v2/me - - /api/v2/me/password - title: |- - /api/v2/me - InfluxDB OSS API Service - tags: - - api-v2 - - me - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-me.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-me.yaml - - path: api-v2-notificationEndpoints - fields: - name: /api/v2/notificationEndpoints - describes: - - /api/v2/notificationEndpoints - - /api/v2/notificationEndpoints/{endpointID} - - /api/v2/notificationEndpoints/{endpointID}/labels - - /api/v2/notificationEndpoints/{endpointID}/labels/{labelID} - title: |- - /api/v2/notificationEndpoints - InfluxDB OSS API Service - tags: - - api-v2 - - notificationEndpoints - source: >- - static/openapi/influxdb-oss-v2/paths/ref-api-v2-notificationEndpoints.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-notificationEndpoints.yaml - - path: api-v2-notificationRules - fields: - name: /api/v2/notificationRules - describes: - - /api/v2/notificationRules - - /api/v2/notificationRules/{ruleID} - - /api/v2/notificationRules/{ruleID}/labels - - /api/v2/notificationRules/{ruleID}/labels/{labelID} - - /api/v2/notificationRules/{ruleID}/query - title: |- - /api/v2/notificationRules - InfluxDB OSS API Service - tags: - - api-v2 - - notificationRules - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-notificationRules.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-notificationRules.yaml - - path: api-v2-orgs - fields: - name: /api/v2/orgs - describes: - - /api/v2/orgs - - /api/v2/orgs/{orgID} - - /api/v2/orgs/{orgID}/members - - /api/v2/orgs/{orgID}/members/{userID} - - /api/v2/orgs/{orgID}/owners - - /api/v2/orgs/{orgID}/owners/{userID} - - /api/v2/orgs/{orgID}/secrets - - /api/v2/orgs/{orgID}/secrets/delete - - /api/v2/orgs/{orgID}/secrets/{secretID} - title: |- - /api/v2/orgs - InfluxDB OSS API Service - tags: - - api-v2 - - orgs - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-orgs.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-orgs.yaml - - path: api-v2-query - fields: - name: /api/v2/query - describes: - - /api/v2/query - - /api/v2/query/analyze - - /api/v2/query/ast - - /api/v2/query/suggestions - - /api/v2/query/suggestions/{name} - title: |- - /api/v2/query - InfluxDB OSS API Service - tags: - - api-v2 - - query - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-query.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-query.yaml - - path: api-v2-remotes - fields: - name: /api/v2/remotes - describes: - - /api/v2/remotes - - /api/v2/remotes/{remoteID} - title: |- - /api/v2/remotes - InfluxDB OSS API Service - tags: - - api-v2 - - remotes - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-remotes.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-remotes.yaml - - path: api-v2-replications - fields: - name: /api/v2/replications - describes: - - /api/v2/replications - - /api/v2/replications/{replicationID} - - /api/v2/replications/{replicationID}/validate - title: |- - /api/v2/replications - InfluxDB OSS API Service - tags: - - api-v2 - - replications - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-replications.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-replications.yaml - - path: api-v2-resources - fields: - name: /api/v2/resources - describes: - - /api/v2/resources - title: |- - /api/v2/resources - InfluxDB OSS API Service - tags: - - api-v2 - - resources - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-resources.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-resources.yaml - - path: api-v2-restore - fields: - name: /api/v2/restore - describes: - - /api/v2/restore/bucket/{bucketID} - - /api/v2/restore/bucketMetadata - - /api/v2/restore/kv - - /api/v2/restore/shards/{shardID} - - /api/v2/restore/sql - title: |- - /api/v2/restore - InfluxDB OSS API Service - tags: - - api-v2 - - restore - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-restore.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-restore.yaml - - path: api-v2-scrapers - fields: - name: /api/v2/scrapers - describes: - - /api/v2/scrapers - - /api/v2/scrapers/{scraperTargetID} - - /api/v2/scrapers/{scraperTargetID}/labels - - /api/v2/scrapers/{scraperTargetID}/labels/{labelID} - - /api/v2/scrapers/{scraperTargetID}/members - - /api/v2/scrapers/{scraperTargetID}/members/{userID} - - /api/v2/scrapers/{scraperTargetID}/owners - - /api/v2/scrapers/{scraperTargetID}/owners/{userID} - title: |- - /api/v2/scrapers - InfluxDB OSS API Service - tags: - - api-v2 - - scrapers - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-scrapers.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-scrapers.yaml - - path: api-v2-setup - fields: - name: /api/v2/setup - describes: - - /api/v2/setup - title: |- - /api/v2/setup - InfluxDB OSS API Service - tags: - - api-v2 - - setup - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-setup.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-setup.yaml - - path: api-v2-signin - fields: - name: /api/v2/signin - describes: - - /api/v2/signin - title: |- - /api/v2/signin - InfluxDB OSS API Service - tags: - - api-v2 - - signin - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-signin.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-signin.yaml - - path: api-v2-signout - fields: - name: /api/v2/signout - describes: - - /api/v2/signout - title: |- - /api/v2/signout - InfluxDB OSS API Service - tags: - - api-v2 - - signout - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-signout.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-signout.yaml - - path: api-v2-sources - fields: - name: /api/v2/sources - describes: - - /api/v2/sources - - /api/v2/sources/{sourceID} - - /api/v2/sources/{sourceID}/buckets - - /api/v2/sources/{sourceID}/health - title: |- - /api/v2/sources - InfluxDB OSS API Service - tags: - - api-v2 - - sources - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-sources.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-sources.yaml - - path: api-v2-stacks - fields: - name: /api/v2/stacks - describes: - - /api/v2/stacks - - /api/v2/stacks/{stack_id} - - /api/v2/stacks/{stack_id}/uninstall - title: |- - /api/v2/stacks - InfluxDB OSS API Service - tags: - - api-v2 - - stacks - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-stacks.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-stacks.yaml - - path: api-v2-tasks - fields: - name: /api/v2/tasks - describes: - - /api/v2/tasks - - /api/v2/tasks/{taskID} - - /api/v2/tasks/{taskID}/labels - - /api/v2/tasks/{taskID}/labels/{labelID} - - /api/v2/tasks/{taskID}/logs - - /api/v2/tasks/{taskID}/members - - /api/v2/tasks/{taskID}/members/{userID} - - /api/v2/tasks/{taskID}/owners - - /api/v2/tasks/{taskID}/owners/{userID} - - /api/v2/tasks/{taskID}/runs - - /api/v2/tasks/{taskID}/runs/{runID} - - /api/v2/tasks/{taskID}/runs/{runID}/logs - - /api/v2/tasks/{taskID}/runs/{runID}/retry - title: |- - /api/v2/tasks - InfluxDB OSS API Service - tags: - - api-v2 - - tasks - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-tasks.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-tasks.yaml - - path: api-v2-telegraf - fields: - name: /api/v2/telegraf - describes: - - /api/v2/telegraf/plugins - title: |- - /api/v2/telegraf - InfluxDB OSS API Service - tags: - - api-v2 - - telegraf - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-telegraf.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-telegraf.yaml - - path: api-v2-telegrafs - fields: - name: /api/v2/telegrafs - describes: - - /api/v2/telegrafs - - /api/v2/telegrafs/{telegrafID} - - /api/v2/telegrafs/{telegrafID}/labels - - /api/v2/telegrafs/{telegrafID}/labels/{labelID} - - /api/v2/telegrafs/{telegrafID}/members - - /api/v2/telegrafs/{telegrafID}/members/{userID} - - /api/v2/telegrafs/{telegrafID}/owners - - /api/v2/telegrafs/{telegrafID}/owners/{userID} - title: |- - /api/v2/telegrafs - InfluxDB OSS API Service - tags: - - api-v2 - - telegrafs - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-telegrafs.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-telegrafs.yaml - - path: api-v2-templates - fields: - name: /api/v2/templates - describes: - - /api/v2/templates/apply - - /api/v2/templates/export - title: |- - /api/v2/templates - InfluxDB OSS API Service - tags: - - api-v2 - - templates - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-templates.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-templates.yaml - - path: api-v2-users - fields: - name: /api/v2/users - describes: - - /api/v2/users - - /api/v2/users/{userID} - - /api/v2/users/{userID}/password - title: |- - /api/v2/users - InfluxDB OSS API Service - tags: - - api-v2 - - users - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-users.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-users.yaml - - path: api-v2-variables - fields: - name: /api/v2/variables - describes: - - /api/v2/variables - - /api/v2/variables/{variableID} - - /api/v2/variables/{variableID}/labels - - /api/v2/variables/{variableID}/labels/{labelID} - title: |- - /api/v2/variables - InfluxDB OSS API Service - tags: - - api-v2 - - variables - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-variables.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-variables.yaml - - path: api-v2-write - fields: - name: /api/v2/write - describes: - - /api/v2/write - title: |- - /api/v2/write - InfluxDB OSS API Service - tags: - - api-v2 - - write - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2-write.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2-write.yaml - - path: api-v2 - fields: - name: /api/v2 - describes: - - /api/v2 - title: |- - /api/v2 - InfluxDB OSS API Service - tags: - - api - - v2 - source: static/openapi/influxdb-oss-v2/paths/ref-api-v2.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-api-v2.yaml - - path: debug-pprof-all - fields: - name: /debug/pprof/all - describes: - - /debug/pprof/all - title: |- - /debug/pprof/all - InfluxDB OSS API Service - tags: - - debug-pprof - - all - source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-all.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-all.yaml - - path: debug-pprof-allocs - fields: - name: /debug/pprof/allocs - describes: - - /debug/pprof/allocs - title: |- - /debug/pprof/allocs - InfluxDB OSS API Service - tags: - - debug-pprof - - allocs - source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-allocs.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-allocs.yaml - - path: debug-pprof-block - fields: - name: /debug/pprof/block - describes: - - /debug/pprof/block - title: |- - /debug/pprof/block - InfluxDB OSS API Service - tags: - - debug-pprof - - block - source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-block.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-block.yaml - - path: debug-pprof-cmdline - fields: - name: /debug/pprof/cmdline - describes: - - /debug/pprof/cmdline - title: |- - /debug/pprof/cmdline - InfluxDB OSS API Service - tags: - - debug-pprof - - cmdline - source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-cmdline.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-cmdline.yaml - - path: debug-pprof-goroutine - fields: - name: /debug/pprof/goroutine - describes: - - /debug/pprof/goroutine - title: |- - /debug/pprof/goroutine - InfluxDB OSS API Service - tags: - - debug-pprof - - goroutine - source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-goroutine.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-goroutine.yaml - - path: debug-pprof-heap - fields: - name: /debug/pprof/heap - describes: - - /debug/pprof/heap - title: |- - /debug/pprof/heap - InfluxDB OSS API Service - tags: - - debug-pprof - - heap - source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-heap.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-heap.yaml - - path: debug-pprof-mutex - fields: - name: /debug/pprof/mutex - describes: - - /debug/pprof/mutex - title: |- - /debug/pprof/mutex - InfluxDB OSS API Service - tags: - - debug-pprof - - mutex - source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-mutex.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-mutex.yaml - - path: debug-pprof-profile - fields: - name: /debug/pprof/profile - describes: - - /debug/pprof/profile - title: |- - /debug/pprof/profile - InfluxDB OSS API Service - tags: - - debug-pprof - - profile - source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-profile.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-profile.yaml - - path: debug-pprof-threadcreate - fields: - name: /debug/pprof/threadcreate - describes: - - /debug/pprof/threadcreate - title: |- - /debug/pprof/threadcreate - InfluxDB OSS API Service - tags: - - debug-pprof - - threadcreate - source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-threadcreate.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-threadcreate.yaml - - path: debug-pprof-trace - fields: - name: /debug/pprof/trace - describes: - - /debug/pprof/trace - title: |- - /debug/pprof/trace - InfluxDB OSS API Service - tags: - - debug-pprof - - trace - source: static/openapi/influxdb-oss-v2/paths/ref-debug-pprof-trace.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-debug-pprof-trace.yaml - - path: health - fields: - name: /health - describes: - - /health - title: |- - /health - InfluxDB OSS API Service - tags: - - '' - - health - source: static/openapi/influxdb-oss-v2/paths/ref-health.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-health.yaml - - path: legacy-authorizations - fields: - name: /legacy/authorizations - describes: - - /legacy/authorizations - - /legacy/authorizations/{authID} - - /legacy/authorizations/{authID}/password - title: |- - /legacy/authorizations - InfluxDB OSS API Service - tags: - - legacy - - authorizations - source: static/openapi/influxdb-oss-v2/paths/ref-legacy-authorizations.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-legacy-authorizations.yaml - - path: metrics - fields: - name: /metrics - describes: - - /metrics - title: |- - /metrics - InfluxDB OSS API Service - tags: - - '' - - metrics - source: static/openapi/influxdb-oss-v2/paths/ref-metrics.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-metrics.yaml - - path: ping - fields: - name: /ping - describes: - - /ping - title: |- - /ping - InfluxDB OSS API Service - tags: - - '' - - ping - source: static/openapi/influxdb-oss-v2/paths/ref-ping.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-ping.yaml - - path: query - fields: - name: /query - describes: - - /query - title: |- - /query - InfluxDB OSS API Service - tags: - - '' - - query - source: static/openapi/influxdb-oss-v2/paths/ref-query.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-query.yaml - - path: ready - fields: - name: /ready - describes: - - /ready - title: |- - /ready - InfluxDB OSS API Service - tags: - - '' - - ready - source: static/openapi/influxdb-oss-v2/paths/ref-ready.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-ready.yaml - - path: write - fields: - name: /write - describes: - - /write - title: |- - /write - InfluxDB OSS API Service - tags: - - '' - - write - source: static/openapi/influxdb-oss-v2/paths/ref-write.yaml - staticFilePath: /openapi/influxdb-oss-v2/paths/ref-write.yaml diff --git a/yarn.lock b/yarn.lock index 19b54d4e7a..5d6012ce51 100644 --- a/yarn.lock +++ b/yarn.lock @@ -875,8 +875,9 @@ http2-wrapper@^2.1.10: quick-lru "^5.1.1" resolve-alpn "^1.2.0" -"hugo-data-to-pages@file:../hugo-data-to-pages": +"hugo-data-to-pages@https://github.com/jstirnaman/hugo-data-to-pages": version "1.0.0" + resolved "https://github.com/jstirnaman/hugo-data-to-pages#75471ea58888665129fa6c117c736b5d8251e34d" dependencies: fs-extra "^8.1.0" js-yaml "^4.1.0" From 34dc8a6a2217e7f9ca512da98b9324f16f3fae99 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Wed, 11 Sep 2024 16:51:49 -0500 Subject: [PATCH 04/14] chore: Generalize. --- api-docs/scripts/generate-openapi-articles.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api-docs/scripts/generate-openapi-articles.js b/api-docs/scripts/generate-openapi-articles.js index 49f3b145ed..85235ab485 100644 --- a/api-docs/scripts/generate-openapi-articles.js +++ b/api-docs/scripts/generate-openapi-articles.js @@ -4,8 +4,7 @@ const fs = require('fs'); const openapiDocs = require('./openapi-docs/index.js'); // Calculate the relative paths -const DOCS_ROOT = '.'; -const API_DOCS_ROOT = 'api-docs'; +const DOCS_ROOT = process.env.DOCS_ROOT || '.'; // Function to execute shell commands const execCommand = (command) => { @@ -61,12 +60,12 @@ const config = { apis: [ { name: 'cloud-v2', - spec_file: path.join(API_DOCS_ROOT, '/cloud/v2/ref.yml'), + spec_file: path.join(DOCS_ROOT, '/api-docs/cloud/v2/ref.yml'), pages_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2'), }, { name: 'oss-v2', - spec_file: path.join(API_DOCS_ROOT, '/v2/ref.yml'), + spec_file: path.join(DOCS_ROOT, '/api-docs/v2/ref.yml'), pages_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2'), } ] @@ -74,7 +73,7 @@ const config = { config.apis.forEach(api => { // Execute the getswagger.sh script - execCommand(`${path.join(API_DOCS_ROOT, 'getswagger.sh')} ${api.name} -B`); + execCommand(`${path.join(DOCS_ROOT, '/api-docs/getswagger.sh')} ${api.name} -B`); const dataOut = path.join(config.dataOutPath, api.name); const metadataOut = path.join(config.metadataOutPath, api.name); if (!fs.existsSync(dataOut)) { From ecc56ab3e315d3152863ccb12434208f038c96c7 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Wed, 11 Sep 2024 18:36:49 -0500 Subject: [PATCH 05/14] fix: removes empty strings resulting from snakifying non-word character strings in tags ('/' for legacy paths). --- api-docs/scripts/openapi-docs/index.js | 10 ++++------ package.json | 2 +- yarn.lock | 24 ++++++++++++------------ 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/api-docs/scripts/openapi-docs/index.js b/api-docs/scripts/openapi-docs/index.js index af9e9a53ab..1d54c3cf7b 100644 --- a/api-docs/scripts/openapi-docs/index.js +++ b/api-docs/scripts/openapi-docs/index.js @@ -24,13 +24,11 @@ function openapiPaths(openapi, prefix, outPath) { .forEach((p) => { const delimiter = '/'; let key = p.split(delimiter); - let isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]); if(isItemPath) { key = key.slice(0, -1); } key = (key.slice(0, 4)) - isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]); if(isItemPath) { key = key.slice(0, -1); @@ -78,9 +76,10 @@ function createArticleDataForPathGroup(openapi) { article.fields.title = openapi.info && openapi.info.title; article.fields.description = openapi.description; const pathGroupFrags = path.parse(openapi['x-pathGroup']); - article.fields.tags = ([pathGroupFrags?.dir, pathGroupFrags?.name]).map( - t => snakifyPath(t) - ) + console.log(pathGroupFrags) + article.fields.tags = ([pathGroupFrags?.dir, pathGroupFrags?.name]) + .map( t => snakifyPath(t)) + .filter(t => t.length > 0); return article; } @@ -132,5 +131,4 @@ module.exports = { openapiToData, openapiPaths, openapiMetadata - }; \ No newline at end of file diff --git a/package.json b/package.json index c9778b4768..53ab4a83cd 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "@evilmartians/lefthook": "^1.7.1", "@vvago/vale": "^3.4.2", "autoprefixer": ">=10.2.5", - "hugo-extended": ">=0.101.0", "postcss": ">=8.4.31", "postcss-cli": ">=9.1.0", "prettier": "^3.2.5", @@ -17,6 +16,7 @@ "dependencies": { "axios": "^1.7.4", "hugo-data-to-pages": "https://github.com/jstirnaman/hugo-data-to-pages", + "hugo-extended": "^0.134.2", "js-yaml": "^4.1.0" }, "scripts": { diff --git a/yarn.lock b/yarn.lock index 5d6012ce51..342ebe69af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -454,11 +454,11 @@ crypto-random-string@^4.0.0: type-fest "^1.0.1" debug@^4.3.4: - version "4.3.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b" - integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg== + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== dependencies: - ms "2.1.2" + ms "^2.1.3" decamelize@^1.2.0: version "1.2.0" @@ -885,10 +885,10 @@ http2-wrapper@^2.1.10: toml "^3.0.0" yargs "^13.3.2" -hugo-extended@>=0.101.0: - version "0.133.0" - resolved "https://registry.yarnpkg.com/hugo-extended/-/hugo-extended-0.133.0.tgz#77ad49e1e394634337b7ce198053e670969fe836" - integrity sha512-+C3I/0uUww04mcdkRdcdsfqHlCXMRQrvi7dUqlyPQViDqIMszPzKQorKEB3YddYEJLomLKoUtAoxs2JVqTXT8A== +hugo-extended@^0.134.2: + version "0.134.2" + resolved "https://registry.yarnpkg.com/hugo-extended/-/hugo-extended-0.134.2.tgz#306a37f34ea57722a355b2ad1136935bd0dc3c48" + integrity sha512-rCt3hrgYAUoGOfOnv1s4p2mID/TDHdad+FSgPtB7wVKeDOZZe0UJtlTkCzQZ4bVNHUCQb6YMDV7Dh/p3IjR3mQ== dependencies: careful-downloader "^3.0.0" log-symbols "^5.1.0" @@ -1220,10 +1220,10 @@ moo@^0.5.0: resolved "https://registry.yarnpkg.com/moo/-/moo-0.5.2.tgz#f9fe82473bc7c184b0d32e2215d3f6e67278733c" integrity sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q== -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== nanoid@^3.3.7: version "3.3.7" From 34e6d291780f288bf22a91928eb68231dea52c2f Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Tue, 17 Sep 2024 09:06:11 -0500 Subject: [PATCH 06/14] WIP: draft TODO. Simplify code. --- api-docs/scripts/generate-openapi-articles.js | 50 ++++++++++--------- api-docs/scripts/openapi-docs/index.js | 14 ++---- content/api-ref-pipeline-notes.md | 25 ++++++++++ layouts/_default/api.html | 40 --------------- layouts/api/single.html | 12 ++++- 5 files changed, 68 insertions(+), 73 deletions(-) create mode 100644 content/api-ref-pipeline-notes.md delete mode 100644 layouts/_default/api.html diff --git a/api-docs/scripts/generate-openapi-articles.js b/api-docs/scripts/generate-openapi-articles.js index 85235ab485..d6415302f8 100644 --- a/api-docs/scripts/generate-openapi-articles.js +++ b/api-docs/scripts/generate-openapi-articles.js @@ -18,45 +18,42 @@ const execCommand = (command) => { }; // Function to generate data from OpenAPI -function generateDataFromOpenAPI(specFile, dataOutPath, articleOutPath) { - if (!fs.existsSync(dataOutPath)) { - fs.mkdirSync(dataOutPath, { recursive: true }); +function generateApiData(specFile, dataPath) { + if (!fs.existsSync(dataPath)) { + fs.mkdirSync(dataPath, { recursive: true }); } openapiDocs.openapiToData({ - dataOutPath, - articleOutPath, - specFile + specFile, + dataPath }); }; // Example usage of generateDataFromOpenAPI function // generateDataFromOpenAPI('path/to/openapi-file.yml', 'path/to/paths-output-folder', 'path/to/metadata-output-folder'); -const generatePagesFromArticleData = async (articlesPath, contentPath) => { +const generateApiPages = async (dataPath, contentPath) => { let config = { root: '.', //Root hugo folder, can be empty - dataFolder: articlesPath, //Data folder path (will fetch ALL files from here) + dataFolder: dataPath, //Data folder path (will fetch ALL files from here) type: "api", //Type name [basically layout] (save it under "layouts/NAME/single.html" or themes/THEME/layouts/NAME/single.html). Can be overridden on individual pages by defining "type" under "fields" - pages: "articles", //Pages element in your data, in case it's "posts" or "articles" etc. + pages: "paths", //Pages element in your data, in case it's "posts" or "articles" etc. contentPath: contentPath, //Path to content directory (in case it's not "content") hugoPath: `${DOCS_ROOT}/node_modules/.bin/hugo-extended` //Path to hugo binary (if global, e.g. /snap/bin/hugo) } configJson = `'${JSON.stringify(config)}'`; - console.log('Clean...') - execCommand( - `node ./node_modules/hugo-data-to-pages/hugo.js clean --force --config=${configJson}` - ) + // console.log('Clean...') + // execCommand( + // `node ./node_modules/hugo-data-to-pages/hugo.js clean --force --config=${configJson}` + // ) console.log('Generate...') execCommand( `node ./node_modules/hugo-data-to-pages/hugo.js generate --config=${configJson}` ) } -// To output to a public folder where JavaScript can access it, use /static/--for example: /static/openapi/ const config = { - dataOutPath: path.join(DOCS_ROOT, '/data/api/influxdb'), - metadataOutPath: path.join(DOCS_ROOT, `/data/api-metadata/influxdb`), + dataDir: path.join(DOCS_ROOT, '/data/api/influxdb'), apis: [ { name: 'cloud-v2', @@ -74,12 +71,19 @@ const config = { config.apis.forEach(api => { // Execute the getswagger.sh script execCommand(`${path.join(DOCS_ROOT, '/api-docs/getswagger.sh')} ${api.name} -B`); - const dataOut = path.join(config.dataOutPath, api.name); - const metadataOut = path.join(config.metadataOutPath, api.name); - if (!fs.existsSync(dataOut)) { - fs.mkdirSync(dataOut, { recursive: true }); + // Copy the generated spec to /data + const specDataDir = path.join(config.dataDir, api.name); + if (!fs.existsSync(specDataDir)) { + fs.mkdirSync(specDataDir, { recursive: true }); } - fs.copyFileSync(api.spec_file, path.join(dataOut, api.name + '.yml')); - generateDataFromOpenAPI(api.spec_file, dataOut, metadataOut); - generatePagesFromArticleData(metadataOut, api.pages_dir); + const specDataFile = path.join(specDataDir, api.name + '.yml'); + fs.copyFileSync(api.spec_file, specDataFile); + const apiPathsDir = path.join(specDataDir, '/paths'); + generateApiData(api.spec_file, apiPathsDir); + + // Remove old pages + fs.rmSync(api.pages_dir, {recursive: true, force: true}); + // generateDataFromOpenAPI(api.spec_file, dataOut, metadataOut); + fs.mkdirSync(api.pages_dir, { recursive: true }); + generateApiPages(apiPathsDir, api.pages_dir); }); diff --git a/api-docs/scripts/openapi-docs/index.js b/api-docs/scripts/openapi-docs/index.js index 1d54c3cf7b..66266f4249 100644 --- a/api-docs/scripts/openapi-docs/index.js +++ b/api-docs/scripts/openapi-docs/index.js @@ -18,7 +18,7 @@ const openapiUtils = { } } -function openapiPaths(openapi, prefix, outPath) { +function openapiPaths(openapi, outPath) { const pathGroups = {}; Object.keys(openapi.paths).sort() .forEach((p) => { @@ -49,7 +49,7 @@ function openapiPaths(openapi, prefix, outPath) { if (!fs.existsSync(outPath)) { fs.mkdirSync(outPath, {recursive: true}); } - const realOutPath = path.resolve(outPath, `${prefix}${pg.replaceAll('/', '-').replace(/^-/, '')}.yaml`); + const realOutPath = path.resolve(outPath, `${pg.replaceAll('/', '-').replace(/^-/, '')}.yaml`); writeDataFile(doc, realOutPath); } catch (err) { console.error(err); @@ -117,14 +117,10 @@ function openapiMetadata(sourcePath, targetPath, opts) { } function openapiToData(options) { - const filenamePrefix = `${path.parse(options.specFile).name}-`; - const sourceFile = readFile(options.specFile, 'utf8'); - console.log(`Generating OpenAPI path files in ${options.dataOutPath}....`); - openapiPaths(sourceFile, filenamePrefix, options.dataOutPath); - - console.log(`Generating OpenAPI article data in ${options.articleOutPath}...`); - openapiMetadata(options.dataOutPath, options.articleOutPath, {filePattern: filenamePrefix}); + console.log(`Generating OpenAPI path files in ${options.dataPath}....`); + openapiPaths(sourceFile, options.dataPath); + //openapiMetadata(options.dataPath); } module.exports = { diff --git a/content/api-ref-pipeline-notes.md b/content/api-ref-pipeline-notes.md new file mode 100644 index 0000000000..8a9bb0b902 --- /dev/null +++ b/content/api-ref-pipeline-notes.md @@ -0,0 +1,25 @@ +# API reference pipeline with Hugo + +- Hugo can render the following content formats as page content: + Markdown, HTML, Emacs Org Mode, AsciiDoc, Pandoc, or reStructuredText. + +- Front matter at the top of each content file is metadata that: + + - Describes the content + - Augments the content + - Establishes relationships with other content + - Controls the published structure of your site + - Determines template selection + +1. Create a content type (folder) or assign a `type` property for API reference (OpenAPI) paths. For example, if the page structure is `content/influxdb/v2/api/v2/[OpenAPI path]`, then add `type: api_path` to the frontmatter and, if necessary, specify a layout: `layout: api_path`. +1. Store each product's OpenAPI spec files in YAML format inside a "namespaced" (to avoid collisions) directory structure in `/data`. +1. For each product.path, generate a page with all path metadata in the frontmatter. See [`.Site.Data`](https://gohugo.io/methods/site/data/) +2. Create a template to render the path +3. Create additional templates that process page data for nav, filtering, links, code samples, etc. + + + +## Useful functions + +- [`data.GetJSON`](https://gohugo.io/functions/data/getjson/): Returns a JSON object from a local or remote JSON file, or an error if the file does not exist. +- [`resources.GetRemote URL`](https://gohugo.io/functions/resources/getremote/): fetches and caches remote resources (images, js, etc.) \ No newline at end of file diff --git a/layouts/_default/api.html b/layouts/_default/api.html deleted file mode 100644 index 6c07e82099..0000000000 --- a/layouts/_default/api.html +++ /dev/null @@ -1,40 +0,0 @@ - - -{{ partial "header.html" . }} -{{ partial "topnav.html" . }} - -
- {{ partial "sidebar.html" . }} -
- - -

{{ .Params.title }}

- - - -
- -
-
- -{{ partial "footer.html" . }} \ No newline at end of file diff --git a/layouts/api/single.html b/layouts/api/single.html index 36d78fbec6..1680d2869e 100644 --- a/layouts/api/single.html +++ b/layouts/api/single.html @@ -3,6 +3,16 @@ {{ partial "header.html" . }} {{ partial "topnav.html" . }} +{{ range $category, $api := .Site.Data.api.influxdb.v2_cloud.cloud_v2 }} +

{{ $category | title }}

+
    + {{ range $api }} +
  • {{ .info.title }}
    ({{ .info.description }})
  • + {{ end }} +
+{{ end }} + + {{ partial "footer.html" . }} \ No newline at end of file From f368438d66f15edbb0c1d57b98f867d58fd1ce71 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Fri, 20 Sep 2024 15:52:34 -0500 Subject: [PATCH 07/14] fix(api): update yarn.lock --- yarn.lock | 92 +++++++++++++++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/yarn.lock b/yarn.lock index 342ebe69af..6d957e1038 100644 --- a/yarn.lock +++ b/yarn.lock @@ -26,9 +26,9 @@ picocolors "^1.0.0" "@evilmartians/lefthook@^1.7.1": - version "1.7.14" - resolved "https://registry.yarnpkg.com/@evilmartians/lefthook/-/lefthook-1.7.14.tgz#3fce9d4c91c23232f02bab592ce914713880bb8d" - integrity sha512-0FPRdmd7hIZXjTQKQjLnmqxx4xGRIM1oGN9pJ4PyI14tOqEAwstmLIbauqQpTVTj3MAPeylsQVXh9RGaq/F2/A== + version "1.7.15" + resolved "https://registry.yarnpkg.com/@evilmartians/lefthook/-/lefthook-1.7.15.tgz#7f02e49df8315efec276f82b8d2cfa481a1c42e5" + integrity sha512-YgKTw9noH/SG0aOaPgrZNRgY7iJ0FuIVfvdB/aGsNulYLqiFnJyID2sfCaQ7PsGaFng2wdFBhmK/wbnb8+qPcA== "@isaacs/cliui@^8.0.2": version "8.0.2" @@ -96,9 +96,9 @@ integrity sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA== "@vvago/vale@^3.4.2": - version "3.7.0" - resolved "https://registry.yarnpkg.com/@vvago/vale/-/vale-3.7.0.tgz#fcae449cdd4ba2578f1242250d06226c84ce96f2" - integrity sha512-Jju27u/bQhQ0eogBTcTeqlpVF/5PejO3HFjuaD9tLVPgQ/1pb2pux0NMRq4idOtH8xotwyBO/dyPT9EbvnpGNQ== + version "3.7.1" + resolved "https://registry.yarnpkg.com/@vvago/vale/-/vale-3.7.1.tgz#64922ffee325eef02291774358f189abfc5cc36e" + integrity sha512-TVpUtFPilUCq2GyO3j7+fYH4Fd50RIdlFTc85daJv6JePaXlYmYsz5q020bwo395kOOGWWW61nXWmmVkCqHG9A== dependencies: axios "^1.4.0" rimraf "^5.0.0" @@ -116,9 +116,9 @@ ansi-regex@^5.0.1: integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-regex@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a" - integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA== + version "6.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.1.0.tgz#95ec409c69619d6cb1b8b34f14b660ef28ebd654" + integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA== ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" @@ -170,9 +170,9 @@ autoprefixer@>=10.2.5: postcss-value-parser "^4.2.0" axios@^1.4.0, axios@^1.7.4: - version "1.7.4" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.4.tgz#4c8ded1b43683c8dd362973c393f3ede24052aa2" - integrity sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw== + version "1.7.7" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.7.tgz#2f554296f9892a72ac8d8e4c5b79c14a91d0a47f" + integrity sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q== dependencies: follow-redirects "^1.15.6" form-data "^4.0.0" @@ -316,9 +316,9 @@ camelcase@^5.0.0: integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== caniuse-lite@^1.0.30001646: - version "1.0.30001651" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz#52de59529e8b02b1aedcaaf5c05d9e23c0c28138" - integrity sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg== + version "1.0.30001662" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001662.tgz#3574b22dfec54a3f3b6787331da1040fe8e763ec" + integrity sha512-sgMUVwLmGseH8ZIrm1d51UbrhqMCH3jvS7gF/M6byuHOnKyLOBL7W8yz5V02OHwgLGA36o/AFhWzzh4uc5aqTA== careful-downloader@^3.0.0: version "3.0.0" @@ -558,9 +558,9 @@ eastasianwidth@^0.2.0: integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== electron-to-chromium@^1.5.4: - version "1.5.13" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.13.tgz#1abf0410c5344b2b829b7247e031f02810d442e6" - integrity sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q== + version "1.5.26" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.26.tgz#449b4fa90e83ab98abbe3b6a96c8ee395de94452" + integrity sha512-Z+OMe9M/V6Ep9n/52+b7lkvYEps26z4Yz3vjWL1V61W0q+VLF1pOHhMY17sa4roz4AWmULSI8E6SAojZA5L0YQ== emoji-regex@^7.0.1: version "7.0.3" @@ -592,9 +592,9 @@ error-ex@^1.3.1: is-arrayish "^0.2.1" escalade@^3.1.1, escalade@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" - integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== + version "3.2.0" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" + integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== escape-string-regexp@^1.0.5: version "1.0.5" @@ -664,9 +664,9 @@ find-up@^6.3.0: path-exists "^5.0.0" follow-redirects@^1.15.6: - version "1.15.6" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" - integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== + version "1.15.9" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" + integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== foreground-child@^3.1.0: version "3.3.0" @@ -1380,10 +1380,10 @@ pend@~1.2.0: resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg== -picocolors@^1.0.0, picocolors@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" - integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== +picocolors@^1.0.0, picocolors@^1.0.1, picocolors@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59" + integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw== picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: version "2.3.1" @@ -1452,13 +1452,13 @@ postcss-value-parser@^4.2.0: integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== postcss@>=8.4.31: - version "8.4.41" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.41.tgz#d6104d3ba272d882fe18fc07d15dc2da62fa2681" - integrity sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ== + version "8.4.47" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.47.tgz#5bf6c9a010f3e724c503bf03ef7947dcb0fea365" + integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== dependencies: nanoid "^3.3.7" - picocolors "^1.0.1" - source-map-js "^1.2.0" + picocolors "^1.1.0" + source-map-js "^1.2.1" prettier-plugin-sql@^0.18.0: version "0.18.1" @@ -1679,10 +1679,10 @@ slash@^5.0.0, slash@^5.1.0: resolved "https://registry.yarnpkg.com/slash/-/slash-5.1.0.tgz#be3adddcdf09ac38eebe8dcdc7b1a57a75b095ce" integrity sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg== -source-map-js@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" - integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== +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" + integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== spdx-correct@^3.0.0: version "3.2.0" @@ -1711,9 +1711,9 @@ spdx-license-ids@^3.0.0: integrity sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw== sql-formatter@^15.0.2: - version "15.4.0" - resolved "https://registry.yarnpkg.com/sql-formatter/-/sql-formatter-15.4.0.tgz#b4236760f96132ee786e0acb58bc5a740f11f1b9" - integrity sha512-h3uVulRmOfARvDejuSzs9GMbua/UmGCKiP08zyHT1PnG376zk9CHVsDAcKIc9TcIwIrDH3YULWwI4PrXdmLRVw== + version "15.4.2" + resolved "https://registry.yarnpkg.com/sql-formatter/-/sql-formatter-15.4.2.tgz#c8c239c69c81a71af4fdf39b32c6695eea4aca09" + integrity sha512-Pw4aAgfuyml/SHMlhbJhyOv+GR+Z1HNb9sgX3CVBVdN5YNM+v2VWkYJ3NNbYS7cu37GY3vP/PgnwoVynCuXRxg== dependencies: argparse "^2.0.1" get-stdin "=8.0.0" @@ -1877,9 +1877,9 @@ toml@^3.0.0: integrity sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ== tslib@^2.6.2: - version "2.6.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" - integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== type-fest@^1.0.1: version "1.4.0" @@ -2032,9 +2032,9 @@ yallist@^4.0.0: integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== yaml@^2.4.2: - version "2.5.0" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.0.tgz#c6165a721cf8000e91c36490a41d7be25176cf5d" - integrity sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw== + version "2.5.1" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.1.tgz#c9772aacf62cb7494a95b0c4f1fb065b563db130" + integrity sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q== yargs-parser@^13.1.2: version "13.1.2" From bd319403658c9811e3453d1099fc09d66ff5b674 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Mon, 23 Sep 2024 12:43:08 -0500 Subject: [PATCH 08/14] To build the API pages, run `yarn run build-apidocs` from the project directory. No longer uses Hugo /data. Removes dependency on the Hugo-data-to-pages script. For each product endpoint, generate a page with the endpoint spec inside the frontmatter. Writes endpoint specs into each page's frontmatter. Assign a `type` property for API reference (OpenAPI) paths. For example, if the page structure is `content/influxdb/v2/api/v2/[OpenAPI path]`, then add `type: api_path` to the frontmatter and, if necessary, specify a layout: `layout: api_path`. Renders the spec param JSON using Rapidoc. TODO: - Cleanup - Create additional templates that process page data for nav, filtering, links, code samples, etc. - Fix circular reference issues in specs that prevent generating a dereferenced JSON bundle (which could also help us our own custom UI...should we choose). --- api-docs/getswagger.sh | 12 +- api-docs/scripts/create-pages.js | 129 +++++++++++++++++ api-docs/scripts/generate-openapi-articles.js | 89 ------------ api-docs/scripts/openapi-docs/cli.js | 61 -------- api-docs/scripts/openapi-docs/index.js | 130 ------------------ api-docs/scripts/openapi-docs/package.json | 19 --- api-docs/scripts/validate-spec.js | 44 ++++++ content/api-ref-pipeline-notes.md | 25 ---- layouts/_default/old-api.html | 1 - layouts/api/single.html | 19 +-- package.json | 3 +- 11 files changed, 189 insertions(+), 343 deletions(-) create mode 100644 api-docs/scripts/create-pages.js delete mode 100644 api-docs/scripts/generate-openapi-articles.js delete mode 100644 api-docs/scripts/openapi-docs/cli.js delete mode 100644 api-docs/scripts/openapi-docs/index.js delete mode 100644 api-docs/scripts/openapi-docs/package.json create mode 100644 api-docs/scripts/validate-spec.js delete mode 100644 content/api-ref-pipeline-notes.md delete mode 100644 layouts/_default/old-api.html diff --git a/api-docs/getswagger.sh b/api-docs/getswagger.sh index 1b7581a7e2..a8bc782c70 100755 --- a/api-docs/getswagger.sh +++ b/api-docs/getswagger.sh @@ -116,6 +116,8 @@ function postProcess() { # npm_config_yes=true npx overrides the prompt # and (vs. npx --yes) is compatible with npm@6 and npm@7. specPath="$1" + # Replace the .yml extension in specPath with .json. + specJsonPath="${specPath%.yml}.json" configPath="$2" api="$3" @@ -136,8 +138,14 @@ function postProcess() { API_DOCS_ROOT_PATH=$API_DOCS_ROOT \ npm_config_yes=true \ npx $openapiCLI bundle $specPath \ - -o $specPath \ - --config=$configPath + --config=$configPath \ + --ext yml \ + --output $specPath #\ + # TODO: Uncommend this after fixing the circular reference ($ref) issues in the specs. + # && npx $openapiCLI bundle $specPath \ + # --dereferenced \ + # --ext json \ + # --output $specJsonPath } function updateOSS { diff --git a/api-docs/scripts/create-pages.js b/api-docs/scripts/create-pages.js new file mode 100644 index 0000000000..cccb72cd70 --- /dev/null +++ b/api-docs/scripts/create-pages.js @@ -0,0 +1,129 @@ +/** + * This script generates markdown files for each endpoint in the + * configured OpenAPI specs. + */ +const { execSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const yaml = require('js-yaml'); + +// Calculate the relative paths +const DOCS_ROOT = process.env.DOCS_ROOT || '.'; + +// Function to execute shell commands +const execCommand = (command) => { + try { + console.log(`Executing: ${command}`); + execSync(command, { stdio: 'inherit' }); + } catch (error) { + console.error(`Error executing command: ${command}`); + process.exit(1); + } +}; + +const openapiUtils = { + isPlaceholderFragment: function(str) { + const placeholderRegex = new RegExp('^\{.*\}$'); + return placeholderRegex.test(str); + } +} + +function getPathGroups(openapi) { + const pathGroups = {}; + Object.keys(openapi.paths).sort() + .forEach((p) => { + const delimiter = '/'; + let key = p.split(delimiter); + let isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]); + if(isItemPath) { + key = key.slice(0, -1); + } + key = (key.slice(0, 4)) + isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]); + if(isItemPath) { + key = key.slice(0, -1); + } + const groupKey = key.join('/'); + pathGroups[groupKey] = pathGroups[groupKey] || {}; + pathGroups[groupKey][p] = openapi.paths[p]; + }); + return pathGroups; +} + +function main() { + /** + * Configure the product specs to generate markdown files for. + */ + const config = { + dataDir: path.join(DOCS_ROOT, '/data/api/influxdb'), + apis: [ + { + name: 'cloud-v2', + menu: 'influxdb_cloud', + // Source OpenAPI spec file + spec_file: path.join(DOCS_ROOT, '/api-docs/cloud/v2/ref.yml'), + // Target content directory for generated endpoint spec pages + // endpoints_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2/yaml'), + // Target content directory for generated .md pages + pages_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2'), + }, + { + name: 'oss-v2', + menu: 'influxdb_v2', + spec_file: path.join(DOCS_ROOT, '/api-docs/v2/ref.yml'), + // Target content directory for generated endpoint spec pages + // endpoints_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2/yaml'), + // Target content directory for generated .md pages + pages_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2'), + } + ] + } + + config.apis.forEach(api => { + // Execute the getswagger.sh script to fetch and bundle the configured spec. + execCommand(`${path.join(DOCS_ROOT, '/api-docs/getswagger.sh')} ${api.name} -B`); + + // Remove old Hugo pages + fs.rmSync(api.pages_dir, {recursive: true, force: true}); + + spec = yaml.load(fs.readFileSync(api.spec_file)); + const pathGroups = getPathGroups(spec); + + if (!fs.existsSync(api.pages_dir)) { + fs.mkdirSync(api.pages_dir, { recursive: true }); + }; + + Object.keys(pathGroups).forEach( pathGroup => { + // Deep copy the spec object + let pathSpec = JSON.parse(JSON.stringify(spec)); + pathSpec.paths = pathGroups[pathGroup]; + pathSpec['x-pathGroupTitle'] = `${pathGroup}\n${spec.info.title}`; + pathSpec['x-pathGroup'] = pathGroup; + + const pageParams = { + type: 'api', + title: pathSpec['x-pathGroupTitle'], + description: pathSpec.info.description, + api: { + part_of: api.spec_file, + spec: JSON.stringify(pathSpec), + }, + } + pageParams.menu = {}; + pageParams.menu[api.menu] = { + parent: 'INFLUXDB HTTP API', + weight: 1, + name: pathGroup + }; + + let frontMatter = JSON.stringify(pageParams); + + const pageName = `${pathGroup.replaceAll('/', '-').replace(/^-/, '')}`; + const pagePath = path.join(api.pages_dir, `${pageName}.md`); + fs.writeFileSync(pagePath, frontMatter); + console.log(`Created: ${pagePath}`); + }); + }); +} + +main(); diff --git a/api-docs/scripts/generate-openapi-articles.js b/api-docs/scripts/generate-openapi-articles.js deleted file mode 100644 index d6415302f8..0000000000 --- a/api-docs/scripts/generate-openapi-articles.js +++ /dev/null @@ -1,89 +0,0 @@ -const { execSync } = require('child_process'); -const path = require('path'); -const fs = require('fs'); -const openapiDocs = require('./openapi-docs/index.js'); - -// Calculate the relative paths -const DOCS_ROOT = process.env.DOCS_ROOT || '.'; - -// Function to execute shell commands -const execCommand = (command) => { - try { - console.log(`Executing: ${command}`); - execSync(command, { stdio: 'inherit' }); - } catch (error) { - console.error(`Error executing command: ${command}`); - process.exit(1); - } -}; - -// Function to generate data from OpenAPI -function generateApiData(specFile, dataPath) { - if (!fs.existsSync(dataPath)) { - fs.mkdirSync(dataPath, { recursive: true }); - } - - openapiDocs.openapiToData({ - specFile, - dataPath - }); -}; - -// Example usage of generateDataFromOpenAPI function -// generateDataFromOpenAPI('path/to/openapi-file.yml', 'path/to/paths-output-folder', 'path/to/metadata-output-folder'); - -const generateApiPages = async (dataPath, contentPath) => { - let config = { - root: '.', //Root hugo folder, can be empty - dataFolder: dataPath, //Data folder path (will fetch ALL files from here) - type: "api", //Type name [basically layout] (save it under "layouts/NAME/single.html" or themes/THEME/layouts/NAME/single.html). Can be overridden on individual pages by defining "type" under "fields" - pages: "paths", //Pages element in your data, in case it's "posts" or "articles" etc. - contentPath: contentPath, //Path to content directory (in case it's not "content") - hugoPath: `${DOCS_ROOT}/node_modules/.bin/hugo-extended` //Path to hugo binary (if global, e.g. /snap/bin/hugo) - } - configJson = `'${JSON.stringify(config)}'`; - // console.log('Clean...') - // execCommand( - // `node ./node_modules/hugo-data-to-pages/hugo.js clean --force --config=${configJson}` - // ) - console.log('Generate...') - execCommand( - `node ./node_modules/hugo-data-to-pages/hugo.js generate --config=${configJson}` - ) -} - -const config = { - dataDir: path.join(DOCS_ROOT, '/data/api/influxdb'), - apis: [ - { - name: 'cloud-v2', - spec_file: path.join(DOCS_ROOT, '/api-docs/cloud/v2/ref.yml'), - pages_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2'), - }, - { - name: 'oss-v2', - spec_file: path.join(DOCS_ROOT, '/api-docs/v2/ref.yml'), - pages_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2'), - } - ] -} - -config.apis.forEach(api => { - // Execute the getswagger.sh script - execCommand(`${path.join(DOCS_ROOT, '/api-docs/getswagger.sh')} ${api.name} -B`); - // Copy the generated spec to /data - const specDataDir = path.join(config.dataDir, api.name); - if (!fs.existsSync(specDataDir)) { - fs.mkdirSync(specDataDir, { recursive: true }); - } - const specDataFile = path.join(specDataDir, api.name + '.yml'); - fs.copyFileSync(api.spec_file, specDataFile); - const apiPathsDir = path.join(specDataDir, '/paths'); - generateApiData(api.spec_file, apiPathsDir); - - // Remove old pages - fs.rmSync(api.pages_dir, {recursive: true, force: true}); - // generateDataFromOpenAPI(api.spec_file, dataOut, metadataOut); - fs.mkdirSync(api.pages_dir, { recursive: true }); - generateApiPages(apiPathsDir, api.pages_dir); -}); diff --git a/api-docs/scripts/openapi-docs/cli.js b/api-docs/scripts/openapi-docs/cli.js deleted file mode 100644 index 6c8f9dae0f..0000000000 --- a/api-docs/scripts/openapi-docs/cli.js +++ /dev/null @@ -1,61 +0,0 @@ -const argparse = require('argparse'); -const apiDocs = require('./index.js'); - -const cli = new argparse.ArgumentParser({ - prog: 'api-docs', - add_help: true -}); - -cli.add_argument('--hugo', { - help: 'Generate a data file with objects (e.g. for Hugo data) from OpenAPI paths', - dest: 'generateData' -}); - -cli.add_argument('-d', '--data-output', { - help: 'Filepath where generated OpenAPI data output will be written.', - dest: 'dataOutPath' -}); - -cli.add_argument('-o', '--article-data-output', { - help: 'Filepath where generated article metadata output will be written.', - dest: 'articleOutPath' -}); - -cli.add_argument('-pre', '--path-prefix', { - help: 'A path to use as the prefix for the path property in each generated article.', - dest: 'pathPrefix' -}); - -cli.add_argument('file', { - help: 'File to read, utf-8 encoded without BOM', - nargs: '?', - default: '-' -}); - - -//////////////////////////////////////////////////////////////////////////////// - - -var options = cli.parse_args(); - - -/* Usage examples - * - node ./api-docs-data/index.js \ - ./data/influxdb/cloud/openapi.yaml \ - -d ./data/influxdb/cloud/path-apis \ - -o ./data/article-data/influxdb/cloud - - node ./api-docs-data/index.js \ - ./data/influxdb/oss/openapi.yaml \ - -d ./data/influxdb/oss/path-apis \ - -o ./data/article-data/influxdb/oss - * - */ - -//////////////////////////////////////////////////////////////////////////////// - - -if (options.generateData) { - apiDocs.openapiToData(options); -} diff --git a/api-docs/scripts/openapi-docs/index.js b/api-docs/scripts/openapi-docs/index.js deleted file mode 100644 index 66266f4249..0000000000 --- a/api-docs/scripts/openapi-docs/index.js +++ /dev/null @@ -1,130 +0,0 @@ -const yaml = require('js-yaml'); -const fs = require('fs'); -const path = require('path'); - - -function readFile(filepath, encoding, callback) { - return yaml.load(fs.readFileSync(filepath, encoding)); -} - -function writeDataFile(data, outputTo, callback) { - fs.writeFileSync(outputTo, yaml.dump(data)); -} - -const openapiUtils = { - isPlaceholderFragment: function(str) { - const placeholderRegex = new RegExp('^\{.*\}$'); - return placeholderRegex.test(str); - } -} - -function openapiPaths(openapi, outPath) { - const pathGroups = {}; - Object.keys(openapi.paths).sort() - .forEach((p) => { - const delimiter = '/'; - let key = p.split(delimiter); - let isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]); - if(isItemPath) { - key = key.slice(0, -1); - } - key = (key.slice(0, 4)) - isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]); - if(isItemPath) { - key = key.slice(0, -1); - } - const groupKey = key.join('/'); - pathGroups[groupKey] = pathGroups[groupKey] || {}; - pathGroups[groupKey][p] = openapi.paths[p]; - }) - - Object.keys(pathGroups).forEach(pg => { - // Deep copy openapi. - let doc = JSON.stringify(openapi); - doc = JSON.parse(doc); - doc.paths = pathGroups[pg]; - doc.info.title = `${pg}\n${doc.info.title}`; - doc['x-pathGroup'] = pg; - try { - if (!fs.existsSync(outPath)) { - fs.mkdirSync(outPath, {recursive: true}); - } - const realOutPath = path.resolve(outPath, `${pg.replaceAll('/', '-').replace(/^-/, '')}.yaml`); - writeDataFile(doc, realOutPath); - } catch (err) { - console.error(err); - } - }) -} - -function createArticleDataForPathGroup(openapi) { - const article = { - path: '', - fields: { - name: openapi['x-pathGroup'], - describes: Object.keys(openapi.paths) - } - }; - const snakifyPath = (p) => { - if(!path) { - return; - } - return p.replace(/^\//, '') - .replaceAll('/', '-'); - } - article.path = snakifyPath(openapi['x-pathGroup']); - article.fields.title = openapi.info && openapi.info.title; - article.fields.description = openapi.description; - const pathGroupFrags = path.parse(openapi['x-pathGroup']); - console.log(pathGroupFrags) - article.fields.tags = ([pathGroupFrags?.dir, pathGroupFrags?.name]) - .map( t => snakifyPath(t)) - .filter(t => t.length > 0); - return article; -} - -function openapiMetadata(sourcePath, targetPath, opts) { - const isFile = filePath => { - return fs.lstatSync(filePath).isFile(); - }; - - const matchesPattern = filePath => { - return opts.filePattern ? path.parse(filePath).name.startsWith(opts.filePattern) : true; - }; - - try { - const articles = fs.readdirSync(sourcePath) - .map(fileName => { - return path.join(sourcePath, fileName); - }) - .filter(matchesPattern) - .filter(isFile) - .map(filePath => { - const openapi = readFile(filePath); - const article = createArticleDataForPathGroup(openapi); - article.fields.source = filePath; - article.fields.staticFilePath = filePath.replace(/^static\//, '/'); // This might appear counterintuitive; Hugo omits "/static" from the URI when serving files stored in the "./static" directory. - return article; - }); - if (!fs.existsSync(targetPath)) { - fs.mkdirSync(targetPath, {recursive: true}); - } - const articlePath = path.resolve(targetPath, 'articles.yml'); - writeDataFile({ articles }, articlePath); - } catch(e) { - console.log(e); - } -} - -function openapiToData(options) { - const sourceFile = readFile(options.specFile, 'utf8'); - console.log(`Generating OpenAPI path files in ${options.dataPath}....`); - openapiPaths(sourceFile, options.dataPath); - //openapiMetadata(options.dataPath); -} - -module.exports = { - openapiToData, - openapiPaths, - openapiMetadata -}; \ No newline at end of file diff --git a/api-docs/scripts/openapi-docs/package.json b/api-docs/scripts/openapi-docs/package.json deleted file mode 100644 index 066fa3f6d2..0000000000 --- a/api-docs/scripts/openapi-docs/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "api-docs-data", - "version": "1.0.0", - "description": "A tool to convert OpenAPI v3 paths to Hugo data.", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [ - "OpenAPI", - "Hugo", - "YAML" - ], - "author": "Jason Stirnaman", - "license": "ISC", - "dependencies": { - "js-yaml": "^4.1.0" - } -} diff --git a/api-docs/scripts/validate-spec.js b/api-docs/scripts/validate-spec.js new file mode 100644 index 0000000000..33cb14804f --- /dev/null +++ b/api-docs/scripts/validate-spec.js @@ -0,0 +1,44 @@ +/** This script contains functions for running various + * OpenAPI spec validation tools. + */ +const SwaggerParser = require('@apidevtools/swagger-parser'); +const { execSync } = require('child_process'); +const spec = '/Users/ja/Documents/GitHub/docs-v2/api-docs/cloud/v2/ref.yml' + +async function detectCircularRefs() { + try { + const api = await SwaggerParser.validate(spec); + console.log('API is valid:', api); + } catch (err) { + if (err.message.includes('Circular $ref pointer found')) { + console.error('Circular reference detected:', err); + } else { + console.error('API validation failed:', err); + } + } +} + +// Function to execute shell commands +const execCommand = (command) => { + try { + console.log(`Executing: ${command}`); + execSync(command, { stdio: 'inherit' }); + } catch (error) { + console.error(error); + } +}; + +function validate() { + +detectCircularRefs(); + +// swagger-cli validate + execCommand(`npx swagger-cli validate ${spec}`); + +// speccy lint. Treat $ref like JSON schema and convert to OpenAPI Schema Objects. +execCommand(`npx speccy lint -j -v ${spec}`); + +execCommand(`npx @redocly/cli lint ${spec}`); +} + +validate(); \ No newline at end of file diff --git a/content/api-ref-pipeline-notes.md b/content/api-ref-pipeline-notes.md deleted file mode 100644 index 8a9bb0b902..0000000000 --- a/content/api-ref-pipeline-notes.md +++ /dev/null @@ -1,25 +0,0 @@ -# API reference pipeline with Hugo - -- Hugo can render the following content formats as page content: - Markdown, HTML, Emacs Org Mode, AsciiDoc, Pandoc, or reStructuredText. - -- Front matter at the top of each content file is metadata that: - - - Describes the content - - Augments the content - - Establishes relationships with other content - - Controls the published structure of your site - - Determines template selection - -1. Create a content type (folder) or assign a `type` property for API reference (OpenAPI) paths. For example, if the page structure is `content/influxdb/v2/api/v2/[OpenAPI path]`, then add `type: api_path` to the frontmatter and, if necessary, specify a layout: `layout: api_path`. -1. Store each product's OpenAPI spec files in YAML format inside a "namespaced" (to avoid collisions) directory structure in `/data`. -1. For each product.path, generate a page with all path metadata in the frontmatter. See [`.Site.Data`](https://gohugo.io/methods/site/data/) -2. Create a template to render the path -3. Create additional templates that process page data for nav, filtering, links, code samples, etc. - - - -## Useful functions - -- [`data.GetJSON`](https://gohugo.io/functions/data/getjson/): Returns a JSON object from a local or remote JSON file, or an error if the file does not exist. -- [`resources.GetRemote URL`](https://gohugo.io/functions/resources/getremote/): fetches and caches remote resources (images, js, etc.) \ No newline at end of file diff --git a/layouts/_default/old-api.html b/layouts/_default/old-api.html deleted file mode 100644 index 68a09ae661..0000000000 --- a/layouts/_default/old-api.html +++ /dev/null @@ -1 +0,0 @@ -{{ .Content }} diff --git a/layouts/api/single.html b/layouts/api/single.html index 1680d2869e..9bedf77bbf 100644 --- a/layouts/api/single.html +++ b/layouts/api/single.html @@ -1,18 +1,7 @@ - - {{ partial "header.html" . }} {{ partial "topnav.html" . }} -{{ range $category, $api := .Site.Data.api.influxdb.v2_cloud.cloud_v2 }} -

{{ $category | title }}

-
    - {{ range $api }} -
  • {{ .info.title }}
    ({{ .info.description }})
  • - {{ end }} -
-{{ end }} - -
{{ partial "sidebar.html" . }}
@@ -22,7 +11,8 @@

{{ .Params.title }}

{{ .Params.title }} // Sets the server to http://localhost:8080/api // you must have defined this server in your spec }); - const spec = rapidocEl.dataset.openapiDoc; + const spec = JSON.parse(rapidocEl.dataset.openapiSpec); rapidocEl.loadSpec(spec); }); @@ -45,5 +35,4 @@

{{ .Params.title }}

---> {{ partial "footer.html" . }} \ No newline at end of file diff --git a/package.json b/package.json index 53ab4a83cd..d45724aef7 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "scripts": { "lint": "LEFTHOOK_EXCLUDE=test lefthook run pre-commit && lefthook run pre-push", "pre-commit": "lefthook run pre-commit", - "test-content": "docker compose --profile test up" + "test-content": "docker compose --profile test up", + "build-apidocs": "node api-docs/scripts/create-pages.js" }, "main": "index.js", "module": "main.js", From c8d083d88ebd1cd0f087122be8ebafb4ffc81486 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Tue, 24 Sep 2024 16:52:38 -0500 Subject: [PATCH 09/14] fix(oss): Update TLS example using openssl and including Subject Alternative Name (SAN) - Example uses Subject Alternative Name extension required by modern clients. - Updated example is more verbose, but should work cross-platform. - Added troubleshooting steps. - Passes tests. - Reformatted to headings and remove list nesting. --- assets/jsconfig.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 assets/jsconfig.json diff --git a/assets/jsconfig.json b/assets/jsconfig.json new file mode 100644 index 0000000000..377218ccba --- /dev/null +++ b/assets/jsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "*": [ + "*" + ] + } + } +} \ No newline at end of file From fe49069c75eb5c0d8edd2a7f5a32271eda6d08a1 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Fri, 27 Sep 2024 08:46:46 -0500 Subject: [PATCH 10/14] chore(api): Use Spectral for linting OpenAPI --- api-docs/.spectral.yaml | 1 + api-docs/scripts/validate-spec.js | 29 +++++++++++------------------ 2 files changed, 12 insertions(+), 18 deletions(-) create mode 100644 api-docs/.spectral.yaml diff --git a/api-docs/.spectral.yaml b/api-docs/.spectral.yaml new file mode 100644 index 0000000000..63790cd08f --- /dev/null +++ b/api-docs/.spectral.yaml @@ -0,0 +1 @@ +extends: ["spectral:oas", "spectral:asyncapi", "spectral:arazzo"] diff --git a/api-docs/scripts/validate-spec.js b/api-docs/scripts/validate-spec.js index 33cb14804f..f146c74ee7 100644 --- a/api-docs/scripts/validate-spec.js +++ b/api-docs/scripts/validate-spec.js @@ -5,18 +5,6 @@ const SwaggerParser = require('@apidevtools/swagger-parser'); const { execSync } = require('child_process'); const spec = '/Users/ja/Documents/GitHub/docs-v2/api-docs/cloud/v2/ref.yml' -async function detectCircularRefs() { - try { - const api = await SwaggerParser.validate(spec); - console.log('API is valid:', api); - } catch (err) { - if (err.message.includes('Circular $ref pointer found')) { - console.error('Circular reference detected:', err); - } else { - console.error('API validation failed:', err); - } - } -} // Function to execute shell commands const execCommand = (command) => { @@ -30,15 +18,20 @@ const execCommand = (command) => { function validate() { -detectCircularRefs(); + // detectCircularRefs(); + + // // swagger-cli validate + // execCommand(`npx swagger-cli validate ${spec}`); + + // // speccy lint. Treat $ref like JSON schema and convert to OpenAPI Schema Objects. + // execCommand(`npx speccy lint -j -v ${spec}`); -// swagger-cli validate - execCommand(`npx swagger-cli validate ${spec}`); + // execCommand(`npx @redocly/cli lint ${spec}`); -// speccy lint. Treat $ref like JSON schema and convert to OpenAPI Schema Objects. -execCommand(`npx speccy lint -j -v ${spec}`); + // Create a Spectral ruleset file + // Spectral is a flexible JSON/YAML linter, formatter, and style checker for OpenAPI v2, v3.0, v3.1, and AsyncAPI v2.0. + execCommand(`npx @stoplight/spectral-cli lint ${spec} --ruleset ./api-docs/.spectral.yaml`); // --ruleset myruleset.yaml -execCommand(`npx @redocly/cli lint ${spec}`); } validate(); \ No newline at end of file From b2ef303baa54d4b7ca56690e417161b71aa0837a Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Fri, 27 Sep 2024 17:36:09 -0500 Subject: [PATCH 11/14] WIP(api): hide rapidoc sidebar, add API _index page, replace rapidoc CDN with package from npm and js.Build --- api-docs/scripts/create-pages.js | 137 +++-- api-docs/scripts/validate-spec.js | 1 + assets/js/api-doc/index.js | 21 + assets/js/main.js | 4 + layouts/api/single.html | 51 +- layouts/partials/header.html | 3 + package.json | 3 +- yarn.lock | 886 +++++++++++++++++++++++++++++- 8 files changed, 1022 insertions(+), 84 deletions(-) create mode 100644 assets/js/api-doc/index.js create mode 100644 assets/js/main.js diff --git a/api-docs/scripts/create-pages.js b/api-docs/scripts/create-pages.js index cccb72cd70..b6d5ec3f78 100644 --- a/api-docs/scripts/create-pages.js +++ b/api-docs/scripts/create-pages.js @@ -6,6 +6,7 @@ const { execSync } = require('child_process'); const path = require('path'); const fs = require('fs'); const yaml = require('js-yaml'); +const { create } = require('domain'); // Calculate the relative paths const DOCS_ROOT = process.env.DOCS_ROOT || '.'; @@ -50,34 +51,95 @@ function getPathGroups(openapi) { return pathGroups; } +const CONFIG = { + apis: [ + { + name: 'cloud-v2', + menu_name: 'influxdb_cloud', + menu: + { + parent: 'INFLUXDB HTTP API', + weight: 0, + }, + // Source OpenAPI spec file + spec_file: path.join(DOCS_ROOT, '/api-docs/cloud/v2/ref.yml'), + // Target content directory for generated endpoint spec pages + // endpoints_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2/yaml'), + // Target content directory for generated .md pages + pages_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2'), + }, + { + name: 'oss-v2', + menu_name: 'influxdb_v2', + menu: + { + parent: 'INFLUXDB HTTP API', + weight: 0, + }, + spec_file: path.join(DOCS_ROOT, '/api-docs/v2/ref.yml'), + // Target content directory for generated endpoint spec pages + // endpoints_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2/yaml'), + // Target content directory for generated .md pages + pages_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2'), + } + ] +} + +function createIndexPage(spec, api) { + + const menu = {...api.menu, name: spec.info.title}; + const pageParams = { + title: spec.info.title, + description: spec.info.description, + menu: {}, + }; + pageParams.menu[api.menu_name] = menu; + + let frontMatter = JSON.stringify(pageParams); + let page = frontMatter.concat('\n\n', spec.info.description, '\n\n', '{{< children >}}', '\n\n'); + + const pagePath = path.join(api.pages_dir, '_index.md'); + fs.writeFileSync(pagePath, page); + console.log(`Created: ${pagePath}`); +} + +function createPathGroupPage(pathGroup, pathSpec, api) { + pathSpec['x-pathGroupTitle'] = `${pathGroup}\n${spec.info.title}`; + pathSpec['x-pathGroup'] = pathGroup; + + const pageParams = { + type: 'api', + title: pathSpec['x-pathGroupTitle'], + description: pathSpec.info.description, + api: { + part_of: api.spec_file, + spec: JSON.stringify(pathSpec), + }, + menu: {}, + } + + const menu = { + parent: spec.info.title, + weight: 1, + name: pathGroup + }; + + pageParams.menu[api.menu_name] = menu; + + let frontMatter = JSON.stringify(pageParams); + + const pageName = `${pathGroup.replaceAll('/', '-').replace(/^-/, '')}`; + const pagePath = path.join(api.pages_dir, `${pageName}.md`); + fs.writeFileSync(pagePath, frontMatter); + console.log(`Created: ${pagePath}`); +} + function main() { /** * Configure the product specs to generate markdown files for. */ - const config = { - dataDir: path.join(DOCS_ROOT, '/data/api/influxdb'), - apis: [ - { - name: 'cloud-v2', - menu: 'influxdb_cloud', - // Source OpenAPI spec file - spec_file: path.join(DOCS_ROOT, '/api-docs/cloud/v2/ref.yml'), - // Target content directory for generated endpoint spec pages - // endpoints_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2/yaml'), - // Target content directory for generated .md pages - pages_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2'), - }, - { - name: 'oss-v2', - menu: 'influxdb_v2', - spec_file: path.join(DOCS_ROOT, '/api-docs/v2/ref.yml'), - // Target content directory for generated endpoint spec pages - // endpoints_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2/yaml'), - // Target content directory for generated .md pages - pages_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2'), - } - ] - } + + let config = CONFIG; config.apis.forEach(api => { // Execute the getswagger.sh script to fetch and bundle the configured spec. @@ -93,35 +155,12 @@ function main() { fs.mkdirSync(api.pages_dir, { recursive: true }); }; + createIndexPage(spec, api); Object.keys(pathGroups).forEach( pathGroup => { // Deep copy the spec object let pathSpec = JSON.parse(JSON.stringify(spec)); pathSpec.paths = pathGroups[pathGroup]; - pathSpec['x-pathGroupTitle'] = `${pathGroup}\n${spec.info.title}`; - pathSpec['x-pathGroup'] = pathGroup; - - const pageParams = { - type: 'api', - title: pathSpec['x-pathGroupTitle'], - description: pathSpec.info.description, - api: { - part_of: api.spec_file, - spec: JSON.stringify(pathSpec), - }, - } - pageParams.menu = {}; - pageParams.menu[api.menu] = { - parent: 'INFLUXDB HTTP API', - weight: 1, - name: pathGroup - }; - - let frontMatter = JSON.stringify(pageParams); - - const pageName = `${pathGroup.replaceAll('/', '-').replace(/^-/, '')}`; - const pagePath = path.join(api.pages_dir, `${pageName}.md`); - fs.writeFileSync(pagePath, frontMatter); - console.log(`Created: ${pagePath}`); + createPathGroupPage(pathGroup, pathSpec, api); }); }); } diff --git a/api-docs/scripts/validate-spec.js b/api-docs/scripts/validate-spec.js index f146c74ee7..b2aeaae837 100644 --- a/api-docs/scripts/validate-spec.js +++ b/api-docs/scripts/validate-spec.js @@ -30,6 +30,7 @@ function validate() { // Create a Spectral ruleset file // Spectral is a flexible JSON/YAML linter, formatter, and style checker for OpenAPI v2, v3.0, v3.1, and AsyncAPI v2.0. + // For rule examples, see https://apistylebook.stoplight.io/docs/stoplight-style-guide/ execCommand(`npx @stoplight/spectral-cli lint ${spec} --ruleset ./api-docs/.spectral.yaml`); // --ruleset myruleset.yaml } diff --git a/assets/js/api-doc/index.js b/assets/js/api-doc/index.js new file mode 100644 index 0000000000..619603070b --- /dev/null +++ b/assets/js/api-doc/index.js @@ -0,0 +1,21 @@ +import 'rapidoc'; + +function getUserPreferredUrl() { + const urlName = window.getPreference && window.getPreference('influxdb_url'); + return getUrls()[urlName] || (window.placeholderUrls && window.placeholderUrls['oss']); +} + +export function apiDocComponent() { + window.addEventListener('DOMContentLoaded', (event) => { + const rapidocEl = document.getElementById('api-doc'); + if(rapidocEl === null) return; + const apiServer = getUserPreferredUrl(); + rapidocEl.addEventListener('spec-loaded', (e) => { + rapidocEl.setApiServer(apiServer); + }); + const spec = JSON.parse(rapidocEl.dataset.openapiSpec); + rapidocEl.loadSpec(spec); + }); +} + +apiDocComponent(); \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000000..1833629e02 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,4 @@ +// assets/js/main.js +import { apiDocComponent } from "./api-doc"; + +export { apiDocComponent }; \ No newline at end of file diff --git a/layouts/api/single.html b/layouts/api/single.html index 9bedf77bbf..cfb50a7cc8 100644 --- a/layouts/api/single.html +++ b/layouts/api/single.html @@ -6,31 +6,32 @@ {{ partial "sidebar.html" . }}
- -

{{ .Params.title }}

- - - +
+ + +
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 58c3b2a63b..d91702dff1 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -26,4 +26,7 @@ + + {{ $mainJs := resources.Get "js/main.js" | js.Build }} + {{ if not hugo.IsServer }}{{ partial "header/google-analytics-body.html" }}{{ end }} diff --git a/package.json b/package.json index d45724aef7..0506f52c6e 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "axios": "^1.7.4", "hugo-data-to-pages": "https://github.com/jstirnaman/hugo-data-to-pages", "hugo-extended": "^0.134.2", - "js-yaml": "^4.1.0" + "js-yaml": "^4.1.0", + "rapidoc": "^9.3.6" }, "scripts": { "lint": "LEFTHOOK_EXCLUDE=test lefthook run pre-commit && lefthook run pre-push", diff --git a/yarn.lock b/yarn.lock index 6d957e1038..12a9580675 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,13 @@ # yarn lockfile v1 +"@apitools/openapi-parser@0.0.32": + version "0.0.32" + resolved "https://registry.yarnpkg.com/@apitools/openapi-parser/-/openapi-parser-0.0.32.tgz#40fe155444eb7c1596de0aaf21f0fa9fc84aba90" + integrity sha512-e0b54P85Xfu8/H0+0xO92z0/tGCVjkyh0EIbb38hWAZOInRDG58e7EzYps4fOJdhhGUiiVuRw5E+9fI6mwnf9w== + dependencies: + swagger-client "^3.19.10" + "@babel/code-frame@^7.0.0": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" @@ -25,6 +32,14 @@ js-tokens "^4.0.0" picocolors "^1.0.0" +"@babel/runtime-corejs3@^7.20.7", "@babel/runtime-corejs3@^7.22.15": + version "7.25.6" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.25.6.tgz#5e3facf42775cc95bcde95746e940061931286e4" + integrity sha512-Gz0Nrobx8szge6kQQ5Z5MX9L3ObqNwCQY1PSwSNzreFL7aHGxv8Fp2j3ETV6/wWdbiV+mW6OSm8oQhg3Tcsniw== + dependencies: + core-js-pure "^3.30.2" + regenerator-runtime "^0.14.0" + "@evilmartians/lefthook@^1.7.1": version "1.7.15" resolved "https://registry.yarnpkg.com/@evilmartians/lefthook/-/lefthook-1.7.15.tgz#7f02e49df8315efec276f82b8d2cfa481a1c42e5" @@ -42,6 +57,18 @@ wrap-ansi "^8.1.0" wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" +"@lit-labs/ssr-dom-shim@^1.2.0": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.1.tgz#2f3a8f1d688935c704dbc89132394a41029acbb8" + integrity sha512-wx4aBmgeGvFmOKucFKY+8VFJSYZxs9poN3SDNQFF6lT6NrQUnHiPB2PWz2sc4ieEcAaYYzN+1uWahEeTq2aRIQ== + +"@lit/reactive-element@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-2.0.4.tgz#8f2ed950a848016383894a26180ff06c56ae001b" + integrity sha512-GFn91inaUa2oHLak8awSIigYz0cU0Payr1rcFsrkf5OJ5eSPxElyZfKh0f2p9FsTiZWXQdWGJeXZICEfXXYSXQ== + dependencies: + "@lit-labs/ssr-dom-shim" "^1.2.0" + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -78,6 +105,400 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz#719df7fb41766bc143369eaa0dd56d8dc87c9958" integrity sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg== +"@swagger-api/apidom-ast@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-ast/-/apidom-ast-1.0.0-alpha.9.tgz#afc49eb08ceb5aa19ba17bdd521ce04dc5a81702" + integrity sha512-SAOQrFSFwgDiI4QSIPDwAIJEb4Za+8bu45sNojgV3RMtCz+n4Agw66iqGsDib5YSI/Cg1h4AKFovT3iWdfGWfw== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-error" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + unraw "^3.0.0" + +"@swagger-api/apidom-core@>=1.0.0-alpha.9 <1.0.0-beta.0", "@swagger-api/apidom-core@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-core/-/apidom-core-1.0.0-alpha.9.tgz#53d5b52c502c64fe0136f261e6ca2b690bdd3bbc" + integrity sha512-vGl8BWRf6ODl39fxElcIOjRE2QG5AJhn8tTNMqjjHB/2WppNBuxOVStYZeVJoWfK03OPK8v4Fp/TAcaP9+R7DQ== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-ast" "^1.0.0-alpha.9" + "@swagger-api/apidom-error" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + minim "~0.23.8" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + short-unique-id "^5.0.2" + ts-mixer "^6.0.3" + +"@swagger-api/apidom-error@>=1.0.0-alpha.9 <1.0.0-beta.0", "@swagger-api/apidom-error@^1.0.0-alpha.1", "@swagger-api/apidom-error@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-error/-/apidom-error-1.0.0-alpha.9.tgz#67682beaaf24ef2405749e1213895030697ebf08" + integrity sha512-FU/2sFSgsICB9HYFELJ79caRpXXzlAV41QTHsAM46WfRehbzZUQpOBQm4jRi3qJGSa/Jk+mQ7Vt8HLRFMpJFfg== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + +"@swagger-api/apidom-json-pointer@>=1.0.0-alpha.9 <1.0.0-beta.0", "@swagger-api/apidom-json-pointer@^1.0.0-alpha.1", "@swagger-api/apidom-json-pointer@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-json-pointer/-/apidom-json-pointer-1.0.0-alpha.9.tgz#7f1d1c9eb54481a07fa243c50465e2370f1ea257" + integrity sha512-/W8Ktbgbs29zdhed6KHTFk0qmuIRbvEFi8wu2MHGQ5UT4i99Bdu2OyUiayhnpejWztfQxDgL08pjrQPEwgY8Yg== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-error" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-ns-api-design-systems@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-ns-api-design-systems/-/apidom-ns-api-design-systems-1.0.0-alpha.9.tgz#e547ae2041fecf9f734efcf649b5b0dbe67a001e" + integrity sha512-aduC2vbwGgn6ia9IkKpqBYBaKyIDGM/80M3oU3DFgaYIIwynzuwVpN1TkBOLIFy3mAzkWoYKUS0jdZJhMy/6Ug== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-error" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-openapi-3-1" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + ts-mixer "^6.0.3" + +"@swagger-api/apidom-ns-asyncapi-2@^1.0.0-alpha.1", "@swagger-api/apidom-ns-asyncapi-2@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-ns-asyncapi-2/-/apidom-ns-asyncapi-2-1.0.0-alpha.9.tgz#46eb7897ab522f42c2b413a85f3636dda8bd114b" + integrity sha512-hZjxXJgMt517ADnAauWJh01k7WNRwkbWT5p6b7AXF2H3tl549A2hhLnIg3BBSE3GwB3Nv25GyrI3aA/1dFVC8A== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-json-schema-draft-7" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + ts-mixer "^6.0.3" + +"@swagger-api/apidom-ns-json-schema-draft-4@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-ns-json-schema-draft-4/-/apidom-ns-json-schema-draft-4-1.0.0-alpha.9.tgz#9f1fbca6118c36c4c66a66669e2499760c148fad" + integrity sha512-OfX4UBb08C0xD5+F80dQAM2yt5lXxcURWkVEeCwxz7i23BB3nNEbnZXNV91Qo9eaJflPh8dO9iiHQxvfw5IgSg== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-ast" "^1.0.0-alpha.9" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + ts-mixer "^6.0.4" + +"@swagger-api/apidom-ns-json-schema-draft-6@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-ns-json-schema-draft-6/-/apidom-ns-json-schema-draft-6-1.0.0-alpha.9.tgz#0eba545df2d7738ade2c911a06c47ad94d8b89fc" + integrity sha512-qzUVRSSrnlYGMhK6w57o/RboNvy1FO0iFgEnTk56dD4wN49JRNuFqKI18IgXc1W2r9tTTG70nG1khe4cPE8TNg== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-error" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-json-schema-draft-4" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + ts-mixer "^6.0.4" + +"@swagger-api/apidom-ns-json-schema-draft-7@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-ns-json-schema-draft-7/-/apidom-ns-json-schema-draft-7-1.0.0-alpha.9.tgz#2582bb8a57601e31815062b59e0130e4dedfed85" + integrity sha512-Zml8Z8VCckdFjvTogaec1dabd85hg1+xZDseWcCuD0tYkaTY/sZ8zzI0dz6/4HsKCb58qjiWSa0w60N8Syr6WQ== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-error" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-json-schema-draft-6" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + ts-mixer "^6.0.4" + +"@swagger-api/apidom-ns-openapi-2@^1.0.0-alpha.1", "@swagger-api/apidom-ns-openapi-2@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-ns-openapi-2/-/apidom-ns-openapi-2-1.0.0-alpha.9.tgz#a244f5321c37a188a55a65f62f9a17ff34db9d6d" + integrity sha512-WUZxt7Gs7P4EQsGtoD6cKAjf0uDJhkUxsIW9Bb4EAgO6tdp7LlXhbJ0fJ2QycCLY717SfJbvGLfhuSfTYo4Iow== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-error" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-json-schema-draft-4" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + ts-mixer "^6.0.3" + +"@swagger-api/apidom-ns-openapi-3-0@^1.0.0-alpha.1", "@swagger-api/apidom-ns-openapi-3-0@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-ns-openapi-3-0/-/apidom-ns-openapi-3-0-1.0.0-alpha.9.tgz#27e543b9b89afb91bb4b5d746aa02ff577c492f0" + integrity sha512-7ra5uoZGrfCn1LabfJLueChPcYXyg24//LCYBtjTstyueqd5Vp7JCPeP5NnJSAaqVAP47r8ygceBPoxNp9k1EQ== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-error" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-json-schema-draft-4" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + ts-mixer "^6.0.3" + +"@swagger-api/apidom-ns-openapi-3-1@>=1.0.0-alpha.9 <1.0.0-beta.0", "@swagger-api/apidom-ns-openapi-3-1@^1.0.0-alpha.1", "@swagger-api/apidom-ns-openapi-3-1@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-ns-openapi-3-1/-/apidom-ns-openapi-3-1-1.0.0-alpha.9.tgz#a0f7b46558bc72766aca0d67b583a5c5deeb0cd5" + integrity sha512-nQOwNQgf0C8EVjf2loAAl4ifRuVOdcqycvXUdcTpsUfHN3fbndR8IKpb26mQNmnACmqgmX+LkbMdW9b+K6089g== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-ast" "^1.0.0-alpha.9" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-json-pointer" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-openapi-3-0" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + ts-mixer "^6.0.3" + +"@swagger-api/apidom-ns-workflows-1@^1.0.0-alpha.1", "@swagger-api/apidom-ns-workflows-1@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-ns-workflows-1/-/apidom-ns-workflows-1-1.0.0-alpha.9.tgz#4f8fd3c4bbd9db0f86f91755b6c619577173d03a" + integrity sha512-yKo0p8OkQmDib93Kt1yqWmI7JsD6D9qUHxr/SCuAmNNWny1hxm7cZGoKJwJlGd0uAg84j4vmzWOlG3AsJbnT8g== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-openapi-3-1" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + ts-mixer "^6.0.3" + +"@swagger-api/apidom-parser-adapter-api-design-systems-json@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-api-design-systems-json/-/apidom-parser-adapter-api-design-systems-json-1.0.0-alpha.9.tgz#0a55f4426079fa9bbe380012e782f8c29bfdafcd" + integrity sha512-xfVMR4HrTzXU0HB4TtxwkNbUIa/cQrPa0BWutJZ0fMYMAtUox2s8GsFYnJfZP52XfpSHFM1VPclivorZqET14g== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-api-design-systems" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-json" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-api-design-systems-yaml@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-api-design-systems-yaml/-/apidom-parser-adapter-api-design-systems-yaml-1.0.0-alpha.9.tgz#233ff62208989f50a09bba8b80238c3832d2bc41" + integrity sha512-lJZkrhZ8qRTtc5fSLKefCv8j7Xzo8UBfMjpqTJhmETAtU8YfVV2i2znjgxJpm0QwV6FVQqGfK1+ASZQWPLiVcA== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-api-design-systems" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-yaml-1-2" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-asyncapi-json-2@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-asyncapi-json-2/-/apidom-parser-adapter-asyncapi-json-2-1.0.0-alpha.9.tgz#04ca85105b1d151cb585126f7a422522db45357d" + integrity sha512-65nmKdPzw4C1bmtYn+3zoxXCI6Gnobr0StI9XE0YWiK+lpso7RH3Cgyl1yPZ0DBRVGzP+Fn9FVzmDNulEfR95w== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-asyncapi-2" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-json" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-asyncapi-yaml-2@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-asyncapi-yaml-2/-/apidom-parser-adapter-asyncapi-yaml-2-1.0.0-alpha.9.tgz#e06f5541904893d916ecb06035ece1ad427f7ede" + integrity sha512-RLI4FpVB3vB6mIuT77yrsv5V2LMZ80dW9XpV+Fmbd4Jkdj+ysAFwT38cI4AsUMOxixpTDIXY1oWD7AjvylHhQQ== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-asyncapi-2" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-yaml-1-2" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-json@^1.0.0-alpha.1", "@swagger-api/apidom-parser-adapter-json@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-json/-/apidom-parser-adapter-json-1.0.0-alpha.9.tgz#9bba81a21529dd568f8505ea77ddf4c6073dbc86" + integrity sha512-aOewp8/3zobf/O+5Jx8y7+bX3BPRfRlHIv15qp4YVTsLs6gLISWSzTO9JpWe9cR+AfhpsAalFq4t1LwIkmLk4A== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-ast" "^1.0.0-alpha.9" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-error" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + tree-sitter "=0.20.4" + tree-sitter-json "=0.20.2" + web-tree-sitter "=0.20.3" + +"@swagger-api/apidom-parser-adapter-openapi-json-2@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-openapi-json-2/-/apidom-parser-adapter-openapi-json-2-1.0.0-alpha.9.tgz#97093d6e6900e609cbe39f89f080d8d9996ec1cb" + integrity sha512-zgtsAfkplCFusX2P/saqdn10J8P3kQizCXxHLvxd2j0EhMJk2wfu4HYN5Pej/7/qf/OR1QZxqtacwebd4RfpXA== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-openapi-2" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-json" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-openapi-json-3-0@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-openapi-json-3-0/-/apidom-parser-adapter-openapi-json-3-0-1.0.0-alpha.9.tgz#5f6c6b2256c198f5a516cd70b64e8f88c51c8acd" + integrity sha512-iPuHf0cAZSUhSv8mB0FnVgatTc26cVYohgqz2cvjoGofdqoh5KKIfxOkWlIhm+qGuBp71CfZUrPYPRsd0dHgeg== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-openapi-3-0" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-json" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-openapi-json-3-1@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-openapi-json-3-1/-/apidom-parser-adapter-openapi-json-3-1-1.0.0-alpha.9.tgz#d85d569b1377b2b2fc4a5f377edc75bc2b591da9" + integrity sha512-jwkfO7tzZyyrAgok+O9fKFOv1q/5njMb9DBc3D/ZF3ZLTcnEw8uj4V2HkjKxUweH5k8ip/gc8ueKmO/i7p2fng== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-openapi-3-1" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-json" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-openapi-yaml-2@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-openapi-yaml-2/-/apidom-parser-adapter-openapi-yaml-2-1.0.0-alpha.9.tgz#2e639c1ed89cbdf757e661fd6eaa5086532f3f92" + integrity sha512-jEIDpjbjwFKXQXS/RHJeA4tthsguLoz+nJPYS3AOLfuSiby5QXsKTxgqHXxG/YJqF1xJbZL+5KcF8UyiDePumw== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-openapi-2" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-yaml-1-2" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-openapi-yaml-3-0@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-openapi-yaml-3-0/-/apidom-parser-adapter-openapi-yaml-3-0-1.0.0-alpha.9.tgz#b6a6859d97424fc0a80f3b17c1eaff78e42fc73b" + integrity sha512-ieJL8dfIF8fmP3uJRNh/duJa3cCIIv6MzUe6o4uPT/oTDroy4qIATvnq9Dq/gtAv6rcPRpA9VhyghJ1DmjKsZQ== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-openapi-3-0" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-yaml-1-2" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-openapi-yaml-3-1@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-openapi-yaml-3-1/-/apidom-parser-adapter-openapi-yaml-3-1-1.0.0-alpha.9.tgz#3bbe447a24955a59088157cf2846969efb141a39" + integrity sha512-EatIH7PZQSNDsRn9ompc62MYzboY7wAkjfYz+2FzBaSA8Vl5/+740qGQj22tu/xhwW4K72aV2NNL1m47QVF7hA== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-openapi-3-1" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-yaml-1-2" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-workflows-json-1@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-workflows-json-1/-/apidom-parser-adapter-workflows-json-1-1.0.0-alpha.9.tgz#d449fa46eac45c27adc70dd0384861de46ab8a50" + integrity sha512-LylC2cQdAmvR7bXqwMwBt6FHTMVGinwIdI8pjl4EbPT9hCVm1rdED53caTYM4gCm+CJGRw20r4gb9vn3+N6RrA== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-workflows-1" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-json" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-workflows-yaml-1@^1.0.0-alpha.1": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-workflows-yaml-1/-/apidom-parser-adapter-workflows-yaml-1-1.0.0-alpha.9.tgz#98e68267e0e148cf1bda2b25e04c4d5a68e71e22" + integrity sha512-TlA4+1ca33D7fWxO5jKBytSCv86IGI4Lze4JfrawWUXZ5efhi4LiNmW5TrGlZUyvL7yJtZcA4tn3betlj6jVwA== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-ns-workflows-1" "^1.0.0-alpha.9" + "@swagger-api/apidom-parser-adapter-yaml-1-2" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + +"@swagger-api/apidom-parser-adapter-yaml-1-2@^1.0.0-alpha.1", "@swagger-api/apidom-parser-adapter-yaml-1-2@^1.0.0-alpha.9": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-parser-adapter-yaml-1-2/-/apidom-parser-adapter-yaml-1-2-1.0.0-alpha.9.tgz#99d5d1ec802dcbf052a4fd377fcd31866c6544d0" + integrity sha512-jSIHEB7lbh+MP3BhYIXFkeivDR01kugXN70e5FskW7oet2TIARsVEPheWKQFSP1U8bUZA4bsp9h9gOQ9xEeErw== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-ast" "^1.0.0-alpha.9" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@swagger-api/apidom-error" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + tree-sitter "=0.20.4" + tree-sitter-yaml "=0.5.0" + web-tree-sitter "=0.20.3" + +"@swagger-api/apidom-reference@>=1.0.0-alpha.9 <1.0.0-beta.0": + version "1.0.0-alpha.9" + resolved "https://registry.yarnpkg.com/@swagger-api/apidom-reference/-/apidom-reference-1.0.0-alpha.9.tgz#a2f940b8aab7660825c23eeb5976e095246362e4" + integrity sha512-KQ6wB5KplqdSsjxdA8BaQulj5zlF5VBCd5KP3RN/9vvixgsD/gyrVY59nisdzmPTqiL6yjhk612eQ96MgG8KiA== + dependencies: + "@babel/runtime-corejs3" "^7.20.7" + "@swagger-api/apidom-core" "^1.0.0-alpha.9" + "@types/ramda" "~0.30.0" + axios "^1.4.0" + minimatch "^7.4.3" + process "^0.11.10" + ramda "~0.30.0" + ramda-adjunct "^5.0.0" + optionalDependencies: + "@swagger-api/apidom-error" "^1.0.0-alpha.1" + "@swagger-api/apidom-json-pointer" "^1.0.0-alpha.1" + "@swagger-api/apidom-ns-asyncapi-2" "^1.0.0-alpha.1" + "@swagger-api/apidom-ns-openapi-2" "^1.0.0-alpha.1" + "@swagger-api/apidom-ns-openapi-3-0" "^1.0.0-alpha.1" + "@swagger-api/apidom-ns-openapi-3-1" "^1.0.0-alpha.1" + "@swagger-api/apidom-ns-workflows-1" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-api-design-systems-json" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-api-design-systems-yaml" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-asyncapi-json-2" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-asyncapi-yaml-2" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-json" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-openapi-json-2" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-openapi-json-3-0" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-openapi-json-3-1" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-openapi-yaml-2" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-openapi-yaml-3-0" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-openapi-yaml-3-1" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-workflows-json-1" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-workflows-yaml-1" "^1.0.0-alpha.1" + "@swagger-api/apidom-parser-adapter-yaml-1-2" "^1.0.0-alpha.1" + "@szmarczak/http-timer@^5.0.1": version "5.0.1" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" @@ -95,6 +516,18 @@ resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901" integrity sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA== +"@types/ramda@~0.30.0": + version "0.30.2" + resolved "https://registry.yarnpkg.com/@types/ramda/-/ramda-0.30.2.tgz#70661b20c1bb969589a551b7134ae75008ffbfb6" + integrity sha512-PyzHvjCalm2BRYjAU6nIB3TprYwMNOUY/7P/N8bSzp9W/yM2YrtGtAnnVtaCNSeOZ8DzKyFDvaqQs7LnWwwmBA== + dependencies: + types-ramda "^0.30.1" + +"@types/trusted-types@^2.0.2": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.7.tgz#baccb07a970b91707df3a3e8ba6896c57ead2d11" + integrity sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw== + "@vvago/vale@^3.4.2": version "3.7.1" resolved "https://registry.yarnpkg.com/@vvago/vale/-/vale-3.7.1.tgz#64922ffee325eef02291774358f189abfc5cc36e" @@ -147,6 +580,11 @@ anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" +apg-lite@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/apg-lite/-/apg-lite-1.0.4.tgz#d517a8d775659603cb0c70843355954b73e88cc7" + integrity sha512-B32zCN3IdHIc99Vy7V9BaYTUzLeRA8YXYY1aQD1/5I2aqIrO0coi4t6hJPqMisidlBxhyME8UexkHt31SlR6Og== + argparse@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" @@ -183,6 +621,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base64-arraybuffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz#1c37589a7c4b0746e34bd1feb951da2df01c1bdc" + integrity sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ== + base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" @@ -214,6 +657,15 @@ bl@^1.0.0: readable-stream "^2.3.5" safe-buffer "^5.1.1" +bl@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" + integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== + dependencies: + buffer "^5.5.0" + inherits "^2.0.4" + readable-stream "^3.4.0" + bluebird@~3.4.1: version "3.4.7" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3" @@ -279,7 +731,7 @@ buffer-indexof-polyfill@~1.0.0: resolved "https://registry.yarnpkg.com/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz#d2732135c5999c64b277fcf9b1abe3498254729c" integrity sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A== -buffer@^5.2.1: +buffer@^5.2.1, buffer@^5.5.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -287,6 +739,14 @@ buffer@^5.2.1: base64-js "^1.3.1" ieee754 "^1.1.13" +buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + buffers@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb" @@ -368,6 +828,11 @@ chokidar@^3.3.0: optionalDependencies: fsevents "~2.3.2" +chownr@^1.1.1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" + integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== + chownr@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" @@ -432,6 +897,16 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +cookie@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" + integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== + +core-js-pure@^3.30.2: + version "3.38.1" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.38.1.tgz#e8534062a54b7221344884ba9b52474be495ada3" + integrity sha512-BY8Etc1FZqdw1glX0XNOq2FDwfrg/VGqoZOZCdaL+UmdaqDwQwYXkMJT4t6In+zfEfOJDcM9T0KdbBeJg8KKCQ== + core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" @@ -525,6 +1000,16 @@ decompress@^4.2.1: pify "^2.3.0" strip-dirs "^2.0.0" +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +deepmerge@~4.3.0: + version "4.3.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== + defer-to-connect@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" @@ -540,11 +1025,21 @@ dependency-graph@^0.11.0: resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.11.0.tgz#ac0ce7ed68a54da22165a85e97a01d53f5eb2e27" integrity sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg== +detect-libc@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" + integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== + discontinuous-range@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/discontinuous-range/-/discontinuous-range-1.0.0.tgz#e38331f0844bba49b9a9cb71c771585aab1bc65a" integrity sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ== +drange@^1.0.2: + version "1.1.1" + resolved "https://registry.yarnpkg.com/drange/-/drange-1.1.1.tgz#b2aecec2aab82fcef11dbbd7b9e32b83f8f6c0b8" + integrity sha512-pYxfDYpued//QpnLIm4Avk7rsNtAtQkUES2cwAYSvD/wd2pKD71gN2Ebj3e7klzXwjocvE8c5vx/1fxwpqmSxA== + duplexer2@~0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" @@ -577,7 +1072,7 @@ emoji-regex@^9.2.2: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== -end-of-stream@^1.0.0: +end-of-stream@^1.0.0, end-of-stream@^1.1.0, end-of-stream@^1.4.1: version "1.4.4" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== @@ -601,6 +1096,11 @@ escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== +expand-template@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" + integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== + fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" @@ -612,6 +1112,11 @@ fast-glob@^3.3.2: merge2 "^1.3.0" micromatch "^4.0.4" +fast-json-patch@^3.0.0-1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-json-patch/-/fast-json-patch-3.1.1.tgz#85064ea1b1ebf97a3f7ad01e23f9337e72c66947" + integrity sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ== + fastq@^1.6.0: version "1.17.1" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" @@ -778,6 +1283,11 @@ get-stream@^6.0.1: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== +github-from-package@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" + integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw== + glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" @@ -894,7 +1404,7 @@ hugo-extended@^0.134.2: log-symbols "^5.1.0" read-pkg-up "^9.1.0" -ieee754@^1.1.13: +ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -912,11 +1422,16 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@~2.0.0, inherits@~2.0.3: +inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.0, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +ini@~1.3.0: + version "1.3.8" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -1077,6 +1592,31 @@ listenercount@~1.0.1: resolved "https://registry.yarnpkg.com/listenercount/-/listenercount-1.0.1.tgz#84c8a72ab59c4725321480c975e6508342e70937" integrity sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ== +lit-element@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-4.1.0.tgz#cea3eb25f15091e3fade07c4d917fa6aaf56ba7d" + integrity sha512-gSejRUQJuMQjV2Z59KAS/D4iElUhwKpIyJvZ9w+DIagIQjfJnhR20h2Q5ddpzXGS+fF0tMZ/xEYGMnKmaI/iww== + dependencies: + "@lit-labs/ssr-dom-shim" "^1.2.0" + "@lit/reactive-element" "^2.0.4" + lit-html "^3.2.0" + +lit-html@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-3.2.0.tgz#cb09071a8a1f5f0850873f9143f18f0260be1fda" + integrity sha512-pwT/HwoxqI9FggTrYVarkBKFN9MlTUpLrDHubTmW4SrkL3kkqW5gxwbxMMUnbbRHBC0WTZnYHcjDSCM559VyfA== + dependencies: + "@types/trusted-types" "^2.0.2" + +lit@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lit/-/lit-3.2.0.tgz#2189d72bccbc335f733a67bfbbd295f015e68e05" + integrity sha512-s6tI33Lf6VpDu7u4YqsSX78D28bYQulM+VAzsGch4fx2H0eLZnJsUBsPWmGYSGoKDNbjtRv02rio1o+UdPVwvw== + dependencies: + "@lit/reactive-element" "^2.0.4" + lit-element "^4.1.0" + lit-html "^3.2.0" + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -1092,6 +1632,11 @@ locate-path@^7.1.0: dependencies: p-locate "^6.0.0" +lodash@^4.15.0: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + log-symbols@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-5.1.0.tgz#a20e3b9a5f53fac6aeb8e2bb22c07cf2c8f16d93" @@ -1124,6 +1669,11 @@ make-dir@^1.0.0: dependencies: pify "^3.0.0" +marked@4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3" + integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A== + merge2@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" @@ -1159,6 +1709,13 @@ mimic-response@^4.0.0: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-4.0.0.tgz#35468b19e7c75d10f5165ea25e75a5ceea7cf70f" integrity sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg== +minim@~0.23.8: + version "0.23.8" + resolved "https://registry.yarnpkg.com/minim/-/minim-0.23.8.tgz#a529837afe1654f119dfb68ce7487dd8d4866b9c" + integrity sha512-bjdr2xW1dBCMsMGGsUeqM4eFI60m94+szhxWys+B1ztIt6gWSfeGBdSVCIawezeHYLYn0j6zrsXdQS/JllBzww== + dependencies: + lodash "^4.15.0" + minimatch@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -1166,6 +1723,13 @@ minimatch@^3.1.1: dependencies: brace-expansion "^1.1.7" +minimatch@^7.4.3: + version "7.4.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.6.tgz#845d6f254d8f4a5e4fd6baf44d5f10c8448365fb" + integrity sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw== + dependencies: + brace-expansion "^2.0.1" + minimatch@^9.0.4: version "9.0.5" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" @@ -1173,7 +1737,7 @@ minimatch@^9.0.4: dependencies: brace-expansion "^2.0.1" -minimist@^1.2.6: +minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.6: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -1203,6 +1767,11 @@ minizlib@^2.1.1: minipass "^3.0.0" yallist "^4.0.0" +mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" + integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== + "mkdirp@>=0.5 0": version "0.5.6" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" @@ -1225,11 +1794,21 @@ ms@^2.1.3: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +nan@^2.14.0, nan@^2.17.0, nan@^2.18.0: + version "2.20.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.20.0.tgz#08c5ea813dd54ed16e5bd6505bf42af4f7838ca3" + integrity sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw== + nanoid@^3.3.7: version "3.3.7" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== +napi-build-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806" + integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg== + nearley@^2.20.1: version "2.20.1" resolved "https://registry.yarnpkg.com/nearley/-/nearley-2.20.1.tgz#246cd33eff0d012faf197ff6774d7ac78acdd474" @@ -1240,6 +1819,36 @@ nearley@^2.20.1: railroad-diagrams "^1.0.0" randexp "0.4.6" +neotraverse@=0.6.18: + version "0.6.18" + resolved "https://registry.yarnpkg.com/neotraverse/-/neotraverse-0.6.18.tgz#abcb33dda2e8e713cf6321b29405e822230cdb30" + integrity sha512-Z4SmBUweYa09+o6pG+eASabEpP6QkQ70yHj351pQoEXIs8uHbaU2DWVmzBANKgflPa47A50PtB2+NgRpQvr7vA== + +node-abi@^3.3.0: + version "3.68.0" + resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.68.0.tgz#8f37fb02ecf4f43ebe694090dcb52e0c4cc4ba25" + integrity sha512-7vbj10trelExNjFSBm5kTvZXXa7pZyKWx9RCKIyqe6I9Ev3IzGpQoqBP3a+cOdxY+pWj6VkP28n/2wWysBHD/A== + dependencies: + semver "^7.3.5" + +node-abort-controller@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548" + integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== + +node-domexception@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== + +node-fetch-commonjs@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/node-fetch-commonjs/-/node-fetch-commonjs-3.3.2.tgz#0dd0fd4c4a314c5234f496ff7b5d9ce5a6c8feaa" + integrity sha512-VBlAiynj3VMLrotgwOS3OyECFxas5y7ltLcK4t41lMUZeaK15Ym4QRkqN0EQKAFL42q9i21EPKjzLUPfltR72A== + dependencies: + node-domexception "^1.0.0" + web-streams-polyfill "^3.0.3" + node-releases@^2.0.18: version "2.0.18" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" @@ -1282,13 +1891,27 @@ object-assign@^4.0.1: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== -once@^1.3.0, once@^1.4.0: +once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== dependencies: wrappy "1" +openapi-path-templating@^1.5.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/openapi-path-templating/-/openapi-path-templating-1.6.0.tgz#c81f182db71de88890cb497faa367c9b900dd6c5" + integrity sha512-1atBNwOUrZXthTvlvvX8k8ovFEF3iA8mDidYMkdOtvVdndBhTrspbwGXNOzEUaJhm9iUl4Tf5uQaeTLAJvwPig== + dependencies: + apg-lite "^1.0.3" + +openapi-server-url-templating@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/openapi-server-url-templating/-/openapi-server-url-templating-1.1.0.tgz#cae9c36d12feeec6af158a6c42e46205db125be6" + integrity sha512-dtyTFKx2xVcO0W8JKaluXIHC9l/MLjHeflBaWjiWNMCHp/TBs9dEjQDbj/VFlHR4omFOKjjmqm1pW1aCAhmPBg== + dependencies: + apg-lite "^1.0.3" + p-cancelable@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" @@ -1460,6 +2083,24 @@ postcss@>=8.4.31: picocolors "^1.1.0" source-map-js "^1.2.1" +prebuild-install@^7.1.1: + version "7.1.2" + resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.2.tgz#a5fd9986f5a6251fbc47e1e5c65de71e68c0a056" + integrity sha512-UnNke3IQb6sgarcZIDU3gbMeTp/9SSU1DAIkil7PrqG1vZlBtY5msYccSKSHDqa3hNg436IXK+SNImReuA1wEQ== + dependencies: + detect-libc "^2.0.0" + expand-template "^2.0.3" + github-from-package "0.0.0" + minimist "^1.2.3" + mkdirp-classic "^0.5.3" + napi-build-utils "^1.0.1" + node-abi "^3.3.0" + pump "^3.0.0" + rc "^1.2.7" + simple-get "^4.0.0" + tar-fs "^2.0.0" + tunnel-agent "^0.6.0" + prettier-plugin-sql@^0.18.0: version "0.18.1" resolved "https://registry.yarnpkg.com/prettier-plugin-sql/-/prettier-plugin-sql-0.18.1.tgz#037c6a55ee6c78f80df42041f8f53340651fc7d8" @@ -1480,11 +2121,21 @@ pretty-hrtime@^1.0.3: resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" integrity sha512-66hKPCr+72mlfiSjlEB1+45IjXSqvVAIy6mocupoww4tBFE9R9IhwwUGoI4G++Tc9Aq+2rxOt0RFU6gPcrte0A== +prismjs@^1.29.0: + version "1.29.0" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12" + integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q== + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + prompts@^2.4.1: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -1498,6 +2149,14 @@ proxy-from-env@^1.1.0: resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== +pump@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.2.tgz#836f3edd6bc2ee599256c924ffe0d88573ddcbf8" + integrity sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -1513,6 +2172,16 @@ railroad-diagrams@^1.0.0: resolved "https://registry.yarnpkg.com/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz#eb7e6267548ddedfb899c1b90e57374559cddb7e" integrity sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A== +ramda-adjunct@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/ramda-adjunct/-/ramda-adjunct-5.1.0.tgz#c1281100922b03e74b1535cb9c966628697c5cc1" + integrity sha512-8qCpl2vZBXEJyNbi4zqcgdfHtcdsWjOGbiNSEnEBrM6Y0OKOT8UxJbIVGm1TIcjaSu2MxaWcgtsNlKlCk7o7qg== + +ramda@^0.30.1, ramda@~0.30.0: + version "0.30.1" + resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.30.1.tgz#7108ac95673062b060025052cd5143ae8fc605bf" + integrity sha512-tEF5I22zJnuclswcZMc8bDIrwRHRzf+NqVEmqg50ShAZMP7MWeR/RGDthfM/p+BlqvF2fXAzpn8i+SJcYD3alw== + randexp@0.4.6: version "0.4.6" resolved "https://registry.yarnpkg.com/randexp/-/randexp-0.4.6.tgz#e986ad5e5e31dae13ddd6f7b3019aa7c87f60ca3" @@ -1521,6 +2190,38 @@ randexp@0.4.6: discontinuous-range "1.0.0" ret "~0.1.10" +randexp@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/randexp/-/randexp-0.5.3.tgz#f31c2de3148b30bdeb84b7c3f59b0ebb9fec3738" + integrity sha512-U+5l2KrcMNOUPYvazA3h5ekF80FHTUG+87SEAmHZmolh1M+i/WyTCxVzmi+tidIa1tM4BSe8g2Y/D3loWDjj+w== + dependencies: + drange "^1.0.2" + ret "^0.2.0" + +rapidoc@^9.3.6: + version "9.3.6" + resolved "https://registry.yarnpkg.com/rapidoc/-/rapidoc-9.3.6.tgz#8839db3b29b32005f5c10898d1b3e477421c908f" + integrity sha512-mTnSp5xk9cW205zCd5mE3tBeWbWMo+oFh1tHzONfIdyW3euY231vrt8otQI3Ed6FokhrxKp8/8pQAITyb6Tn5Q== + dependencies: + "@apitools/openapi-parser" "0.0.32" + base64-arraybuffer "^1.0.2" + buffer "^6.0.3" + lit "^3.2.0" + marked "4.3.0" + prismjs "^1.29.0" + randexp "^0.5.3" + xml-but-prettier "^1.0.1" + +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + read-cache@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774" @@ -1560,6 +2261,15 @@ readable-stream@^2.0.2, readable-stream@^2.3.0, readable-stream@^2.3.5, readable string_decoder "~1.1.1" util-deprecate "~1.0.1" +readable-stream@^3.1.1, readable-stream@^3.4.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -1567,6 +2277,16 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" +regenerator-runtime@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" + integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== + +repeat-string@^1.5.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -1589,6 +2309,11 @@ responselike@^3.0.0: dependencies: lowercase-keys "^3.0.0" +ret@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.2.2.tgz#b6861782a1f4762dce43402a71eb7a283f44573c" + integrity sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ== + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" @@ -1620,7 +2345,7 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -safe-buffer@^5.1.1: +safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -1637,7 +2362,7 @@ seek-bzip@^1.0.5: dependencies: commander "^2.8.1" -semver@^7.3.4: +semver@^7.3.4, semver@^7.3.5: version "7.6.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== @@ -1664,11 +2389,30 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +short-unique-id@^5.0.2: + version "5.2.0" + resolved "https://registry.yarnpkg.com/short-unique-id/-/short-unique-id-5.2.0.tgz#a7e0668e0a8998d3151f27a36cf046055b1f270b" + integrity sha512-cMGfwNyfDZ/nzJ2k2M+ClthBIh//GlZl1JEf47Uoa9XR11bz8Pa2T2wQO4bVrRdH48LrIDWJahQziKo3MjhsWg== + signal-exit@^4.0.1: version "4.1.0" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== +simple-concat@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" + integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== + +simple-get@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-4.0.1.tgz#4a39db549287c979d352112fa03fd99fd6bc3543" + integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA== + dependencies: + decompress-response "^6.0.0" + once "^1.3.1" + simple-concat "^1.0.0" + sisteransi@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" @@ -1755,6 +2499,13 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -1797,6 +2548,11 @@ strip-dirs@^2.0.0: dependencies: is-natural-number "^4.0.1" +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -1804,6 +2560,39 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" +swagger-client@^3.19.10: + version "3.29.3" + resolved "https://registry.yarnpkg.com/swagger-client/-/swagger-client-3.29.3.tgz#23175176372d78e8b34d057fbf7b0f7534034641" + integrity sha512-OhhMAO2dwDEaxtUNDxwaqzw75uiZY5lX/2vx+U6eKCYZYhXWQ5mylU/0qfk/xMR20VyitsnzRc6KcFFjRoCS7A== + dependencies: + "@babel/runtime-corejs3" "^7.22.15" + "@swagger-api/apidom-core" ">=1.0.0-alpha.9 <1.0.0-beta.0" + "@swagger-api/apidom-error" ">=1.0.0-alpha.9 <1.0.0-beta.0" + "@swagger-api/apidom-json-pointer" ">=1.0.0-alpha.9 <1.0.0-beta.0" + "@swagger-api/apidom-ns-openapi-3-1" ">=1.0.0-alpha.9 <1.0.0-beta.0" + "@swagger-api/apidom-reference" ">=1.0.0-alpha.9 <1.0.0-beta.0" + cookie "~0.6.0" + deepmerge "~4.3.0" + fast-json-patch "^3.0.0-1" + js-yaml "^4.1.0" + neotraverse "=0.6.18" + node-abort-controller "^3.1.1" + node-fetch-commonjs "^3.3.2" + openapi-path-templating "^1.5.1" + openapi-server-url-templating "^1.0.0" + ramda "^0.30.1" + ramda-adjunct "^5.0.0" + +tar-fs@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784" + integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== + dependencies: + chownr "^1.1.1" + mkdirp-classic "^0.5.2" + pump "^3.0.0" + tar-stream "^2.1.4" + tar-stream@^1.5.2: version "1.6.2" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555" @@ -1817,6 +2606,17 @@ tar-stream@^1.5.2: to-buffer "^1.1.1" xtend "^4.0.0" +tar-stream@^2.1.4: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" + integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== + dependencies: + bl "^4.0.3" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + tar@^6.1.15: version "6.2.1" resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a" @@ -1876,11 +2676,50 @@ toml@^3.0.0: resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9" integrity sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ== +tree-sitter-json@=0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/tree-sitter-json/-/tree-sitter-json-0.20.2.tgz#8909ffb7149120daa72f9cadb63e8a214f1e5aba" + integrity sha512-eUxrowp4F1QEGk/i7Sa+Xl8Crlfp7J0AXxX1QdJEQKQYMWhgMbCIgyQvpO3Q0P9oyTrNQxRLlRipDS44a8EtRw== + dependencies: + nan "^2.18.0" + +tree-sitter-yaml@=0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/tree-sitter-yaml/-/tree-sitter-yaml-0.5.0.tgz#c617ba72837399d8105ec10cdb4c360e1ed76076" + integrity sha512-POJ4ZNXXSWIG/W4Rjuyg36MkUD4d769YRUGKRqN+sVaj/VCo6Dh6Pkssn1Rtewd5kybx+jT1BWMyWN0CijXnMA== + dependencies: + nan "^2.14.0" + +tree-sitter@=0.20.4: + version "0.20.4" + resolved "https://registry.yarnpkg.com/tree-sitter/-/tree-sitter-0.20.4.tgz#7d9d4f769fc05342ef43e5559f7ff34b0fc48327" + integrity sha512-rjfR5dc4knG3jnJNN/giJ9WOoN1zL/kZyrS0ILh+eqq8RNcIbiXA63JsMEgluug0aNvfQvK4BfCErN1vIzvKog== + dependencies: + nan "^2.17.0" + prebuild-install "^7.1.1" + +ts-mixer@^6.0.3, ts-mixer@^6.0.4: + version "6.0.4" + resolved "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-6.0.4.tgz#1da39ceabc09d947a82140d9f09db0f84919ca28" + integrity sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA== + +ts-toolbelt@^9.6.0: + version "9.6.0" + resolved "https://registry.yarnpkg.com/ts-toolbelt/-/ts-toolbelt-9.6.0.tgz#50a25426cfed500d4a09bd1b3afb6f28879edfd5" + integrity sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w== + tslib@^2.6.2: version "2.7.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== + dependencies: + safe-buffer "^5.0.1" + type-fest@^1.0.1: version "1.4.0" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" @@ -1891,6 +2730,13 @@ type-fest@^2.0.0, type-fest@^2.12.2, type-fest@^2.5.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b" integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA== +types-ramda@^0.30.1: + version "0.30.1" + resolved "https://registry.yarnpkg.com/types-ramda/-/types-ramda-0.30.1.tgz#03d255128e3696aeaac76281ca19949e01dddc78" + integrity sha512-1HTsf5/QVRmLzcGfldPFvkVsAdi1db1BBKzi7iW3KBUlOICg/nKnFS+jGqDJS3YD8VsWbAh7JiHeBvbsw8RPxA== + dependencies: + ts-toolbelt "^9.6.0" + unbzip2-stream@^1.0.9: version "1.4.3" resolved "https://registry.yarnpkg.com/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz#b0da04c4371311df771cdc215e87f2130991ace7" @@ -1921,6 +2767,11 @@ universalify@^2.0.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== +unraw@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/unraw/-/unraw-3.0.0.tgz#73443ed70d2ab09ccbac2b00525602d5991fbbe3" + integrity sha512-08/DA66UF65OlpUDIQtbJyrqTR0jTAlJ+jsnkQ4jxR7+K5g5YG1APZKQSMCE1vqqmD+2pv6+IdEjmopFatacvg== + unzipper@^0.10.14: version "0.10.14" resolved "https://registry.yarnpkg.com/unzipper/-/unzipper-0.10.14.tgz#d2b33c977714da0fbc0f82774ad35470a7c962b1" @@ -1945,7 +2796,7 @@ update-browserslist-db@^1.1.0: escalade "^3.1.2" picocolors "^1.0.1" -util-deprecate@~1.0.1: +util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== @@ -1958,6 +2809,16 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +web-streams-polyfill@^3.0.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" + integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw== + +web-tree-sitter@=0.20.3: + version "0.20.3" + resolved "https://registry.yarnpkg.com/web-tree-sitter/-/web-tree-sitter-0.20.3.tgz#3dd17b283ad63b1d8c07c5ea814f0fefb2b1f776" + integrity sha512-zKGJW9r23y3BcJusbgvnOH2OYAW40MXAOi9bi3Gcc7T4Gms9WWgXF8m6adsJWpGJEhgOzCrfiz1IzKowJWrtYw== + which-module@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.1.tgz#776b1fe35d90aebe99e8ac15eb24093389a4a409" @@ -2011,6 +2872,13 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +xml-but-prettier@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/xml-but-prettier/-/xml-but-prettier-1.0.1.tgz#f5a33267ed42ccd4e355c62557a5e39b01fb40f3" + integrity sha512-C2CJaadHrZTqESlH03WOyw0oZTtoy2uEg6dSDF6YRg+9GnYNub53RRemLpnvtbHDFelxMx4LajiFsYeR6XJHgQ== + dependencies: + repeat-string "^1.5.2" + xtend@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" From 5ad7bc4b1abe08ec6e278fe52e0fd265e87f6ff5 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Wed, 30 Oct 2024 17:38:55 -0500 Subject: [PATCH 12/14] chore(api): Refactor and reuse data: - Makes OSS v2 config consistent with other platforms and more convenient - Changes getSwagger.sh to use the new v2 config and to allow generating v1-compat individually for each platform - Refactors JS into modules. - Reuses existing product (platform) data - Adds an apis property to product data that references the config file for each product's API docs - Generates pages for all products that have the property - Adds the script to package.json --- .../cloud-dedicated/management/openapi.yml | 12 +- .../v1-compatibility/swaggerV1Compat.yml | 22 +-- api-docs/cloud-dedicated/v2/ref.yml | 29 ++- .../v1-compatibility/swaggerV1Compat.yml | 16 +- api-docs/cloud-serverless/v2/ref.yml | 25 +-- .../v1-compatibility/swaggerV1Compat.yml | 16 +- .../v1-compatibility/swaggerV1Compat.yml | 16 +- api-docs/clustered/v2/ref.yml | 25 +-- api-docs/create-pages.mjs | 104 +++++++++++ api-docs/getswagger.sh | 106 +++++++---- api-docs/index.mjs | 71 ++++++++ api-docs/scripts/create-pages.js | 168 ------------------ api-docs/templates.mjs | 20 +++ api-docs/util.mjs | 26 +++ api-docs/v2/.config.yml | 4 +- .../v2/v1-compatibility/swaggerV1Compat.yml | 16 +- api-docs/v2/{ => v2}/ref.yml | 0 .../validate-spec.js => validate-spec.mjs} | 30 ++-- data/products.yml | 5 + package.json | 2 +- 20 files changed, 386 insertions(+), 327 deletions(-) create mode 100644 api-docs/create-pages.mjs create mode 100644 api-docs/index.mjs delete mode 100644 api-docs/scripts/create-pages.js create mode 100644 api-docs/templates.mjs create mode 100644 api-docs/util.mjs rename api-docs/v2/{ => v2}/ref.yml (100%) rename api-docs/{scripts/validate-spec.js => validate-spec.mjs} (64%) diff --git a/api-docs/cloud-dedicated/management/openapi.yml b/api-docs/cloud-dedicated/management/openapi.yml index 6aa4041113..7ef076091f 100644 --- a/api-docs/cloud-dedicated/management/openapi.yml +++ b/api-docs/cloud-dedicated/management/openapi.yml @@ -13,14 +13,7 @@ info: url: https://opensource.org/licenses/MIT version: '' servers: - - url: https://{baseurl}/api/v0 - description: InfluxDB Cloud Dedicated Management API URL - variables: - baseurl: - enum: - - console.influxdata.com - default: console.influxdata.com - description: InfluxDB Cloud Dedicated Console URL + - url: / security: - bearerAuthManagementToken: [] bearerAuthJwt: [] @@ -37,8 +30,6 @@ tags: See how to [create a management token](/influxdb/cloud-dedicated/admin/tokens/management/). By default, management tokens in InfluxDB v3 are short-lived tokens issued by an OAuth2 identity provider that grant a specific user administrative access to your InfluxDB cluster. However, for automation purposes, you can manually create management tokens that authenticate directly with your InfluxDB cluster and do not require human interaction with your identity provider. - - - name: Database tokens description: Manage database read/write tokens for a cluster - name: Databases @@ -1020,7 +1011,6 @@ paths: For example, see how to [authenticate Telegraf using tokens in your OS secret store](https://github.com/influxdata/telegraf/tree/master/plugins/secretstores/os). If you lose a token, [delete the token from InfluxDB](/influxdb/cloud-dedicated/admin/tokens/database/delete/) and create a new one. - parameters: - name: accountId in: path diff --git a/api-docs/cloud-dedicated/v1-compatibility/swaggerV1Compat.yml b/api-docs/cloud-dedicated/v1-compatibility/swaggerV1Compat.yml index e13b311fed..563f4b69d3 100644 --- a/api-docs/cloud-dedicated/v1-compatibility/swaggerV1Compat.yml +++ b/api-docs/cloud-dedicated/v1-compatibility/swaggerV1Compat.yml @@ -35,6 +35,7 @@ tags: x-traitTag: true + - name: Ping - name: Query - name: Write paths: @@ -244,7 +245,7 @@ paths: get: description: | Reports the InfluxQL bridge querier health and the InfluxDB version of the instance. - + The response is a HTTP `204` status code to inform you the querier is available. For InfluxDB Cloud Dedicated, this endpoint only checks the status of queriers; doesn't check the status of ingesters. @@ -282,7 +283,7 @@ paths: head: description: | Reports the InfluxQL bridge querier health and the InfluxDB version of the instance. - + The response is a HTTP `204` status code to inform you the querier is available. For InfluxDB Cloud Dedicated, this endpoint only checks the status of queriers; doesn't check the status of ingesters. @@ -290,7 +291,6 @@ paths: To check the health of ingesters before writing data, send a request to one of the [write endpoints](/influxdb/cloud-dedicated/api/v2/#tag/Write). This endpoint doesn't require authentication. - operationId: HeadPing responses: '204': @@ -357,9 +357,9 @@ components: properties: results: description: | - A resultset object that contains the `statement_id` and the `series` array. + A resultset object that contains the `statement_id` and the `series` array. - Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. + Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. items: properties: error: @@ -408,12 +408,12 @@ components: type: integer type: object oneOf: - - required: - - statement_id - - error - - required: - - statement_id - - series + - required: + - statement_id + - error + - required: + - statement_id + - series type: array type: object InfluxQLCSVResponse: diff --git a/api-docs/cloud-dedicated/v2/ref.yml b/api-docs/cloud-dedicated/v2/ref.yml index b223b244ed..0d0520428a 100644 --- a/api-docs/cloud-dedicated/v2/ref.yml +++ b/api-docs/cloud-dedicated/v2/ref.yml @@ -12,14 +12,7 @@ info: summary: The InfluxDB v2 HTTP API for InfluxDB Cloud Dedicated provides a v2-compatible programmatic interface for writing data stored in an InfluxDB Cloud Dedicated database. version: '' servers: - - url: https://{baseurl} - description: InfluxDB Cloud Dedicated API URL - variables: - baseurl: - enum: - - cluster-id.a.influxdb.io - default: cluster-id.a.influxdb.io - description: InfluxDB Cloud Dedicated URL + - url: / security: - BearerAuthentication: [] - TokenAuthentication: [] @@ -150,7 +143,7 @@ paths: get: description: | Reports the InfluxQL bridge querier health and the InfluxDB version of the instance. - + The response is a HTTP `204` status code to inform you the querier is available. For InfluxDB Cloud Dedicated, this endpoint only checks the status of queriers; doesn't check the status of ingesters. @@ -188,7 +181,7 @@ paths: head: description: | Reports the InfluxQL bridge querier health and the InfluxDB version of the instance. - + The response is a HTTP `204` status code to inform you the querier is available. For InfluxDB Cloud Dedicated, this endpoint only checks the status of queriers; doesn't check the status of ingesters. @@ -1243,9 +1236,9 @@ components: properties: results: description: | - A resultset object that contains the `statement_id` and the `series` array. + A resultset object that contains the `statement_id` and the `series` array. - Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. + Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. items: properties: error: @@ -1294,12 +1287,12 @@ components: type: integer type: object oneOf: - - required: - - statement_id - - error - - required: - - statement_id - - series + - required: + - statement_id + - error + - required: + - statement_id + - series type: array type: object IntegerLiteral: diff --git a/api-docs/cloud-serverless/v1-compatibility/swaggerV1Compat.yml b/api-docs/cloud-serverless/v1-compatibility/swaggerV1Compat.yml index 44880f9f3e..7aed37ab59 100644 --- a/api-docs/cloud-serverless/v1-compatibility/swaggerV1Compat.yml +++ b/api-docs/cloud-serverless/v1-compatibility/swaggerV1Compat.yml @@ -280,9 +280,9 @@ components: properties: results: description: | - A resultset object that contains the `statement_id` and the `series` array. + A resultset object that contains the `statement_id` and the `series` array. - Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. + Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. items: properties: error: @@ -331,12 +331,12 @@ components: type: integer type: object oneOf: - - required: - - statement_id - - error - - required: - - statement_id - - series + - required: + - statement_id + - error + - required: + - statement_id + - series type: array type: object InfluxQLCSVResponse: diff --git a/api-docs/cloud-serverless/v2/ref.yml b/api-docs/cloud-serverless/v2/ref.yml index 4c6c01654d..0187c892ac 100644 --- a/api-docs/cloud-serverless/v2/ref.yml +++ b/api-docs/cloud-serverless/v2/ref.yml @@ -13,14 +13,7 @@ info: The InfluxDB v2 HTTP API for InfluxDB Cloud Serverless provides a programmatic interface for writing data stored in an InfluxDB Cloud Serverless bucket. version: '' servers: - - url: https://{baseurl} - description: InfluxDB Cloud Serverless API URL - variables: - baseurl: - enum: - - us-east-1-1.aws.cloud2.influxdata.com - default: us-east-1-1.aws.cloud2.influxdata.com - description: InfluxDB Cloud Serverless URL + - url: / security: - TokenAuthentication: [] tags: @@ -10280,9 +10273,9 @@ components: properties: results: description: | - A resultset object that contains the `statement_id` and the `series` array. + A resultset object that contains the `statement_id` and the `series` array. - Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. + Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. items: properties: error: @@ -10331,12 +10324,12 @@ components: type: integer type: object oneOf: - - required: - - statement_id - - error - - required: - - statement_id - - series + - required: + - statement_id + - error + - required: + - statement_id + - series type: array type: object IntegerLiteral: diff --git a/api-docs/cloud/v1-compatibility/swaggerV1Compat.yml b/api-docs/cloud/v1-compatibility/swaggerV1Compat.yml index 56853fefa1..3f9e0a1e7b 100644 --- a/api-docs/cloud/v1-compatibility/swaggerV1Compat.yml +++ b/api-docs/cloud/v1-compatibility/swaggerV1Compat.yml @@ -276,9 +276,9 @@ components: properties: results: description: | - A resultset object that contains the `statement_id` and the `series` array. + A resultset object that contains the `statement_id` and the `series` array. - Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. + Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. items: properties: error: @@ -327,12 +327,12 @@ components: type: integer type: object oneOf: - - required: - - statement_id - - error - - required: - - statement_id - - series + - required: + - statement_id + - error + - required: + - statement_id + - series type: array type: object InfluxQLCSVResponse: diff --git a/api-docs/clustered/v1-compatibility/swaggerV1Compat.yml b/api-docs/clustered/v1-compatibility/swaggerV1Compat.yml index 8f3a1373a6..91eb303736 100644 --- a/api-docs/clustered/v1-compatibility/swaggerV1Compat.yml +++ b/api-docs/clustered/v1-compatibility/swaggerV1Compat.yml @@ -280,9 +280,9 @@ components: properties: results: description: | - A resultset object that contains the `statement_id` and the `series` array. + A resultset object that contains the `statement_id` and the `series` array. - Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. + Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. items: properties: error: @@ -331,12 +331,12 @@ components: type: integer type: object oneOf: - - required: - - statement_id - - error - - required: - - statement_id - - series + - required: + - statement_id + - error + - required: + - statement_id + - series type: array type: object InfluxQLCSVResponse: diff --git a/api-docs/clustered/v2/ref.yml b/api-docs/clustered/v2/ref.yml index b617a71033..42c01f9599 100644 --- a/api-docs/clustered/v2/ref.yml +++ b/api-docs/clustered/v2/ref.yml @@ -12,14 +12,7 @@ info: url: https://opensource.org/licenses/MIT summary: The InfluxDB v2 HTTP API for InfluxDB Clustered provides a v2-compatible programmatic interface for writing data stored in an InfluxDB Clustered database. servers: - - url: https://{baseurl} - description: InfluxDB Clustered API URL - variables: - baseurl: - enum: - - cluster-host.com - default: cluster-host.com - description: InfluxDB Clustered URL + - url: / security: - BearerAuthentication: [] - TokenAuthentication: [] @@ -1235,9 +1228,9 @@ components: properties: results: description: | - A resultset object that contains the `statement_id` and the `series` array. + A resultset object that contains the `statement_id` and the `series` array. - Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. + Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. items: properties: error: @@ -1286,12 +1279,12 @@ components: type: integer type: object oneOf: - - required: - - statement_id - - error - - required: - - statement_id - - series + - required: + - statement_id + - error + - required: + - statement_id + - series type: array type: object IntegerLiteral: diff --git a/api-docs/create-pages.mjs b/api-docs/create-pages.mjs new file mode 100644 index 0000000000..ad33ab59e7 --- /dev/null +++ b/api-docs/create-pages.mjs @@ -0,0 +1,104 @@ +/** + * This script generates markdown files for each endpoint in the + * configured OpenAPI specs. + */ + +import { writeFileSync, rmSync, readFileSync, existsSync, mkdirSync } from 'fs'; +import * as yaml from 'js-yaml'; +import { execCommand, getSwagger, isPlaceholderFragment } from './util.mjs'; +import { apis } from './templates.mjs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +// Get the current file's directory +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +function getPathGroups(openapi) { + const pathGroups = {}; + Object.keys(openapi.paths).sort() + .forEach((p) => { + const delimiter = '/'; + let key = p.split(delimiter); + let isItemPath = isPlaceholderFragment(key[key.length - 1]); + if(isItemPath) { + key = key.slice(0, -1); + } + key = (key.slice(0, 4)) + isItemPath = isPlaceholderFragment(key[key.length - 1]); + if(isItemPath) { + key = key.slice(0, -1); + } + const groupKey = key.join('/'); + pathGroups[groupKey] = pathGroups[groupKey] || {}; + pathGroups[groupKey][p] = openapi.paths[p]; + }); + return pathGroups; +} + +function createIndexPage(target_dir, spec, pageParams) { + const menuKey = Object.keys(pageParams.menu)[0]; + pageParams.menu[menuKey].name = spec.info.title; + pageParams.title = spec.info.title; + pageParams.description = spec.info.description; + + let page = (JSON.stringify(pageParams)).concat('\n\n', spec.info.description, '\n\n', '{{< children >}}', '\n\n'); + + const pagePath = path.join(target_dir, '_index.md'); + writeFileSync(pagePath, page); + console.log(`Created: ${pagePath}`); +} + +function createPathGroupPage(targetDir, pathGroup, pathSpec, pageParams) { + pathSpec['x-pathGroupTitle'] = `${pathGroup}\n${pathSpec.info.title}`; + pathSpec['x-pathGroup'] = pathGroup; + + pageParams.title = pathSpec['x-pathGroupTitle']; + pageParams.description = pathSpec.info.description; + pageParams.api = { + spec: JSON.stringify(pathSpec), + }; + const menuKey = Object.keys(pageParams.menu)[0]; + pageParams.menu[menuKey].parent = pathSpec.info.title; + pageParams.menu[menuKey].weight = 1; + pageParams.menu[menuKey].name = pathGroup; + // Create a unique identifier for the menu item + pageParams.menu[menuKey].identifier = (`${pageParams.api_name}_${pathGroup}`).replace(/-/g, '_'); + + console.log(pageParams); + const pageName = `${pathGroup.replaceAll('/', '-').replace(/^-/, '')}`; + const pagePath = path.join(targetDir, `${pageName}.md`); + writeFileSync(pagePath, JSON.stringify(pageParams)); + console.log(`Created: ${pagePath}`); +} + +export function createAPIPages(pageParams, specPath, docPath) { + // Execute the script to fetch and bundle the configured spec. + execCommand(`${getSwagger} ${pageParams.api_name} -B`); + + console.log(`Creating pages for: ${pageParams.api_name} ${specPath}`); + const spec = yaml.load(readFileSync(specPath, 'utf8')); + + if (!existsSync(docPath)) { + mkdirSync(docPath, { recursive: true }); + }; + + const pageParamsClone = JSON.stringify(pageParams); + createIndexPage(docPath, spec, JSON.parse(pageParamsClone)); + + const pathGroups = getPathGroups(spec); + Object.keys(pathGroups).forEach( pathGroup => { + // Deep copy the spec object + const specClone = JSON.parse(JSON.stringify(spec)); + specClone.paths = pathGroups[pathGroup]; + createPathGroupPage(docPath, pathGroup, specClone, JSON.parse(pageParamsClone)); + }); +} + +export function deleteAPIPages(docPath) { + try { + rmSync(docPath, {recursive: true, force: true}); + } catch (error) { + console.error(`Error deleting API pages: ${docPath}`); + } +} diff --git a/api-docs/getswagger.sh b/api-docs/getswagger.sh index a8bc782c70..0a1491fb7c 100755 --- a/api-docs/getswagger.sh +++ b/api-docs/getswagger.sh @@ -48,8 +48,8 @@ function showHelp { echo " ./getswagger.sh cloud" echo " ./getswagger.sh cloud-dedicated" echo " ./getswagger.sh cloud-serverless" - echo " ./getswagger.sh oss -o -V" - echo " ./getswagger.sh all -o " + echo " ./getswagger.sh v2 -V" + echo " ./getswagger.sh all" echo "Commands:" echo "-b The base URL to fetch from." echo " ex. ./getswagger.sh -b file:///Users/yourname/github/openapi" @@ -65,7 +65,7 @@ function showHelp { subcommand=$1 case "$subcommand" in - cloud-dedicated-v2|cloud-dedicated-management|cloud-serverless-v2|clustered-v2|cloud-v2|oss-v2|v2|v1-compat|all) + cloud-dedicated-v2|cloud-dedicated-v1-compatibility|cloud-dedicated-management|cloud-serverless-v2|cloud-serverless-v1-compatibility|clustered-v2|clustered-v1-compatibility|cloud-v2|cloud-v1-compatibility|v2-v2|v2-v1-compatibility|all|v1-compat) product=$1 shift @@ -86,9 +86,6 @@ case "$subcommand" in baseUrl=$OPTARG baseUrlOSS=$OPTARG ;; - o) - ossVersion=$OPTARG - ;; \?) echo "Invalid option: $OPTARG" 1>&2 showHelp @@ -108,7 +105,6 @@ esac function showArgs { echo "product: $product"; echo "baseUrl: $baseUrl"; - echo "ossVersion: $ossVersion"; } function postProcess() { @@ -148,17 +144,6 @@ function postProcess() { # --output $specJsonPath } -function updateOSS { - outFile="$API_DOCS_ROOT/v2/ref.yml" - if [[ -z "$baseUrlOSS" ]]; - then - echo "No URL was provided. I'll rebuild from the existing spec $outFile" - else - curl $UPDATE_OPTIONS ${baseUrlOSS}/contracts/ref/oss.yml -o $outFile - fi - postProcess $outFile "$API_DOCS_ROOT/v2/.config.yml" '@2' -} - function updateCloudV2 { outFile="$API_DOCS_ROOT/cloud/v2/ref.yml" if [[ -z "$baseUrl" ]]; @@ -214,41 +199,80 @@ function updateCloudServerlessV2 { postProcess $outFile "$API_DOCS_ROOT/cloud-serverless/.config.yml" v2@2 } -function updateOSSV2 { - outFile="$API_DOCS_ROOT/v2/ref.yml" - if [[ -z "$baseUrlOSS" ]]; +function updateV2V2 { + outFile="$API_DOCS_ROOT/v2/v2/ref.yml" + if [[ -z "$baseUrl" ]]; then echo "No URL was provided. I'll rebuild from the existing spec $outFile" else - curl $UPDATE_OPTIONS ${baseUrlOSS}/contracts/ref/oss.yml -o $outFile + curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/oss.yml -o $outFile fi - postProcess $outFile "$API_DOCS_ROOT/v2/.config.yml" '@2' + postProcess $outFile "$API_DOCS_ROOT/v2/.config.yml" 'v2@2' } -function updateV1Compat { +function updateCloudV1Compat { outFile="$API_DOCS_ROOT/cloud/v1-compatibility/swaggerV1Compat.yml" if [[ -z "$baseUrl" ]]; then echo "No URL was provided. I'll rebuild from the existing spec $outFile" else - curl $UPDATE_OPTIONS ${baseUrl}/contracts/swaggerV1Compat.yml -o $outFile + curl $UPDATE_OPTIONS ${baseUrl}/contracts/swaggerV1Compat.yml -o $outFile fi postProcess $outFile "$API_DOCS_ROOT/cloud/.config.yml" 'v1-compatibility' +} - outFile="$API_DOCS_ROOT/v2/v1-compatibility/swaggerV1Compat.yml" - cp cloud/v1-compatibility/swaggerV1Compat.yml $outFile - postProcess $outFile "$API_DOCS_ROOT/v2/.config.yml" 'v1-compatibility' - +function updateCloudDedicatedV1Compat { outFile="$API_DOCS_ROOT/cloud-dedicated/v1-compatibility/swaggerV1Compat.yml" + if [[ -z "$baseUrl" ]]; + then + echo "No URL was provided. I'll rebuild from the existing spec $outFile" + else + curl $UPDATE_OPTIONS ${baseUrl}/contracts/swaggerV1Compat.yml -o $outFile + fi postProcess $outFile "$API_DOCS_ROOT/cloud-dedicated/.config.yml" 'v1-compatibility' +} +function updateCloudServerlessV1Compat { outFile="$API_DOCS_ROOT/cloud-serverless/v1-compatibility/swaggerV1Compat.yml" + if [[ -z "$baseUrl" ]]; + then + echo "No URL was provided. I'll rebuild from the existing spec $outFile" + else + curl $UPDATE_OPTIONS ${baseUrl}/contracts/swaggerV1Compat.yml -o $outFile + fi postProcess $outFile "$API_DOCS_ROOT/cloud-serverless/.config.yml" 'v1-compatibility' +} +function updateClusteredV1Compat { outFile="$API_DOCS_ROOT/clustered/v1-compatibility/swaggerV1Compat.yml" + if [[ -z "$baseUrl" ]]; + then + echo "No URL was provided. I'll rebuild from the existing spec $outFile" + else + curl $UPDATE_OPTIONS ${baseUrl}/contracts/swaggerV1Compat.yml -o $outFile + fi postProcess $outFile "$API_DOCS_ROOT/clustered/.config.yml" 'v1-compatibility' } +function updateV2V1Compatibility { + outFile="$API_DOCS_ROOT/v2/v1-compatibility/swaggerV1Compat.yml" + if [[ -z "$baseUrl" ]]; + then + echo "No URL was provided. I'll rebuild from the existing spec $outFile" + else + curl $UPDATE_OPTIONS ${baseUrl}/contracts/swaggerV1Compat.yml -o $outFile + fi + postProcess $outFile "$API_DOCS_ROOT/v2/.config.yml" 'v1-compatibility' +} + +function updateV1Compat { + updateCloudV1Compat + updateCloudDedicatedV1Compat + updateCloudServerlessV1Compat + updateClusteredV1Compat + updateV2V1Compatibility +} + UPDATE_OPTIONS="--fail" if [ ! -z ${verbose} ]; @@ -273,12 +297,24 @@ then elif [ "$product" = "clustered-v2" ]; then updateClusteredV2 -elif [ "$product" = "oss-v2" ]; +elif [ "$product" = "v2-v2" ]; +then + updateV2V2 +elif [ "$product" = "cloud-dedicated-v1-compatibility" ]; +then + updateCloudDedicatedV1Compat +elif [ "$product" = "cloud-v1-compatibility" ]; +then + updateCloudV1Compat +elif [ "$product" = "cloud-serverless-v1-compatibility" ]; +then + updateCloudServerlessV1Compat +elif [ "$product" = "clustered-v1-compatibility" ]; then - updateOSSV2 -elif [ "$product" = "v2" ]; + updateClusteredV1Compat +elif [ "$product" = "v2-v1-compatibility" ]; then - updateOSSV2 + updateV2V1Compatibility elif [ "$product" = "v1-compat" ]; then updateV1Compat @@ -289,9 +325,9 @@ then updateCloudDedicatedManagement updateCloudServerlessV2 updateClusteredV2 - updateOSSV2 + updateV2V2 updateV1Compat else - echo "Provide a product argument: cloud-v2, cloud-serverless-v2, cloud-dedicated-v2, clustered-v2, v2, v1-compat, or all." + echo "Provide a product argument: cloud-v2, cloud-serverless-v2, cloud-dedicated-v2, clustered-v2, v2-v2, v1-compat, or all." showHelp fi diff --git a/api-docs/index.mjs b/api-docs/index.mjs new file mode 100644 index 0000000000..92f5b7e218 --- /dev/null +++ b/api-docs/index.mjs @@ -0,0 +1,71 @@ +import { createAPIPages, deleteAPIPages } from './create-pages.mjs'; +import { readFileSync } from 'fs'; +import * as yaml from 'js-yaml'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +// Get the current file's directory +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +// Define the root directory for the docs +const DOCS_ROOT = path.resolve(__dirname, '..'); + +function getAPIConfigs() { + // Load the products data + const products = yaml.load(readFileSync(path.join(DOCS_ROOT, '/data/products.yml'), 'utf8')); + + const configs = []; + + Object.keys(products).forEach(productKey => { + const product = products[productKey]; + const productVersion = product.versions[0]; + let menuName = productKey; + if (menuName === 'influxdb') { + menuName = `${menuName}_${productVersion}`; + } + + if (!product.apis) { + return; + } + + const { apis } = yaml.load(readFileSync(path.join(DOCS_ROOT, product.apis), 'utf8')); + + Object.keys(apis).forEach(version => { + const [ apiShortName ] = version.split('@'); + const api = apis[version]; + api.doc_path = path.join(DOCS_ROOT, `content/influxdb/${productVersion}/api/${apiShortName}`); + api.spec_path = path.join(DOCS_ROOT, 'api-docs', productVersion, api.root); + const menu = {} + menu[productKey] = { + parent: 'InfluxDB HTTP API', + weight: 0, + }, + api.pageParams = { + type: 'api', + title: `${product.name} ${apiShortName}`, + description: 'InfluxDB API documentation', + menu, + tags: [productKey, 'api'], + api_version: version, + api_name: `${productVersion}-${apiShortName}`, + }; + configs.push(api); + }); + }); + return configs; +} + +function buildAPIPages() { + console.log(getAPIConfigs()); + getAPIConfigs().forEach(api => { + // Delete existing pages for each API; + deleteAPIPages(api.doc_path); + + // Create pages for each; + createAPIPages(api.pageParams, api.spec_path, api.doc_path); + }); +} + +buildAPIPages(); +//console.log(getAPIConfigs()); \ No newline at end of file diff --git a/api-docs/scripts/create-pages.js b/api-docs/scripts/create-pages.js deleted file mode 100644 index b6d5ec3f78..0000000000 --- a/api-docs/scripts/create-pages.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * This script generates markdown files for each endpoint in the - * configured OpenAPI specs. - */ -const { execSync } = require('child_process'); -const path = require('path'); -const fs = require('fs'); -const yaml = require('js-yaml'); -const { create } = require('domain'); - -// Calculate the relative paths -const DOCS_ROOT = process.env.DOCS_ROOT || '.'; - -// Function to execute shell commands -const execCommand = (command) => { - try { - console.log(`Executing: ${command}`); - execSync(command, { stdio: 'inherit' }); - } catch (error) { - console.error(`Error executing command: ${command}`); - process.exit(1); - } -}; - -const openapiUtils = { - isPlaceholderFragment: function(str) { - const placeholderRegex = new RegExp('^\{.*\}$'); - return placeholderRegex.test(str); - } -} - -function getPathGroups(openapi) { - const pathGroups = {}; - Object.keys(openapi.paths).sort() - .forEach((p) => { - const delimiter = '/'; - let key = p.split(delimiter); - let isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]); - if(isItemPath) { - key = key.slice(0, -1); - } - key = (key.slice(0, 4)) - isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]); - if(isItemPath) { - key = key.slice(0, -1); - } - const groupKey = key.join('/'); - pathGroups[groupKey] = pathGroups[groupKey] || {}; - pathGroups[groupKey][p] = openapi.paths[p]; - }); - return pathGroups; -} - -const CONFIG = { - apis: [ - { - name: 'cloud-v2', - menu_name: 'influxdb_cloud', - menu: - { - parent: 'INFLUXDB HTTP API', - weight: 0, - }, - // Source OpenAPI spec file - spec_file: path.join(DOCS_ROOT, '/api-docs/cloud/v2/ref.yml'), - // Target content directory for generated endpoint spec pages - // endpoints_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2/yaml'), - // Target content directory for generated .md pages - pages_dir: path.join(DOCS_ROOT, '/content/influxdb/cloud/api/v2'), - }, - { - name: 'oss-v2', - menu_name: 'influxdb_v2', - menu: - { - parent: 'INFLUXDB HTTP API', - weight: 0, - }, - spec_file: path.join(DOCS_ROOT, '/api-docs/v2/ref.yml'), - // Target content directory for generated endpoint spec pages - // endpoints_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2/yaml'), - // Target content directory for generated .md pages - pages_dir: path.join(DOCS_ROOT, '/content/influxdb/v2/api/v2'), - } - ] -} - -function createIndexPage(spec, api) { - - const menu = {...api.menu, name: spec.info.title}; - const pageParams = { - title: spec.info.title, - description: spec.info.description, - menu: {}, - }; - pageParams.menu[api.menu_name] = menu; - - let frontMatter = JSON.stringify(pageParams); - let page = frontMatter.concat('\n\n', spec.info.description, '\n\n', '{{< children >}}', '\n\n'); - - const pagePath = path.join(api.pages_dir, '_index.md'); - fs.writeFileSync(pagePath, page); - console.log(`Created: ${pagePath}`); -} - -function createPathGroupPage(pathGroup, pathSpec, api) { - pathSpec['x-pathGroupTitle'] = `${pathGroup}\n${spec.info.title}`; - pathSpec['x-pathGroup'] = pathGroup; - - const pageParams = { - type: 'api', - title: pathSpec['x-pathGroupTitle'], - description: pathSpec.info.description, - api: { - part_of: api.spec_file, - spec: JSON.stringify(pathSpec), - }, - menu: {}, - } - - const menu = { - parent: spec.info.title, - weight: 1, - name: pathGroup - }; - - pageParams.menu[api.menu_name] = menu; - - let frontMatter = JSON.stringify(pageParams); - - const pageName = `${pathGroup.replaceAll('/', '-').replace(/^-/, '')}`; - const pagePath = path.join(api.pages_dir, `${pageName}.md`); - fs.writeFileSync(pagePath, frontMatter); - console.log(`Created: ${pagePath}`); -} - -function main() { - /** - * Configure the product specs to generate markdown files for. - */ - - let config = CONFIG; - - config.apis.forEach(api => { - // Execute the getswagger.sh script to fetch and bundle the configured spec. - execCommand(`${path.join(DOCS_ROOT, '/api-docs/getswagger.sh')} ${api.name} -B`); - - // Remove old Hugo pages - fs.rmSync(api.pages_dir, {recursive: true, force: true}); - - spec = yaml.load(fs.readFileSync(api.spec_file)); - const pathGroups = getPathGroups(spec); - - if (!fs.existsSync(api.pages_dir)) { - fs.mkdirSync(api.pages_dir, { recursive: true }); - }; - - createIndexPage(spec, api); - Object.keys(pathGroups).forEach( pathGroup => { - // Deep copy the spec object - let pathSpec = JSON.parse(JSON.stringify(spec)); - pathSpec.paths = pathGroups[pathGroup]; - createPathGroupPage(pathGroup, pathSpec, api); - }); - }); -} - -main(); diff --git a/api-docs/templates.mjs b/api-docs/templates.mjs new file mode 100644 index 0000000000..3f59e05d3d --- /dev/null +++ b/api-docs/templates.mjs @@ -0,0 +1,20 @@ +export const apis = [ + { + name: 'influxdb_cloud', + menu_name: 'influxdb_cloud', + menu: + { + parent: 'INFLUXDB HTTP API', + weight: 0, + }, + }, + { + name: 'influxdb', + menu_name: 'influxdb_v2', + menu: + { + parent: 'INFLUXDB HTTP API', + weight: 0, + }, + } +]; diff --git a/api-docs/util.mjs b/api-docs/util.mjs new file mode 100644 index 0000000000..4d9d639470 --- /dev/null +++ b/api-docs/util.mjs @@ -0,0 +1,26 @@ +import { execSync } from 'child_process'; +import process from 'process'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +// Get the current file's directory +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +// Function to execute shell commands +export function execCommand(command) { + try { + console.log(`Executing: ${command}`); + execSync(command, { stdio: 'inherit' }); + } catch (error) { + console.error(`Error executing command: ${command}`); + process.exit(1); + } +}; + +export const getSwagger = path.join(__dirname, 'getswagger.sh'); + +export function isPlaceholderFragment(str) { + const placeholderRegex = new RegExp('^\{.*\}$'); + return placeholderRegex.test(str); +}; diff --git a/api-docs/v2/.config.yml b/api-docs/v2/.config.yml index ffcc1e8852..db660d83b7 100644 --- a/api-docs/v2/.config.yml +++ b/api-docs/v2/.config.yml @@ -6,8 +6,8 @@ extends: x-influxdata-product-name: InfluxDB v2 OSS apis: - '@2': - root: ref.yml + v2@2: + root: v2/ref.yml x-influxdata-default: true v1-compatibility@2: root: v1-compatibility/swaggerV1Compat.yml diff --git a/api-docs/v2/v1-compatibility/swaggerV1Compat.yml b/api-docs/v2/v1-compatibility/swaggerV1Compat.yml index b008e03153..b509c282a9 100644 --- a/api-docs/v2/v1-compatibility/swaggerV1Compat.yml +++ b/api-docs/v2/v1-compatibility/swaggerV1Compat.yml @@ -276,9 +276,9 @@ components: properties: results: description: | - A resultset object that contains the `statement_id` and the `series` array. + A resultset object that contains the `statement_id` and the `series` array. - Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. + Except for `statement_id`, all properties are optional and omitted if empty. If a property is not present, it is assumed to be `null`. items: properties: error: @@ -327,12 +327,12 @@ components: type: integer type: object oneOf: - - required: - - statement_id - - error - - required: - - statement_id - - series + - required: + - statement_id + - error + - required: + - statement_id + - series type: array type: object InfluxQLCSVResponse: diff --git a/api-docs/v2/ref.yml b/api-docs/v2/v2/ref.yml similarity index 100% rename from api-docs/v2/ref.yml rename to api-docs/v2/v2/ref.yml diff --git a/api-docs/scripts/validate-spec.js b/api-docs/validate-spec.mjs similarity index 64% rename from api-docs/scripts/validate-spec.js rename to api-docs/validate-spec.mjs index b2aeaae837..5e38228455 100644 --- a/api-docs/scripts/validate-spec.js +++ b/api-docs/validate-spec.mjs @@ -1,22 +1,11 @@ /** This script contains functions for running various * OpenAPI spec validation tools. */ -const SwaggerParser = require('@apidevtools/swagger-parser'); -const { execSync } = require('child_process'); -const spec = '/Users/ja/Documents/GitHub/docs-v2/api-docs/cloud/v2/ref.yml' - - -// Function to execute shell commands -const execCommand = (command) => { - try { - console.log(`Executing: ${command}`); - execSync(command, { stdio: 'inherit' }); - } catch (error) { - console.error(error); - } -}; +import { execCommand } from './util.mjs'; +import { apis } from './templates.mjs'; +// import SwaggerParser from '@apidevtools/swagger-parser'; -function validate() { +function validate(spec) { // detectCircularRefs(); @@ -32,7 +21,14 @@ function validate() { // Spectral is a flexible JSON/YAML linter, formatter, and style checker for OpenAPI v2, v3.0, v3.1, and AsyncAPI v2.0. // For rule examples, see https://apistylebook.stoplight.io/docs/stoplight-style-guide/ execCommand(`npx @stoplight/spectral-cli lint ${spec} --ruleset ./api-docs/.spectral.yaml`); // --ruleset myruleset.yaml - } -validate(); \ No newline at end of file +const influxdbHttpSpecs = apis.map((api) => api.spec_file); + +export function validateAll(specs) { + if (specs.length === 0) { + // Set default specs + specs = influxdbHttpSpecs; + } + specs.forEach(validate); +} diff --git a/data/products.yml b/data/products.yml index 5e3922e8e3..c80a0ffc2f 100644 --- a/data/products.yml +++ b/data/products.yml @@ -25,6 +25,7 @@ influxdb: v1: 1.11.7 latest_cli: v2: 2.7.5 + apis: api-docs/v2/.config.yml influxdb_cloud: name: InfluxDB Cloud (TSM) @@ -35,6 +36,7 @@ influxdb_cloud: list_order: 1 latest: cloud placeholder_host: cloud2.influxdata.com + apis: api-docs/cloud/.config.yml influxdb_cloud_serverless: name: InfluxDB Cloud Serverless @@ -45,6 +47,7 @@ influxdb_cloud_serverless: list_order: 2 latest: cloud-serverless placeholder_host: cloud2.influxdata.com + apis: api-docs/cloud-serverless/.config.yml influxdb_cloud_dedicated: name: InfluxDB Cloud Dedicated @@ -57,6 +60,7 @@ influxdb_cloud_dedicated: link: "https://www.influxdata.com/contact-sales-form/" latest_cli: 2.9.8 placeholder_host: cluster-id.a.influxdb.io + apis: api-docs/cloud-dedicated/.config.yml influxdb_clustered: name: InfluxDB Clustered @@ -68,6 +72,7 @@ influxdb_clustered: latest: clustered link: "https://www.influxdata.com/contact-sales-influxdb-clustered" placeholder_host: cluster-host.com + apis: api-docs/clustered/.config.yml telegraf: name: Telegraf diff --git a/package.json b/package.json index 0506f52c6e..7a8c45fdb4 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "lint": "LEFTHOOK_EXCLUDE=test lefthook run pre-commit && lefthook run pre-push", "pre-commit": "lefthook run pre-commit", "test-content": "docker compose --profile test up", - "build-apidocs": "node api-docs/scripts/create-pages.js" + "build-apidocs": "node api-docs/index.mjs" }, "main": "index.js", "module": "main.js", From a5e638077cb33228f664b4842c2a4a3565793951 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Mon, 4 Nov 2024 21:45:30 -0600 Subject: [PATCH 13/14] WIP(api): JavaScript module refactor, API stylesheets and theme switching - Use js.Build in asset pipeline to transpile and tree-shake ESM modules - Reorganize JS from HTML sections into modular ESM (benefts: testing, intellisense, package management, explicit dependencies (imports) - Move some code into Reactish functional components - Light/dark theme switching for Rapidoc - Basic light/dark SCSS setup - Inherits the user's preferred server URL and sets it as the API server URL --- assets/js/FluxGroupKeys.js | 6 + assets/js/Sidebar.js | 5 + assets/js/ThemeStyle.js | 5 + assets/js/api-doc/ApiReferencePage.js | 15 + assets/js/api-doc/index.js | 67 +- assets/js/api-libs.js | 9 + assets/js/code-controls.js | 2 + assets/js/code-placeholders.js | 2 + assets/js/content-interactions.js | 70 +- assets/js/cookies.js | 76 +- assets/js/custom-timestamps.js | 5 + assets/js/datetime.js | 2 + assets/js/docs-themes.js | 12 +- assets/js/feature-callouts.js | 1 + assets/js/flux-group-keys.js | 11 +- assets/js/flux-influxdb-versions.js | 1 + assets/js/home-interactions.js | 2 + assets/js/influxdb-url.js | 11 +- assets/js/js.cookie.js | 165 --- assets/js/keybindings.js | 2 + assets/js/list-filters.js | 2 + assets/js/main.js | 80 +- assets/js/modals.js | 1 + assets/js/notifications.js | 1 + assets/js/page-feedback.js | 1 + assets/js/release-toc.js | 1 + assets/js/scroll.js | 21 + assets/js/search-interactions.js | 22 +- assets/js/sidebar-toggle.js | 10 + assets/js/tabbed-content.js | 62 +- assets/js/v3-wayfinding.js | 113 +- assets/js/version-selector.js | 35 +- .../product-overrides/api-reference.scss | 38 + assets/styles/styles-default.scss | 3 +- assets/styles/themes/_theme-dark.scss | 3 +- assets/styles/themes/_theme-light.scss | 3 +- assets/styles/themes/dark/api-reference.scss | 35 + assets/styles/themes/light/api-reference.scss | 34 + layouts/api/single.html | 24 +- layouts/partials/footer.html | 6 + layouts/partials/footer/javascript.html | 64 +- layouts/partials/footer/v3-wayfinding.html | 8 +- layouts/partials/header.html | 19 +- layouts/partials/header/javascript.html | 9 - .../partials/header/search-attributes.html | 8 +- layouts/partials/header/stylesheets.html | 6 + layouts/partials/sidebar.html | 5 + layouts/partials/sidebar/sidebar-toggle.html | 2 +- layouts/partials/topnav.html | 6 +- layouts/partials/topnav/version-selector.html | 5 + layouts/shortcodes/flux/group-key-demo.html | 5 + package.json | 5 +- yarn.lock | 1196 +++++++++-------- 53 files changed, 1257 insertions(+), 1045 deletions(-) create mode 100644 assets/js/FluxGroupKeys.js create mode 100644 assets/js/Sidebar.js create mode 100644 assets/js/ThemeStyle.js create mode 100644 assets/js/api-doc/ApiReferencePage.js delete mode 100644 assets/js/js.cookie.js create mode 100644 assets/js/scroll.js create mode 100644 assets/styles/product-overrides/api-reference.scss create mode 100644 assets/styles/themes/dark/api-reference.scss create mode 100644 assets/styles/themes/light/api-reference.scss diff --git a/assets/js/FluxGroupKeys.js b/assets/js/FluxGroupKeys.js new file mode 100644 index 0000000000..f05f58a179 --- /dev/null +++ b/assets/js/FluxGroupKeys.js @@ -0,0 +1,6 @@ +import { groupData } from './flux-group-keys.js'; + +export default function FluxGroupKeys() { + // Group and render tables on load + document.querySelector(tablesElement).addEventListener('load', groupData()); +}; \ No newline at end of file diff --git a/assets/js/Sidebar.js b/assets/js/Sidebar.js new file mode 100644 index 0000000000..a2c648ab1d --- /dev/null +++ b/assets/js/Sidebar.js @@ -0,0 +1,5 @@ +import { setSidebarState } from './sidebar-toggle.js'; + +export default function Sidebar() { + setSidebarState(); +} \ No newline at end of file diff --git a/assets/js/ThemeStyle.js b/assets/js/ThemeStyle.js new file mode 100644 index 0000000000..9c4aef740a --- /dev/null +++ b/assets/js/ThemeStyle.js @@ -0,0 +1,5 @@ +import { setStyleFromCookie } from './docs-themes.js'; + +export default function ThemeStyle() { + setStyleFromCookie(); +} \ No newline at end of file diff --git a/assets/js/api-doc/ApiReferencePage.js b/assets/js/api-doc/ApiReferencePage.js new file mode 100644 index 0000000000..511a3f3d84 --- /dev/null +++ b/assets/js/api-doc/ApiReferencePage.js @@ -0,0 +1,15 @@ +import { setStyles, setServerUrl, onPreferenceChanged } from './index.js'; + +export default function ApiReferencePage() { + const rapidocEl = document.getElementById('api-doc'); + if(rapidocEl === null) return; + setStyles(rapidocEl); + setServerUrl(rapidocEl); + rapidocEl.loadSpec(JSON.parse(rapidocEl.dataset.openapiSpec)); + rapidocEl.addEventListener('spec-loaded', (e) => {}); + cookieStore.addEventListener('change', (e) => { + if(e.changed) { + onPreferenceChanged(e, rapidocEl); + } + }); +} \ No newline at end of file diff --git a/assets/js/api-doc/index.js b/assets/js/api-doc/index.js index 619603070b..155bb9ac83 100644 --- a/assets/js/api-doc/index.js +++ b/assets/js/api-doc/index.js @@ -1,21 +1,58 @@ import 'rapidoc'; +import { getPreference } from '../cookies.js'; +import { getUrls } from '../influxdb-url.js'; function getUserPreferredUrl() { - const urlName = window.getPreference && window.getPreference('influxdb_url'); - return getUrls()[urlName] || (window.placeholderUrls && window.placeholderUrls['oss']); + const urlName = getPreference('influxdb_url'); + return getUrls()[urlName]; } - -export function apiDocComponent() { - window.addEventListener('DOMContentLoaded', (event) => { - const rapidocEl = document.getElementById('api-doc'); - if(rapidocEl === null) return; - const apiServer = getUserPreferredUrl(); - rapidocEl.addEventListener('spec-loaded', (e) => { - rapidocEl.setApiServer(apiServer); - }); - const spec = JSON.parse(rapidocEl.dataset.openapiSpec); - rapidocEl.loadSpec(spec); - }); + +export function setServerUrl(el) { + const baseUrl = getUserPreferredUrl(); + el.setAttribute('server-url', baseUrl); + el.setApiServer(baseUrl); } -apiDocComponent(); \ No newline at end of file +const darkThemeAttributes = { + 'theme': 'dark', +}; + +const lightThemeAttributes = { + 'theme': 'light', +}; + +export function setStyles(el) { + let theme = getPreference('theme') || 'light'; + theme = theme.replace(/-theme/, ''); + let themeAttributes = { + 'nav-accent-color': "", + 'nav-bg-color': "", + 'nav-hover-bg-color': "", + 'nav-hover-text-color': "", + 'nav-text-color': "", + 'primary-color': "#F63C41", + 'render-style': 'view', + 'show-header': 'false', + 'show-info': 'false', + 'style': 'height:100vh; width:100%', + } + switch (theme) { + case 'light': + themeAttributes = { ...themeAttributes, ...lightThemeAttributes }; + break; + case 'dark': + themeAttributes = { ...themeAttributes, ...darkThemeAttributes }; + break; + } + + for (const [key, value] of Object.entries(themeAttributes)) { + el.setAttribute(key, value); + } +} + +export function onPreferenceChanged(e) { + const rapidocEl = document.getElementById('api-doc'); + if(rapidocEl === null) return; + setStyles(rapidocEl); + setServerUrl(rapidocEl); +} diff --git a/assets/js/api-libs.js b/assets/js/api-libs.js index 7cd5a75739..52f8a599b2 100644 --- a/assets/js/api-libs.js +++ b/assets/js/api-libs.js @@ -1,6 +1,8 @@ //////////////////////////////////////////////////////////////////////////////// ///////////////// Preferred Client Library programming language /////////////// //////////////////////////////////////////////////////////////////////////////// +import { setPreference, getPreference } from './cookies.js'; +import { activateTabs, updateBtnURLs } from './tabbed-content.js'; function getVisitedApiLib () { const path = window.location.pathname.match( @@ -35,3 +37,10 @@ var tab = getApiLibPreference(); selector => activateTabs(selector, tab), updateBtnURLs(tab) ); + +export { + getApiLibPreference, + setApiLibPreference, + getVisitedApiLib, + isApiLib, +}; diff --git a/assets/js/code-controls.js b/assets/js/code-controls.js index 76589de43b..201c2576fc 100644 --- a/assets/js/code-controls.js +++ b/assets/js/code-controls.js @@ -1,3 +1,5 @@ +import $ from 'jquery'; + var codeBlockSelector = ".article--content pre"; var codeBlocks = $(codeBlockSelector); diff --git a/assets/js/code-placeholders.js b/assets/js/code-placeholders.js index 11cc9af274..cef02aa375 100644 --- a/assets/js/code-placeholders.js +++ b/assets/js/code-placeholders.js @@ -1,3 +1,5 @@ +import $ from 'jquery'; + const placeholderWrapper = '.code-placeholder-wrapper'; const placeholderElement = 'var.code-placeholder'; const codePlaceholders = $(placeholderElement); diff --git a/assets/js/content-interactions.js b/assets/js/content-interactions.js index 3a1737f76f..c99be1aeb8 100644 --- a/assets/js/content-interactions.js +++ b/assets/js/content-interactions.js @@ -1,4 +1,28 @@ ///////////////////////////// Make headers linkable ///////////////////////////// +import $ from 'jquery'; +import { scrollToAnchor } from './scroll.js'; + +// Expand accordions on load based on URL anchor +function openAccordionByHash() { + var anchor = window.location.hash; + + function expandElement() { + if ($(anchor).parents('.expand').length > 0) { + return $(anchor).closest('.expand').children('.expand-label'); + } else if ($(anchor).hasClass('expand')){ + return $(anchor).children('.expand-label'); + } + }; + + if (expandElement() != null) { + if (expandElement().children('.expand-toggle').hasClass('open')) {} + else { + expandElement().children('.expand-toggle').trigger('click'); + }; + }; +}; + +function contentInteractions () { var headingWhiteList = $("\ .article--content h2, \ @@ -12,7 +36,7 @@ var headingBlackList = ("\ .influxdbu-banner h4 \ "); -headingElements = headingWhiteList.not(headingBlackList); +const headingElements = headingWhiteList.not(headingBlackList); headingElements.each(function() { function getLink(element) { @@ -33,26 +57,6 @@ var elementWhiteList = [ "a.fullscreen-close" ] -function scrollToAnchor(target) { - var $target = $(target); - if($target && $target.length > 0) { - $('html, body').stop().animate({ - 'scrollTop': ($target.offset().top) - }, 400, 'swing', function () { - window.location.hash = target; - }); - - // Unique accordion functionality - // If the target is an accordion element, open the accordion after scrolling - if ($target.hasClass('expand')) { - if ($(target + ' .expand-label .expand-toggle').hasClass('open')) {} - else { - $(target + '> .expand-label').trigger('click'); - }; - }; - } -} - $('.article a[href^="#"]:not(' + elementWhiteList + ')').click(function (e) { e.preventDefault(); scrollToAnchor(this.hash); @@ -98,25 +102,7 @@ $('.expand-label').click(function() { $(this).next('.expand-content').slideToggle(200) }) -// Expand accordions on load based on URL anchor -function openAccordionByHash() { - var anchor = window.location.hash; - function expandElement() { - if ($(anchor).parents('.expand').length > 0) { - return $(anchor).closest('.expand').children('.expand-label'); - } else if ($(anchor).hasClass('expand')){ - return $(anchor).children('.expand-label'); - } - }; - - if (expandElement() != null) { - if (expandElement().children('.expand-toggle').hasClass('open')) {} - else { - expandElement().children('.expand-toggle').trigger('click'); - }; - }; -}; // Open accordions by hash on page load. openAccordionByHash() @@ -152,3 +138,9 @@ $('.article--content a').each(function() { $(this).attr('target', '_blank'); }; }) + +} + +export default function ContentInteractions() { + contentInteractions(); +} diff --git a/assets/js/cookies.js b/assets/js/cookies.js index 4567941834..84969fb159 100644 --- a/assets/js/cookies.js +++ b/assets/js/cookies.js @@ -13,22 +13,11 @@ - callouts: Feature callouts that have been seen (array) - influxdata_docs_ported: Temporary cookie to help port old cookies to new structure */ +import Cookies from 'js-cookie'; // Prefix for all InfluxData docs cookies const cookiePrefix = 'influxdata_docs_'; -/* - Initialize a cookie with a default value. -*/ -initializeCookie = (cookieName, defaultValue) => { - fullCookieName = cookiePrefix + cookieName; - - // Check if the cookie exists before initializing the cookie - if (Cookies.get(fullCookieName) === undefined) { - Cookies.set(fullCookieName, defaultValue); - } -}; - // Initialize all InfluxData docs cookies with defaults /* @@ -49,11 +38,22 @@ var defaultPref = { v3_wayfinding_show: true, }; +/* + Initialize a cookie with a default value. +*/ +function initializeCookie (cookieName, defaultValue) { + const fullCookieName = cookiePrefix + cookieName; + if (typeof defaultValue !== 'string') { + val = JSON.stringify(defaultValue); + Cookies.set(fullCookieName, val); + } +}; + /* Retrieve a preference from the preference cookie. If the cookie doesn't exist, initialize it with default values. */ -getPreference = prefName => { +const getPreference = prefName => { // Initialize the preference cookie if it doesn't already exist if (Cookies.get(prefCookieName) === undefined) { initializeCookie('preferences', defaultPref); @@ -68,17 +68,17 @@ getPreference = prefName => { }; // Set a preference in the preferences cookie -setPreference = (prefID, prefValue) => { +const setPreference = (prefID, prefValue) => { var prefString = Cookies.get(prefCookieName); let prefObj = JSON.parse(prefString); - + prefObj[prefID] = prefValue; - Cookies.set(prefCookieName, prefObj); + Cookies.set(prefCookieName, JSON.stringify(prefObj)); }; // Return an object containing all preferences -getPreferences = () => JSON.parse(Cookies.get(prefCookieName)); +const getPreferences = () => JSON.parse(Cookies.get(prefCookieName)); /* //////////////////////////////////////////////////////////////////////////////// @@ -113,7 +113,7 @@ var defaultUrlsCookie = { }; // Return an object that contains all InfluxDB urls stored in the urls cookie -getInfluxDBUrls = () => { +const getInfluxDBUrls = () => { // Initialize the urls cookie if it doesn't already exist if (Cookies.get(urlCookieName) === undefined) { initializeCookie('urls', defaultUrlsCookie); @@ -123,7 +123,7 @@ getInfluxDBUrls = () => { }; // Get the current or previous URL for a specific product or a custom url -getInfluxDBUrl = product => { +const getInfluxDBUrl = product => { // Initialize the urls cookie if it doesn't already exist if (Cookies.get(urlCookieName) === undefined) { initializeCookie('urls', defaultUrlsCookie); @@ -142,23 +142,23 @@ getInfluxDBUrl = product => { Input should be an object where the key is the product and the value is the URL to set for that product. */ -setInfluxDBUrls = updatedUrlsObj => { +const setInfluxDBUrls = updatedUrlsObj => { var urlsString = Cookies.get(urlCookieName); let urlsObj = JSON.parse(urlsString); - newUrlsObj = { ...urlsObj, ...updatedUrlsObj }; + const newUrlsObj = { ...urlsObj, ...updatedUrlsObj }; - Cookies.set(urlCookieName, newUrlsObj); + Cookies.set(urlCookieName, JSON.stringify(newUrlsObj)); }; // Set an InfluxDB URL to an empty string in the urls cookie -removeInfluxDBUrl = product => { +const removeInfluxDBUrl = product => { var urlsString = Cookies.get(urlCookieName); - let urlsObj = JSON.parse(urlsString); + const urlsObj = JSON.parse(urlsString); urlsObj[product] = ''; - Cookies.set(urlCookieName, urlsObj); + Cookies.set(urlCookieName, JSON.stringify(urlsObj)); }; /* @@ -175,7 +175,7 @@ var defaultNotifications = { callouts: [], }; -getNotifications = () => { +const getNotifications = () => { // Initialize the notifications cookie if it doesn't already exist if (Cookies.get(notificationCookieName) === undefined) { initializeCookie('notifications', defaultNotifications); @@ -199,11 +199,9 @@ getNotifications = () => { If the notification ID exists in the array assigned to the specified type, the notification has been read. */ -notificationIsRead = (notificationID, notificationType) => { +const notificationIsRead = (notificationID, notificationType) => { let notificationsObj = getNotifications(); - readNotifications = notificationsObj[`${notificationType}s`]; - - return readNotifications.includes(notificationID); + return notificationsObj[`${notificationType}s`].includes(notificationID); }; /* @@ -215,12 +213,26 @@ notificationIsRead = (notificationID, notificationType) => { The notification ID is added to the array assigned to the specified type. */ -setNotificationAsRead = (notificationID, notificationType) => { +const setNotificationAsRead = (notificationID, notificationType) => { let notificationsObj = getNotifications(); let readNotifications = notificationsObj[`${notificationType}s`]; readNotifications.push(notificationID); notificationsObj[notificationType + 's'] = readNotifications; - Cookies.set(notificationCookieName, notificationsObj); + Cookies.set(notificationCookieName, JSON.stringify(notificationsObj)); }; + +export { + initializeCookie, + getPreference, + setPreference, + getPreferences, + getInfluxDBUrls, + getInfluxDBUrl, + setInfluxDBUrls, + removeInfluxDBUrl, + getNotifications, + notificationIsRead, + setNotificationAsRead, +} diff --git a/assets/js/custom-timestamps.js b/assets/js/custom-timestamps.js index 2442931f8e..c1c4004053 100644 --- a/assets/js/custom-timestamps.js +++ b/assets/js/custom-timestamps.js @@ -1,3 +1,8 @@ +import $ from 'jquery'; +import { setPreference, getPreference } from './cookies.js'; +import { toggleModal } from './modal.js'; +import { Datepicker } from 'vanillajs-datepicker'; + // Placeholder start date used in InfluxDB custom timestamps const defaultStartDate = '2022-01-01'; diff --git a/assets/js/datetime.js b/assets/js/datetime.js index ec0f8ee2b7..7e88c1a858 100644 --- a/assets/js/datetime.js +++ b/assets/js/datetime.js @@ -1,3 +1,5 @@ +import $ from 'jquery'; + const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var date = new Date() var currentTimestamp = date.toISOString().replace(/^(.*)(\.\d+)(Z)/, '$1$3') // 2023-01-01T12:34:56Z diff --git a/assets/js/docs-themes.js b/assets/js/docs-themes.js index ce9fa90f41..2c19ff0f46 100644 --- a/assets/js/docs-themes.js +++ b/assets/js/docs-themes.js @@ -3,6 +3,8 @@ http://www.thesitewizard.com/javascripts/change-style-sheets.shtml */ +import { getPreference, setPreference } from './cookies.js'; + // *** TO BE CUSTOMISED *** var style_preference_name = 'theme'; var style_cookie_duration = 30; @@ -36,7 +38,15 @@ function switchStyle (css_title) { function setStyleFromCookie () { var css_title = `${getPreference(style_preference_name)}-theme`; - if (css_title !== undefined) { + if (css_title !== 'undefined-theme') { switchStyle(css_title); } } + +export { + setStyleFromCookie, + switchStyle, + style_preference_name, + style_cookie_duration, + style_domain +} \ No newline at end of file diff --git a/assets/js/feature-callouts.js b/assets/js/feature-callouts.js index 918d783c22..6e68e6e540 100644 --- a/assets/js/feature-callouts.js +++ b/assets/js/feature-callouts.js @@ -5,6 +5,7 @@ Callouts are treated as notifications and use the notification cookie API in assets/js/cookies.js. */ +import $ from 'jquery'; // Get notification ID function getCalloutID (el) { diff --git a/assets/js/flux-group-keys.js b/assets/js/flux-group-keys.js index 80ab46b70f..87cf09c374 100644 --- a/assets/js/flux-group-keys.js +++ b/assets/js/flux-group-keys.js @@ -1,3 +1,5 @@ +import $ from 'jquery'; + var tablesElement = $("#flux-group-keys-demo #grouped-tables") // Sample data @@ -153,5 +155,10 @@ $(".column-list label").click(function () { buildGroupExample(); }); -// Group and render tables on load -groupData() +export { + buildTable, + buildTables, + groupData, + getChecked, + toggleCheckbox +}; diff --git a/assets/js/flux-influxdb-versions.js b/assets/js/flux-influxdb-versions.js index 4e6f66afeb..42e19e8e4d 100644 --- a/assets/js/flux-influxdb-versions.js +++ b/assets/js/flux-influxdb-versions.js @@ -1,6 +1,7 @@ /* Interactions related to the Flux/InfluxDB version modal */ +import $ from 'jquery'; const fluxInfluxDBModal = '.modal-content#flux-influxdb-versions' const pageType = ($(document).attr('title')).includes("package") ? "package" : "function"; diff --git a/assets/js/home-interactions.js b/assets/js/home-interactions.js index a90df14cd4..1bfc8db62d 100644 --- a/assets/js/home-interactions.js +++ b/assets/js/home-interactions.js @@ -1,3 +1,5 @@ +import $ from 'jquery'; + $('.exp-btn').click(function() { var targetBtnElement = $(this).parent() $('.exp-btn > p', targetBtnElement).fadeOut(100); diff --git a/assets/js/influxdb-url.js b/assets/js/influxdb-url.js index a2f1527487..d5a26afde7 100644 --- a/assets/js/influxdb-url.js +++ b/assets/js/influxdb-url.js @@ -1,3 +1,8 @@ +import $ from 'jquery'; +import { getInfluxDBUrls, getInfluxDBUrl, getPreference, setInfluxDBUrls, setPreference } from './cookies.js'; +// Import parameters passed from the calling page to js.Build. +import { cloudUrls } from '@params'; + var placeholderUrls = { oss: 'http://localhost:8086', cloud: 'https://cloud2.influxdata.com', @@ -646,8 +651,8 @@ productsWithUniqueURLs.forEach(function (productEl) { //////////////////////////////////////////////////////////////////////////////// // Extract the protocol and hostname of referrer -referrerMatch = document.referrer.match(/^(?:[^\/]*\/){2}[^\/]+/g); -referrerHost = referrerMatch ? referrerMatch[0] : ''; +const referrerMatch = document.referrer.match(/^(?:[^\/]*\/){2}[^\/]+/g); +const referrerHost = referrerMatch ? referrerMatch[0] : ''; // Check if the referrerHost is one of the cloud URLs // cloudUrls is built dynamically in layouts/partials/footer/javascript.html @@ -668,3 +673,5 @@ if (getUrls().dedicated == 'cluster-id.influxdb.io') { storeUrl('dedicated', 'cluster-id.a.influxdb.io', getUrls().dedicated); updateUrls(getPrevUrls(), getUrls()); } + +export { getUrls, referrerHost }; \ No newline at end of file diff --git a/assets/js/js.cookie.js b/assets/js/js.cookie.js deleted file mode 100644 index 9a0945ed89..0000000000 --- a/assets/js/js.cookie.js +++ /dev/null @@ -1,165 +0,0 @@ -/*! - * JavaScript Cookie v2.2.0 - * https://github.com/js-cookie/js-cookie - * - * Copyright 2006, 2015 Klaus Hartl & Fagner Brack - * Released under the MIT license - */ -;(function (factory) { - var registeredInModuleLoader = false; - if (typeof define === 'function' && define.amd) { - define(factory); - registeredInModuleLoader = true; - } - if (typeof exports === 'object') { - module.exports = factory(); - registeredInModuleLoader = true; - } - if (!registeredInModuleLoader) { - var OldCookies = window.Cookies; - var api = window.Cookies = factory(); - api.noConflict = function () { - window.Cookies = OldCookies; - return api; - }; - } -}(function () { - function extend () { - var i = 0; - var result = {}; - for (; i < arguments.length; i++) { - var attributes = arguments[ i ]; - for (var key in attributes) { - result[key] = attributes[key]; - } - } - return result; - } - - function init (converter) { - function api (key, value, attributes) { - var result; - if (typeof document === 'undefined') { - return; - } - - // Write - - if (arguments.length > 1) { - attributes = extend({ - path: '/' - }, api.defaults, attributes); - - if (typeof attributes.expires === 'number') { - var expires = new Date(); - expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); - attributes.expires = expires; - } - - // We're using "expires" because "max-age" is not supported by IE - attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; - - try { - result = JSON.stringify(value); - if (/^[\{\[]/.test(result)) { - value = result; - } - } catch (e) {} - - if (!converter.write) { - value = encodeURIComponent(String(value)) - .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); - } else { - value = converter.write(value, key); - } - - key = encodeURIComponent(String(key)); - key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); - key = key.replace(/[\(\)]/g, escape); - - var stringifiedAttributes = ''; - - for (var attributeName in attributes) { - if (!attributes[attributeName]) { - continue; - } - stringifiedAttributes += '; ' + attributeName; - if (attributes[attributeName] === true) { - continue; - } - stringifiedAttributes += '=' + attributes[attributeName]; - } - return (document.cookie = key + '=' + value + stringifiedAttributes); - } - - // Read - - if (!key) { - result = {}; - } - - // To prevent the for loop in the first place assign an empty array - // in case there are no cookies at all. Also prevents odd result when - // calling "get()" - var cookies = document.cookie ? document.cookie.split('; ') : []; - var rdecode = /(%[0-9A-Z]{2})+/g; - var i = 0; - - for (; i < cookies.length; i++) { - var parts = cookies[i].split('='); - var cookie = parts.slice(1).join('='); - - if (!this.json && cookie.charAt(0) === '"') { - cookie = cookie.slice(1, -1); - } - - try { - var name = parts[0].replace(rdecode, decodeURIComponent); - cookie = converter.read ? - converter.read(cookie, name) : converter(cookie, name) || - cookie.replace(rdecode, decodeURIComponent); - - if (this.json) { - try { - cookie = JSON.parse(cookie); - } catch (e) {} - } - - if (key === name) { - result = cookie; - break; - } - - if (!key) { - result[name] = cookie; - } - } catch (e) {} - } - - return result; - } - - api.set = api; - api.get = function (key) { - return api.call(api, key); - }; - api.getJSON = function () { - return api.apply({ - json: true - }, [].slice.call(arguments)); - }; - api.defaults = {}; - - api.remove = function (key, attributes) { - api(key, '', extend(attributes, { - expires: -1 - })); - }; - - api.withConverter = init; - - return api; - } - - return init(function () {}); -})); diff --git a/assets/js/keybindings.js b/assets/js/keybindings.js index 6c8f2fcbe2..1bd4529992 100644 --- a/assets/js/keybindings.js +++ b/assets/js/keybindings.js @@ -1,3 +1,5 @@ +import $ from 'jquery'; + // Dynamically update keybindings or hotkeys function getPlatform() { if (/Mac/.test(navigator.platform)) { diff --git a/assets/js/list-filters.js b/assets/js/list-filters.js index 7b008dcb68..3e95616aa5 100644 --- a/assets/js/list-filters.js +++ b/assets/js/list-filters.js @@ -1,3 +1,5 @@ +import $ from 'jquery'; + // Count tag elements function countTag(tag) { return $(".visible[data-tags*='" + tag + "']").length diff --git a/assets/js/main.js b/assets/js/main.js index 1833629e02..7920404c7f 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,4 +1,80 @@ // assets/js/main.js -import { apiDocComponent } from "./api-doc"; +/** Import existing JS as "libraries" for now + * until we can refactor them into component modules. + */ +import * as codeblocksPreferences from './api-libs.js' +import * as codeControls from './code-controls.js'; +import * as cookies from './cookies.js'; +import * as datetime from './datetime.js'; +import * as featureCallouts from './feature-callouts.js'; +import * as fluxGroupKeys from './flux-group-keys.js'; +import * as fluxInfluxDBVersions from './flux-influxdb-versions.js'; +import * as homeInteractions from './home-interactions.js'; +import * as influxDBUrls from './influxdb-url.js'; +import * as keybindings from './keybindings.js'; +import * as listFilters from './list-filters.js'; +import * as modals from './modals.js'; +import * as notifications from './notifications.js'; +import * as pageFeedback from './page-feedback.js'; +import * as releaseTOC from './release-toc.js'; +import * as scroll from './scroll.js'; +import * as searchInteractions from './search-interactions.js'; +import * as sidebarToggle from './sidebar-toggle.js'; +import * as tabbedContent from './tabbed-content.js'; +import * as themes from './docs-themes.js'; +import * as v3wayfinding from './v3-wayfinding.js'; -export { apiDocComponent }; \ No newline at end of file + +/** UI Component-like Modules **/ +/** Following the React JSX component pattern, a component is a module + * that exports a single function + * encapsulating the behavior of the component. + * This function should + * be called in a DOMContentLoaded event listener to ensure that the + * component is properly initialized. +*/ +import ApiReferencePage from "./api-doc/ApiReferencePage.js"; +import ContentInteractions from './content-interactions.js'; +import FluxGroupKeys from './FluxGroupKeys.js'; +import SearchInput from './search-interactions.js'; +import Sidebar from './Sidebar.js' +import ThemeStyle from './ThemeStyle.js'; +import VersionSelector from './version-selector.js'; + +// Import parameters passed from the calling page to js.Build. +import * as pageParams from '@params'; + +document.addEventListener('DOMContentLoaded', () => { + // Expose libraries and components within a namespaced object. + window.influxdatadocs = { + ApiReferencePage, + codeblocksPreferences, + codeControls, + ContentInteractions, + cookies, + datetime, + featureCallouts, + fluxGroupKeys, + FluxGroupKeys, + fluxInfluxDBVersions, + homeInteractions, + influxDBUrls, + keybindings, + listFilters, + modals, + notifications, + pageFeedback, + pageParams, + releaseTOC, + scroll, + searchInteractions, + SearchInput, + Sidebar, + sidebarToggle, + tabbedContent, + themes, + ThemeStyle, + v3wayfinding, + VersionSelector, + }; +}); \ No newline at end of file diff --git a/assets/js/modals.js b/assets/js/modals.js index 9111f1945e..c4352ae2b7 100644 --- a/assets/js/modals.js +++ b/assets/js/modals.js @@ -1,6 +1,7 @@ //////////////////////////////////////////////////////////////////////////////// /////////////////////// General modal window interactions ////////////////////// //////////////////////////////////////////////////////////////////////////////// +import $ from 'jquery'; // Toggle the URL selector modal window function toggleModal(modalID="") { diff --git a/assets/js/notifications.js b/assets/js/notifications.js index 2400f90529..8f5b16f15e 100644 --- a/assets/js/notifications.js +++ b/assets/js/notifications.js @@ -4,6 +4,7 @@ messages array in the influxdata_docs_notifications cookie. IDs in the messages array are considered read and no longer appear to the user. */ +import $ from 'jquery'; // Get notification ID function notificationID(el) { diff --git a/assets/js/page-feedback.js b/assets/js/page-feedback.js index af2ea0cd29..8ec5e665fa 100644 --- a/assets/js/page-feedback.js +++ b/assets/js/page-feedback.js @@ -2,6 +2,7 @@ * This file controls the interactions and life-cycles of the page feedback * buttons and modal. */ +import $ from 'jquery'; // Collect data from the page path const pathArr = location.pathname.split('/').slice(1, -1) diff --git a/assets/js/release-toc.js b/assets/js/release-toc.js index 42858fccc7..eb51b62ae0 100644 --- a/assets/js/release-toc.js +++ b/assets/js/release-toc.js @@ -4,6 +4,7 @@ * This script is used to generate a table of contents for the * release notes pages. */ +import $ from 'jquery'; // Use jQuery filter to get an array of all the *release* h2 elements const releases = $('h2').filter( diff --git a/assets/js/scroll.js b/assets/js/scroll.js new file mode 100644 index 0000000000..3c7af0d723 --- /dev/null +++ b/assets/js/scroll.js @@ -0,0 +1,21 @@ +import $ from 'jquery'; + +export function scrollToAnchor(target) { + var $target = $(target); + if($target && $target.length > 0) { + $('html, body').stop().animate({ + 'scrollTop': ($target.offset().top) + }, 400, 'swing', function () { + window.location.hash = target; + }); + + // Unique accordion functionality + // If the target is an accordion element, open the accordion after scrolling + if ($target.hasClass('expand')) { + if ($(target + ' .expand-label .expand-toggle').hasClass('open')) {} + else { + $(target + '> .expand-label').trigger('click'); + }; + }; + } +} \ No newline at end of file diff --git a/assets/js/search-interactions.js b/assets/js/search-interactions.js index 4f8fdd8ac1..8b3a12182f 100644 --- a/assets/js/search-interactions.js +++ b/assets/js/search-interactions.js @@ -1,10 +1,14 @@ -// Fade content wrapper when focusing on search input -$('#algolia-search-input').focus(function() { - $('.content-wrapper').fadeTo(300, .35); -}) +import $ from 'jquery'; -// Hide search dropdown when leaving search input -$('#algolia-search-input').blur(function() { - $('.content-wrapper').fadeTo(200, 1); - $('.ds-dropdown-menu').hide(); -}) +export default function SearchInput() { + // Fade content wrapper when focusing on search input + $('#algolia-search-input').focus(function() { + $('.content-wrapper').fadeTo(300, .35); + }) + + // Hide search dropdown when leaving search input + $('#algolia-search-input').blur(function() { + $('.content-wrapper').fadeTo(200, 1); + $('.ds-dropdown-menu').hide(); + }) +}; \ No newline at end of file diff --git a/assets/js/sidebar-toggle.js b/assets/js/sidebar-toggle.js index 2c20b3ddf5..d094c64db4 100644 --- a/assets/js/sidebar-toggle.js +++ b/assets/js/sidebar-toggle.js @@ -3,6 +3,8 @@ http://www.thesitewizard.com/javascripts/change-style-sheets.shtml */ +import { getPreference, setPreference } from './cookies.js'; + // *** TO BE CUSTOMISED *** var sidebar_state_preference_name = 'sidebar_state'; var sidebar_state_duration = 30; @@ -43,3 +45,11 @@ function setSidebarState () { toggleSidebar(toggle_state); } } + +export { + setSidebarState, + toggleSidebar, + sidebar_state_preference_name, + sidebar_state_duration, + style_domain +} diff --git a/assets/js/tabbed-content.js b/assets/js/tabbed-content.js index 536301828b..b6244defcc 100644 --- a/assets/js/tabbed-content.js +++ b/assets/js/tabbed-content.js @@ -1,5 +1,8 @@ //////////////////////////////// Tabbed Content //////////////////////////////// +import $ from 'jquery'; +import { scrollToAnchor } from './scroll.js'; + /** * NOTE: Tab elements are whitelisted elements that do not trigger * smoothscroll when clicked. The whitelist is defined in content-interactions.js. @@ -30,9 +33,6 @@ function tabbedContent (container, tab, content) { }); } -tabbedContent('.code-tabs-wrapper', '.code-tabs p a', '.code-tab-content'); -tabbedContent('.tabs-wrapper', '.tabs p a', '.tab-content'); - function getTabQueryParam () { const queryParams = new URLSearchParams(window.location.search); return $('