@techdocs/cli 1.8.2-next.0 → 1.8.2-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @techdocs/cli
2
2
 
3
+ ## 1.8.2-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d8d243c: fix: mkdocs parameter casing
8
+ - Updated dependencies
9
+ - @backstage/catalog-model@1.4.4-next.0
10
+ - @backstage/backend-common@0.21.0-next.1
11
+ - @backstage/plugin-techdocs-node@1.11.2-next.1
12
+ - @backstage/cli-common@0.1.13
13
+ - @backstage/config@1.1.1
14
+
3
15
  ## 1.8.2-next.0
4
16
 
5
17
  ### Patch Changes
@@ -159,7 +159,7 @@ async function serve(opts) {
159
159
  stderrLogFunc: mkdocsLogFunc,
160
160
  mkdocsConfigFileName: mkdocsYmlPath,
161
161
  mkdocsParameterClean: opts.mkdocsParameterClean,
162
- mkdocsParameterDirtyReload: opts.mkdocsParameterDirtyReload,
162
+ mkdocsParameterDirtyReload: opts.mkdocsParameterDirtyreload,
163
163
  mkdocsParameterStrict: opts.mkdocsParameterStrict
164
164
  });
165
165
  for (let attempt = 0; attempt < 30; attempt++) {
@@ -202,4 +202,4 @@ Opening browser.`
202
202
  }
203
203
 
204
204
  exports["default"] = serve;
205
- //# sourceMappingURL=serve-a43e7800.cjs.js.map
205
+ //# sourceMappingURL=serve-c333b152.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serve-a43e7800.cjs.js","sources":["../../src/lib/httpServer.ts","../../src/commands/serve/serve.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport serveHandler from 'serve-handler';\nimport http from 'http';\nimport httpProxy from 'http-proxy';\nimport { createLogger } from './utility';\n\nexport default class HTTPServer {\n private readonly proxyEndpoint: string;\n private readonly backstageBundleDir: string;\n private readonly backstagePort: number;\n private readonly mkdocsTargetAddress: string;\n private readonly verbose: boolean;\n\n constructor(\n backstageBundleDir: string,\n backstagePort: number,\n mkdocsTargetAddress: string,\n verbose: boolean,\n ) {\n this.proxyEndpoint = '/api/techdocs/';\n this.backstageBundleDir = backstageBundleDir;\n this.backstagePort = backstagePort;\n this.mkdocsTargetAddress = mkdocsTargetAddress;\n this.verbose = verbose;\n }\n\n // Create a Proxy for mkdocs server\n private createProxy() {\n const proxy = httpProxy.createProxyServer({\n target: this.mkdocsTargetAddress,\n });\n\n return (request: http.IncomingMessage): [httpProxy, string] => {\n // If the request path is prefixed with this.proxyEndpoint, remove it.\n const proxyEndpointPath = new RegExp(`^${this.proxyEndpoint}`, 'i');\n const forwardPath = request.url?.replace(proxyEndpointPath, '') || '';\n\n return [proxy, forwardPath];\n };\n }\n\n public async serve(): Promise<http.Server> {\n return new Promise<http.Server>((resolve, reject) => {\n const proxyHandler = this.createProxy();\n const server = http.createServer(\n (request: http.IncomingMessage, response: http.ServerResponse) => {\n if (request.url?.startsWith(this.proxyEndpoint)) {\n const [proxy, forwardPath] = proxyHandler(request);\n\n proxy.on('error', (error: Error) => {\n reject(error);\n });\n\n response.setHeader('Access-Control-Allow-Origin', '*');\n response.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n\n request.url = forwardPath;\n proxy.web(request, response);\n return;\n }\n\n // This endpoint is used by the frontend to detect where the backend is running.\n if (request.url === '/.detect') {\n response.setHeader('Content-Type', 'text/plain');\n response.end('techdocs-cli-server');\n return;\n }\n\n serveHandler(request, response, {\n public: this.backstageBundleDir,\n trailingSlash: true,\n rewrites: [{ source: '**', destination: 'index.html' }],\n });\n },\n );\n\n const logger = createLogger({ verbose: false });\n server.listen(this.backstagePort, () => {\n if (this.verbose) {\n logger.info(\n `[techdocs-preview-bundle] Running local version of Backstage at http://localhost:${this.backstagePort}`,\n );\n }\n resolve(server);\n });\n\n server.on('error', (error: Error) => {\n reject(error);\n });\n });\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OptionValues } from 'commander';\nimport path from 'path';\nimport openBrowser from 'react-dev-utils/openBrowser';\nimport { findPaths } from '@backstage/cli-common';\nimport HTTPServer from '../../lib/httpServer';\nimport { runMkdocsServer } from '../../lib/mkdocsServer';\nimport { LogFunc, waitForSignal } from '../../lib/run';\nimport { createLogger } from '../../lib/utility';\nimport { getMkdocsYml } from '@backstage/plugin-techdocs-node';\nimport fs from 'fs-extra';\nimport { checkIfDockerIsOperational } from './utils';\n\nfunction findPreviewBundlePath(): string {\n try {\n return path.join(\n path.dirname(require.resolve('techdocs-cli-embedded-app/package.json')),\n 'dist',\n );\n } catch {\n // If the techdocs-cli-embedded-app package is not available it means we're\n // running a published package. For published packages the preview bundle is\n // copied to dist/embedded-app be the prepack script.\n //\n // This can be tested by running `yarn pack` and extracting the resulting tarball into a directory.\n // Within the extracted directory, run `npm install --only=prod`.\n // Once that's done you can test the CLI in any directory using `node <tmp-dir>/package <command>`.\n // eslint-disable-next-line no-restricted-syntax\n return findPaths(__dirname).resolveOwn('dist/embedded-app');\n }\n}\n\nfunction getPreviewAppPath(opts: OptionValues): string {\n return opts.previewAppBundlePath ?? findPreviewBundlePath();\n}\n\nexport default async function serve(opts: OptionValues) {\n const logger = createLogger({ verbose: opts.verbose });\n\n // Determine if we want to run in local dev mode or not\n // This will run the backstage http server on a different port and only used\n // for proxying mkdocs to the backstage app running locally (e.g. with webpack-dev-server)\n const isDevMode = Object.keys(process.env).includes('TECHDOCS_CLI_DEV_MODE')\n ? true\n : false;\n\n const backstageBackendPort = 7007;\n\n const mkdocsDockerAddr = `http://0.0.0.0:${opts.mkdocsPort}`;\n const mkdocsLocalAddr = `http://127.0.0.1:${opts.mkdocsPort}`;\n const mkdocsExpectedDevAddr = opts.docker\n ? mkdocsDockerAddr\n : mkdocsLocalAddr;\n const mkdocsConfigFileName = opts.mkdocsConfigFileName;\n const siteName = opts.siteName;\n\n const { path: mkdocsYmlPath, configIsTemporary } = await getMkdocsYml('./', {\n name: siteName,\n mkdocsConfigFileName,\n });\n\n // Validate that Docker is up and running\n if (opts.docker) {\n const isDockerOperational = await checkIfDockerIsOperational(logger);\n if (!isDockerOperational) {\n return;\n }\n }\n\n let mkdocsServerHasStarted = false;\n const mkdocsLogFunc: LogFunc = data => {\n // Sometimes the lines contain an unnecessary extra new line\n const logLines = data.toString().split('\\n');\n const logPrefix = opts.docker ? '[docker/mkdocs]' : '[mkdocs]';\n logLines.forEach(line => {\n if (line === '') {\n return;\n }\n\n logger.verbose(`${logPrefix} ${line}`);\n\n // When the server has started, open a new browser tab for the user.\n if (\n !mkdocsServerHasStarted &&\n line.includes(`Serving on ${mkdocsExpectedDevAddr}`)\n ) {\n mkdocsServerHasStarted = true;\n }\n });\n };\n // mkdocs writes all of its logs to stderr by default, and not stdout.\n // https://github.com/mkdocs/mkdocs/issues/879#issuecomment-203536006\n // Had me questioning this whole implementation for half an hour.\n logger.info('Starting mkdocs server.');\n const mkdocsChildProcess = await runMkdocsServer({\n port: opts.mkdocsPort,\n dockerImage: opts.dockerImage,\n dockerEntrypoint: opts.dockerEntrypoint,\n dockerOptions: opts.dockerOption,\n useDocker: opts.docker,\n stdoutLogFunc: mkdocsLogFunc,\n stderrLogFunc: mkdocsLogFunc,\n mkdocsConfigFileName: mkdocsYmlPath,\n mkdocsParameterClean: opts.mkdocsParameterClean,\n mkdocsParameterDirtyReload: opts.mkdocsParameterDirtyReload,\n mkdocsParameterStrict: opts.mkdocsParameterStrict,\n });\n\n // Wait until mkdocs server has started so that Backstage starts with docs loaded\n // Takes 1-5 seconds\n for (let attempt = 0; attempt < 30; attempt++) {\n await new Promise(r => setTimeout(r, 3000));\n if (mkdocsServerHasStarted) {\n break;\n }\n logger.info('Waiting for mkdocs server to start...');\n }\n\n if (!mkdocsServerHasStarted) {\n logger.error(\n 'mkdocs server did not start. Exiting. Try re-running command with -v option for more details.',\n );\n }\n\n const port = isDevMode ? backstageBackendPort : opts.previewAppPort;\n const previewAppPath = getPreviewAppPath(opts);\n const httpServer = new HTTPServer(\n previewAppPath,\n port,\n mkdocsExpectedDevAddr,\n opts.verbose,\n );\n\n httpServer\n .serve()\n .catch(err => {\n logger.error('Failed to start HTTP server', err);\n mkdocsChildProcess.kill();\n process.exit(1);\n })\n .then(() => {\n // The last three things default/component/local/ don't matter. They can be anything.\n openBrowser(`http://localhost:${port}/docs/default/component/local/`);\n logger.info(\n `Serving docs in Backstage at http://localhost:${port}/docs/default/component/local/\\nOpening browser.`,\n );\n });\n\n await waitForSignal([mkdocsChildProcess]);\n\n if (configIsTemporary) {\n process.on('exit', async () => {\n fs.rmSync(mkdocsYmlPath, {});\n });\n }\n}\n"],"names":["httpProxy","http","serveHandler","createLogger","path","findPaths","getMkdocsYml","checkIfDockerIsOperational","runMkdocsServer","openBrowser","waitForSignal","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAqB,UAAW,CAAA;AAAA,EAO9B,WACE,CAAA,kBAAA,EACA,aACA,EAAA,mBAAA,EACA,OACA,EAAA;AAXF,IAAiB,aAAA,CAAA,IAAA,EAAA,eAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,oBAA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IAAI,UAAA;AAAA,IACrB,cAAA;AAAA,IACA,IAAA;AAAA,IACA,qBAAA;AAAA,IACA,IAAK,CAAA,OAAA;AAAA,GACP,CAAA;AAEA,EACG,UAAA,CAAA,KAAA,EACA,CAAA,KAAA,CAAM,CAAO,GAAA,KAAA;AACZ,IAAO,MAAA,CAAA,KAAA,CAAM,+BAA+B,GAAG,CAAA,CAAA;AAC/C,IAAA,kBAAA,CAAmB,IAAK,EAAA,CAAA;AACxB,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,GACf,CACA,CAAA,IAAA,CAAK,MAAM;AAEV,IAAYC,+BAAA,CAAA,CAAA,iBAAA,EAAoB,IAAI,CAAgC,8BAAA,CAAA,CAAA,CAAA;AACpE,IAAO,MAAA,CAAA,IAAA;AAAA,MACL,iDAAiD,IAAI,CAAA;AAAA,gBAAA,CAAA;AAAA,KACvD,CAAA;AAAA,GACD,CAAA,CAAA;AAEH,EAAM,MAAAC,mBAAA,CAAc,CAAC,kBAAkB,CAAC,CAAA,CAAA;AAExC,EAAA,IAAI,iBAAmB,EAAA;AACrB,IAAQ,OAAA,CAAA,EAAA,CAAG,QAAQ,YAAY;AAC7B,MAAGC,sBAAA,CAAA,MAAA,CAAO,aAAe,EAAA,EAAE,CAAA,CAAA;AAAA,KAC5B,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
1
+ {"version":3,"file":"serve-c333b152.cjs.js","sources":["../../src/lib/httpServer.ts","../../src/commands/serve/serve.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport serveHandler from 'serve-handler';\nimport http from 'http';\nimport httpProxy from 'http-proxy';\nimport { createLogger } from './utility';\n\nexport default class HTTPServer {\n private readonly proxyEndpoint: string;\n private readonly backstageBundleDir: string;\n private readonly backstagePort: number;\n private readonly mkdocsTargetAddress: string;\n private readonly verbose: boolean;\n\n constructor(\n backstageBundleDir: string,\n backstagePort: number,\n mkdocsTargetAddress: string,\n verbose: boolean,\n ) {\n this.proxyEndpoint = '/api/techdocs/';\n this.backstageBundleDir = backstageBundleDir;\n this.backstagePort = backstagePort;\n this.mkdocsTargetAddress = mkdocsTargetAddress;\n this.verbose = verbose;\n }\n\n // Create a Proxy for mkdocs server\n private createProxy() {\n const proxy = httpProxy.createProxyServer({\n target: this.mkdocsTargetAddress,\n });\n\n return (request: http.IncomingMessage): [httpProxy, string] => {\n // If the request path is prefixed with this.proxyEndpoint, remove it.\n const proxyEndpointPath = new RegExp(`^${this.proxyEndpoint}`, 'i');\n const forwardPath = request.url?.replace(proxyEndpointPath, '') || '';\n\n return [proxy, forwardPath];\n };\n }\n\n public async serve(): Promise<http.Server> {\n return new Promise<http.Server>((resolve, reject) => {\n const proxyHandler = this.createProxy();\n const server = http.createServer(\n (request: http.IncomingMessage, response: http.ServerResponse) => {\n if (request.url?.startsWith(this.proxyEndpoint)) {\n const [proxy, forwardPath] = proxyHandler(request);\n\n proxy.on('error', (error: Error) => {\n reject(error);\n });\n\n response.setHeader('Access-Control-Allow-Origin', '*');\n response.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n\n request.url = forwardPath;\n proxy.web(request, response);\n return;\n }\n\n // This endpoint is used by the frontend to detect where the backend is running.\n if (request.url === '/.detect') {\n response.setHeader('Content-Type', 'text/plain');\n response.end('techdocs-cli-server');\n return;\n }\n\n serveHandler(request, response, {\n public: this.backstageBundleDir,\n trailingSlash: true,\n rewrites: [{ source: '**', destination: 'index.html' }],\n });\n },\n );\n\n const logger = createLogger({ verbose: false });\n server.listen(this.backstagePort, () => {\n if (this.verbose) {\n logger.info(\n `[techdocs-preview-bundle] Running local version of Backstage at http://localhost:${this.backstagePort}`,\n );\n }\n resolve(server);\n });\n\n server.on('error', (error: Error) => {\n reject(error);\n });\n });\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OptionValues } from 'commander';\nimport path from 'path';\nimport openBrowser from 'react-dev-utils/openBrowser';\nimport { findPaths } from '@backstage/cli-common';\nimport HTTPServer from '../../lib/httpServer';\nimport { runMkdocsServer } from '../../lib/mkdocsServer';\nimport { LogFunc, waitForSignal } from '../../lib/run';\nimport { createLogger } from '../../lib/utility';\nimport { getMkdocsYml } from '@backstage/plugin-techdocs-node';\nimport fs from 'fs-extra';\nimport { checkIfDockerIsOperational } from './utils';\n\nfunction findPreviewBundlePath(): string {\n try {\n return path.join(\n path.dirname(require.resolve('techdocs-cli-embedded-app/package.json')),\n 'dist',\n );\n } catch {\n // If the techdocs-cli-embedded-app package is not available it means we're\n // running a published package. For published packages the preview bundle is\n // copied to dist/embedded-app be the prepack script.\n //\n // This can be tested by running `yarn pack` and extracting the resulting tarball into a directory.\n // Within the extracted directory, run `npm install --only=prod`.\n // Once that's done you can test the CLI in any directory using `node <tmp-dir>/package <command>`.\n // eslint-disable-next-line no-restricted-syntax\n return findPaths(__dirname).resolveOwn('dist/embedded-app');\n }\n}\n\nfunction getPreviewAppPath(opts: OptionValues): string {\n return opts.previewAppBundlePath ?? findPreviewBundlePath();\n}\n\nexport default async function serve(opts: OptionValues) {\n const logger = createLogger({ verbose: opts.verbose });\n\n // Determine if we want to run in local dev mode or not\n // This will run the backstage http server on a different port and only used\n // for proxying mkdocs to the backstage app running locally (e.g. with webpack-dev-server)\n const isDevMode = Object.keys(process.env).includes('TECHDOCS_CLI_DEV_MODE')\n ? true\n : false;\n\n const backstageBackendPort = 7007;\n\n const mkdocsDockerAddr = `http://0.0.0.0:${opts.mkdocsPort}`;\n const mkdocsLocalAddr = `http://127.0.0.1:${opts.mkdocsPort}`;\n const mkdocsExpectedDevAddr = opts.docker\n ? mkdocsDockerAddr\n : mkdocsLocalAddr;\n const mkdocsConfigFileName = opts.mkdocsConfigFileName;\n const siteName = opts.siteName;\n\n const { path: mkdocsYmlPath, configIsTemporary } = await getMkdocsYml('./', {\n name: siteName,\n mkdocsConfigFileName,\n });\n\n // Validate that Docker is up and running\n if (opts.docker) {\n const isDockerOperational = await checkIfDockerIsOperational(logger);\n if (!isDockerOperational) {\n return;\n }\n }\n\n let mkdocsServerHasStarted = false;\n const mkdocsLogFunc: LogFunc = data => {\n // Sometimes the lines contain an unnecessary extra new line\n const logLines = data.toString().split('\\n');\n const logPrefix = opts.docker ? '[docker/mkdocs]' : '[mkdocs]';\n logLines.forEach(line => {\n if (line === '') {\n return;\n }\n\n logger.verbose(`${logPrefix} ${line}`);\n\n // When the server has started, open a new browser tab for the user.\n if (\n !mkdocsServerHasStarted &&\n line.includes(`Serving on ${mkdocsExpectedDevAddr}`)\n ) {\n mkdocsServerHasStarted = true;\n }\n });\n };\n // mkdocs writes all of its logs to stderr by default, and not stdout.\n // https://github.com/mkdocs/mkdocs/issues/879#issuecomment-203536006\n // Had me questioning this whole implementation for half an hour.\n logger.info('Starting mkdocs server.');\n const mkdocsChildProcess = await runMkdocsServer({\n port: opts.mkdocsPort,\n dockerImage: opts.dockerImage,\n dockerEntrypoint: opts.dockerEntrypoint,\n dockerOptions: opts.dockerOption,\n useDocker: opts.docker,\n stdoutLogFunc: mkdocsLogFunc,\n stderrLogFunc: mkdocsLogFunc,\n mkdocsConfigFileName: mkdocsYmlPath,\n mkdocsParameterClean: opts.mkdocsParameterClean,\n mkdocsParameterDirtyReload: opts.mkdocsParameterDirtyreload,\n mkdocsParameterStrict: opts.mkdocsParameterStrict,\n });\n\n // Wait until mkdocs server has started so that Backstage starts with docs loaded\n // Takes 1-5 seconds\n for (let attempt = 0; attempt < 30; attempt++) {\n await new Promise(r => setTimeout(r, 3000));\n if (mkdocsServerHasStarted) {\n break;\n }\n logger.info('Waiting for mkdocs server to start...');\n }\n\n if (!mkdocsServerHasStarted) {\n logger.error(\n 'mkdocs server did not start. Exiting. Try re-running command with -v option for more details.',\n );\n }\n\n const port = isDevMode ? backstageBackendPort : opts.previewAppPort;\n const previewAppPath = getPreviewAppPath(opts);\n const httpServer = new HTTPServer(\n previewAppPath,\n port,\n mkdocsExpectedDevAddr,\n opts.verbose,\n );\n\n httpServer\n .serve()\n .catch(err => {\n logger.error('Failed to start HTTP server', err);\n mkdocsChildProcess.kill();\n process.exit(1);\n })\n .then(() => {\n // The last three things default/component/local/ don't matter. They can be anything.\n openBrowser(`http://localhost:${port}/docs/default/component/local/`);\n logger.info(\n `Serving docs in Backstage at http://localhost:${port}/docs/default/component/local/\\nOpening browser.`,\n );\n });\n\n await waitForSignal([mkdocsChildProcess]);\n\n if (configIsTemporary) {\n process.on('exit', async () => {\n fs.rmSync(mkdocsYmlPath, {});\n });\n }\n}\n"],"names":["httpProxy","http","serveHandler","createLogger","path","findPaths","getMkdocsYml","checkIfDockerIsOperational","runMkdocsServer","openBrowser","waitForSignal","fs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAqB,UAAW,CAAA;AAAA,EAO9B,WACE,CAAA,kBAAA,EACA,aACA,EAAA,mBAAA,EACA,OACA,EAAA;AAXF,IAAiB,aAAA,CAAA,IAAA,EAAA,eAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,oBAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,eAAA,CAAA,CAAA;AACjB,IAAiB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CAAA,OAAA;AAAA,GACP,CAAA;AAEA,EACG,UAAA,CAAA,KAAA,EACA,CAAA,KAAA,CAAM,CAAO,GAAA,KAAA;AACZ,IAAO,MAAA,CAAA,KAAA,CAAM,+BAA+B,GAAG,CAAA,CAAA;AAC/C,IAAA,kBAAA,CAAmB,IAAK,EAAA,CAAA;AACxB,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA,CAAA;AAAA,GACf,CACA,CAAA,IAAA,CAAK,MAAM;AAEV,IAAYC,+BAAA,CAAA,CAAA,iBAAA,EAAoB,IAAI,CAAgC,8BAAA,CAAA,CAAA,CAAA;AACpE,IAAO,MAAA,CAAA,IAAA;AAAA,MACL,iDAAiD,IAAI,CAAA;AAAA,gBAAA,CAAA;AAAA,KACvD,CAAA;AAAA,GACD,CAAA,CAAA;AAEH,EAAM,MAAAC,mBAAA,CAAc,CAAC,kBAAkB,CAAC,CAAA,CAAA;AAExC,EAAA,IAAI,iBAAmB,EAAA;AACrB,IAAQ,OAAA,CAAA,EAAA,CAAG,QAAQ,YAAY;AAC7B,MAAGC,sBAAA,CAAA,MAAA,CAAO,aAAe,EAAA,EAAE,CAAA,CAAA;AAAA,KAC5B,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
@@ -1421,6 +1421,51 @@
1421
1421
  "$schema": "http://json-schema.org/draft-07/schema#"
1422
1422
  }
1423
1423
  },
1424
+ {
1425
+ "path": "../../node_modules/@oriflame/backstage-plugin-score-card/node_modules/@backstage/core-components/config.d.ts",
1426
+ "value": {
1427
+ "type": "object",
1428
+ "properties": {
1429
+ "auth": {
1430
+ "type": "object",
1431
+ "properties": {
1432
+ "autologout": {
1433
+ "description": "Autologout feature configuration",
1434
+ "type": "object",
1435
+ "properties": {
1436
+ "enabled": {
1437
+ "description": "Enable or disable the autologout feature",
1438
+ "visibility": "frontend",
1439
+ "type": "boolean"
1440
+ },
1441
+ "idleTimeoutMinutes": {
1442
+ "description": "Number of minutes after which the inactive user is logged out automatically.\nDefault is 60 minutes (1 hour)",
1443
+ "visibility": "frontend",
1444
+ "type": "number"
1445
+ },
1446
+ "promptBeforeIdleSeconds": {
1447
+ "description": "Number of seconds before the idle timeout where the user will be asked if it's still active.\nA dialog will be shown.\nDefault is 10 seconds.\nSet to 0 seconds to disable the prompt.",
1448
+ "visibility": "frontend",
1449
+ "type": "number"
1450
+ },
1451
+ "useWorkerTimers": {
1452
+ "description": "Enable/disable the usage of worker thread timers instead of main thread timers.\nDefault is true.\nIf you experience some browser incompatibility, you may try to set this to false.",
1453
+ "visibility": "frontend",
1454
+ "type": "boolean"
1455
+ },
1456
+ "logoutIfDisconnected": {
1457
+ "description": "Enable/disable the automatic logout also on users that are logged in but with no Backstage tabs open.\nDefault is true.",
1458
+ "visibility": "frontend",
1459
+ "type": "boolean"
1460
+ }
1461
+ }
1462
+ }
1463
+ }
1464
+ }
1465
+ },
1466
+ "$schema": "http://json-schema.org/draft-07/schema#"
1467
+ }
1468
+ },
1424
1469
  {
1425
1470
  "path": "../backend-app-api/config.d.ts",
1426
1471
  "value": {
@@ -1590,6 +1635,418 @@
1590
1635
  },
1591
1636
  "$schema": "http://json-schema.org/draft-07/schema#"
1592
1637
  }
1638
+ },
1639
+ {
1640
+ "path": "../../node_modules/@oriflame/backstage-plugin-score-card/node_modules/@backstage/integration/config.d.ts",
1641
+ "value": {
1642
+ "type": "object",
1643
+ "properties": {
1644
+ "integrations": {
1645
+ "description": "Configuration for integrations towards various external repository provider systems",
1646
+ "visibility": "frontend",
1647
+ "type": "object",
1648
+ "properties": {
1649
+ "azure": {
1650
+ "description": "Integration configuration for Azure",
1651
+ "type": "array",
1652
+ "items": {
1653
+ "type": "object",
1654
+ "properties": {
1655
+ "host": {
1656
+ "description": "The hostname of the given Azure instance",
1657
+ "visibility": "frontend",
1658
+ "type": "string"
1659
+ },
1660
+ "token": {
1661
+ "description": "Token used to authenticate requests.",
1662
+ "visibility": "secret",
1663
+ "deprecated": "Use `credentials` instead.",
1664
+ "type": "string"
1665
+ },
1666
+ "credential": {
1667
+ "description": "The credential to use for requests.\n\nIf no credential is specified anonymous access is used.",
1668
+ "deepVisibility": "secret",
1669
+ "deprecated": "Use `credentials` instead.",
1670
+ "type": "object",
1671
+ "properties": {
1672
+ "clientId": {
1673
+ "type": "string"
1674
+ },
1675
+ "clientSecret": {
1676
+ "type": "string"
1677
+ },
1678
+ "tenantId": {
1679
+ "type": "string"
1680
+ },
1681
+ "personalAccessToken": {
1682
+ "type": "string"
1683
+ }
1684
+ }
1685
+ },
1686
+ "credentials": {
1687
+ "description": "The credentials to use for requests. If multiple credentials are specified the first one that matches the organization is used.\nIf not organization matches the first credential without an organization is used.\n\nIf no credentials are specified at all, either a default credential (for Azure DevOps) or anonymous access (for Azure DevOps Server) is used.",
1688
+ "deepVisibility": "secret",
1689
+ "type": "array",
1690
+ "items": {
1691
+ "type": "object",
1692
+ "properties": {
1693
+ "clientId": {
1694
+ "type": "string"
1695
+ },
1696
+ "clientSecret": {
1697
+ "type": "string"
1698
+ },
1699
+ "tenantId": {
1700
+ "type": "string"
1701
+ },
1702
+ "personalAccessToken": {
1703
+ "type": "string"
1704
+ }
1705
+ }
1706
+ }
1707
+ }
1708
+ },
1709
+ "required": [
1710
+ "host"
1711
+ ]
1712
+ }
1713
+ },
1714
+ "bitbucket": {
1715
+ "description": "Integration configuration for Bitbucket",
1716
+ "deprecated": "replaced by bitbucketCloud and bitbucketServer",
1717
+ "type": "array",
1718
+ "items": {
1719
+ "type": "object",
1720
+ "properties": {
1721
+ "host": {
1722
+ "description": "The hostname of the given Bitbucket instance",
1723
+ "visibility": "frontend",
1724
+ "type": "string"
1725
+ },
1726
+ "token": {
1727
+ "description": "Token used to authenticate requests.",
1728
+ "visibility": "secret",
1729
+ "type": "string"
1730
+ },
1731
+ "apiBaseUrl": {
1732
+ "description": "The base url for the Bitbucket API, for example https://api.bitbucket.org/2.0",
1733
+ "visibility": "frontend",
1734
+ "type": "string"
1735
+ },
1736
+ "username": {
1737
+ "description": "The username to use for authenticated requests.",
1738
+ "visibility": "secret",
1739
+ "type": "string"
1740
+ },
1741
+ "appPassword": {
1742
+ "description": "Bitbucket app password used to authenticate requests.",
1743
+ "visibility": "secret",
1744
+ "type": "string"
1745
+ }
1746
+ },
1747
+ "required": [
1748
+ "host"
1749
+ ]
1750
+ }
1751
+ },
1752
+ "bitbucketCloud": {
1753
+ "description": "Integration configuration for Bitbucket Cloud",
1754
+ "type": "array",
1755
+ "items": {
1756
+ "type": "object",
1757
+ "properties": {
1758
+ "username": {
1759
+ "description": "The username to use for authenticated requests.",
1760
+ "visibility": "secret",
1761
+ "type": "string"
1762
+ },
1763
+ "appPassword": {
1764
+ "description": "Bitbucket Cloud app password used to authenticate requests.",
1765
+ "visibility": "secret",
1766
+ "type": "string"
1767
+ }
1768
+ },
1769
+ "required": [
1770
+ "appPassword",
1771
+ "username"
1772
+ ]
1773
+ }
1774
+ },
1775
+ "bitbucketServer": {
1776
+ "description": "Integration configuration for Bitbucket Server",
1777
+ "type": "array",
1778
+ "items": {
1779
+ "type": "object",
1780
+ "properties": {
1781
+ "host": {
1782
+ "description": "The hostname of the given Bitbucket Server instance",
1783
+ "visibility": "frontend",
1784
+ "type": "string"
1785
+ },
1786
+ "token": {
1787
+ "description": "Token used to authenticate requests.",
1788
+ "visibility": "secret",
1789
+ "type": "string"
1790
+ },
1791
+ "username": {
1792
+ "description": "Username used to authenticate requests with Basic Auth.",
1793
+ "visibility": "secret",
1794
+ "type": "string"
1795
+ },
1796
+ "password": {
1797
+ "description": "Password (or token as password) used to authenticate requests with Basic Auth.",
1798
+ "visibility": "secret",
1799
+ "type": "string"
1800
+ },
1801
+ "apiBaseUrl": {
1802
+ "description": "The base url for the Bitbucket Server API, for example https://<host>/rest/api/1.0",
1803
+ "visibility": "frontend",
1804
+ "type": "string"
1805
+ }
1806
+ },
1807
+ "required": [
1808
+ "host"
1809
+ ]
1810
+ }
1811
+ },
1812
+ "gerrit": {
1813
+ "description": "Integration configuration for Gerrit",
1814
+ "type": "array",
1815
+ "items": {
1816
+ "type": "object",
1817
+ "properties": {
1818
+ "host": {
1819
+ "description": "The hostname of the given Gerrit instance",
1820
+ "visibility": "frontend",
1821
+ "type": "string"
1822
+ },
1823
+ "baseUrl": {
1824
+ "description": "The base url for the Gerrit instance.",
1825
+ "visibility": "frontend",
1826
+ "type": "string"
1827
+ },
1828
+ "cloneUrl": {
1829
+ "description": "The base url for cloning repos.",
1830
+ "visibility": "frontend",
1831
+ "type": "string"
1832
+ },
1833
+ "username": {
1834
+ "description": "The username to use for authenticated requests.",
1835
+ "visibility": "secret",
1836
+ "type": "string"
1837
+ },
1838
+ "password": {
1839
+ "description": "Gerrit password used to authenticate requests. This can be either a password\nor a generated access token.",
1840
+ "visibility": "secret",
1841
+ "type": "string"
1842
+ }
1843
+ },
1844
+ "required": [
1845
+ "host"
1846
+ ]
1847
+ }
1848
+ },
1849
+ "github": {
1850
+ "description": "Integration configuration for GitHub",
1851
+ "type": "array",
1852
+ "items": {
1853
+ "type": "object",
1854
+ "properties": {
1855
+ "host": {
1856
+ "description": "The hostname of the given GitHub instance",
1857
+ "visibility": "frontend",
1858
+ "type": "string"
1859
+ },
1860
+ "token": {
1861
+ "description": "Token used to authenticate requests.",
1862
+ "visibility": "secret",
1863
+ "type": "string"
1864
+ },
1865
+ "apiBaseUrl": {
1866
+ "description": "The base url for the GitHub API, for example https://api.github.com",
1867
+ "visibility": "frontend",
1868
+ "type": "string"
1869
+ },
1870
+ "rawBaseUrl": {
1871
+ "description": "The base url for GitHub raw resources, for example https://raw.githubusercontent.com",
1872
+ "visibility": "frontend",
1873
+ "type": "string"
1874
+ },
1875
+ "apps": {
1876
+ "description": "GitHub Apps configuration",
1877
+ "type": "array",
1878
+ "items": {
1879
+ "type": "object",
1880
+ "properties": {
1881
+ "appId": {
1882
+ "description": "The numeric GitHub App ID, string for environment variables",
1883
+ "type": [
1884
+ "string",
1885
+ "number"
1886
+ ]
1887
+ },
1888
+ "privateKey": {
1889
+ "description": "The private key to use for auth against the app",
1890
+ "visibility": "secret",
1891
+ "type": "string"
1892
+ },
1893
+ "webhookSecret": {
1894
+ "description": "The secret used for webhooks",
1895
+ "visibility": "secret",
1896
+ "type": "string"
1897
+ },
1898
+ "clientId": {
1899
+ "description": "The client ID to use",
1900
+ "type": "string"
1901
+ },
1902
+ "clientSecret": {
1903
+ "description": "The client secret to use",
1904
+ "visibility": "secret",
1905
+ "type": "string"
1906
+ },
1907
+ "allowedInstallationOwners": {
1908
+ "description": "List of installation owners allowed to be used by this GitHub app. The GitHub UI does not provide a way to list the installations.\nHowever you can list the installations with the GitHub API. You can find the list of installations here:\nhttps://api.github.com/app/installations\nThe relevant documentation for this is here.\nhttps://docs.github.com/en/rest/reference/apps#list-installations-for-the-authenticated-app--code-samples",
1909
+ "type": "array",
1910
+ "items": {
1911
+ "type": "string"
1912
+ }
1913
+ }
1914
+ },
1915
+ "required": [
1916
+ "appId",
1917
+ "clientId",
1918
+ "clientSecret",
1919
+ "privateKey",
1920
+ "webhookSecret"
1921
+ ]
1922
+ }
1923
+ }
1924
+ },
1925
+ "required": [
1926
+ "host"
1927
+ ]
1928
+ }
1929
+ },
1930
+ "gitlab": {
1931
+ "description": "Integration configuration for GitLab",
1932
+ "type": "array",
1933
+ "items": {
1934
+ "type": "object",
1935
+ "properties": {
1936
+ "host": {
1937
+ "description": "The host of the target that this matches on, e.g. \"gitlab.com\".",
1938
+ "visibility": "frontend",
1939
+ "type": "string"
1940
+ },
1941
+ "apiBaseUrl": {
1942
+ "description": "The base URL of the API of this provider, e.g.\n\"https://gitlab.com/api/v4\", with no trailing slash.\n\nMay be omitted specifically for public GitLab; then it will be deduced.",
1943
+ "visibility": "frontend",
1944
+ "type": "string"
1945
+ },
1946
+ "token": {
1947
+ "description": "The authorization token to use for requests to this provider.\n\nIf no token is specified, anonymous access is used.",
1948
+ "visibility": "secret",
1949
+ "type": "string"
1950
+ },
1951
+ "baseUrl": {
1952
+ "description": "The baseUrl of this provider, e.g. \"https://gitlab.com\", which is\npassed into the GitLab client.\n\nIf no baseUrl is provided, it will default to https://${host}.",
1953
+ "visibility": "frontend",
1954
+ "type": "string"
1955
+ }
1956
+ },
1957
+ "required": [
1958
+ "host"
1959
+ ]
1960
+ }
1961
+ },
1962
+ "googleGcs": {
1963
+ "description": "Integration configuration for Google Cloud Storage",
1964
+ "type": "object",
1965
+ "properties": {
1966
+ "clientEmail": {
1967
+ "description": "Service account email used to authenticate requests.",
1968
+ "type": "string"
1969
+ },
1970
+ "privateKey": {
1971
+ "description": "Service account private key used to authenticate requests.",
1972
+ "visibility": "secret",
1973
+ "type": "string"
1974
+ }
1975
+ }
1976
+ },
1977
+ "awsS3": {
1978
+ "description": "Integration configuration for AWS S3 Service",
1979
+ "type": "array",
1980
+ "items": {
1981
+ "type": "object",
1982
+ "properties": {
1983
+ "endpoint": {
1984
+ "description": "AWS Endpoint.\nThe endpoint URI to send requests to. The default endpoint is built from the configured region.",
1985
+ "visibility": "frontend",
1986
+ "type": "string"
1987
+ },
1988
+ "s3ForcePathStyle": {
1989
+ "description": "Whether to use path style URLs when communicating with S3.\nDefaults to false.\nThis allows providers like LocalStack, Minio and Wasabi (and possibly others) to be used.",
1990
+ "visibility": "frontend",
1991
+ "type": "boolean"
1992
+ },
1993
+ "accessKeyId": {
1994
+ "description": "Account access key used to authenticate requests.",
1995
+ "type": "string"
1996
+ },
1997
+ "secretAccessKey": {
1998
+ "description": "Account secret key used to authenticate requests.",
1999
+ "visibility": "secret",
2000
+ "type": "string"
2001
+ },
2002
+ "roleArn": {
2003
+ "description": "ARN of the role to be assumed",
2004
+ "type": "string"
2005
+ },
2006
+ "externalId": {
2007
+ "description": "External ID to use when assuming role",
2008
+ "type": "string"
2009
+ }
2010
+ }
2011
+ }
2012
+ },
2013
+ "gitea": {
2014
+ "description": "Integration configuration for Gitea",
2015
+ "type": "array",
2016
+ "items": {
2017
+ "type": "object",
2018
+ "properties": {
2019
+ "host": {
2020
+ "description": "The hostname of the given Gitea instance",
2021
+ "visibility": "frontend",
2022
+ "type": "string"
2023
+ },
2024
+ "baseUrl": {
2025
+ "description": "The base url for the Gitea instance.",
2026
+ "visibility": "frontend",
2027
+ "type": "string"
2028
+ },
2029
+ "username": {
2030
+ "description": "The username to use for authenticated requests.",
2031
+ "visibility": "secret",
2032
+ "type": "string"
2033
+ },
2034
+ "password": {
2035
+ "description": "Gitea password used to authenticate requests. This can be either a password\nor a generated access token.",
2036
+ "visibility": "secret",
2037
+ "type": "string"
2038
+ }
2039
+ },
2040
+ "required": [
2041
+ "host"
2042
+ ]
2043
+ }
2044
+ }
2045
+ }
2046
+ }
2047
+ },
2048
+ "$schema": "http://json-schema.org/draft-07/schema#"
2049
+ }
1593
2050
  }
1594
2051
  ],
1595
2052
  "backstageConfigSchemaVersion": 1
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open platform for building developer portals"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><script defer="defer" src="/static/runtime.5a486dfb.js"></script><script defer="defer" src="/static/module-material-ui.e26d0f76.js"></script><script defer="defer" src="/static/module-lodash.fa492ce2.js"></script><script defer="defer" src="/static/module-date-fns.b8b6c380.js"></script><script defer="defer" src="/static/module-material-table.dc2e7a78.js"></script><script defer="defer" src="/static/module-react-dom.c3454ade.js"></script><script defer="defer" src="/static/module-react-router.fc2430de.js"></script><script defer="defer" src="/static/module-react-router-dom.6a4a6115.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.d66821d2.js"></script><script defer="defer" src="/static/module-zod.9e0f365e.js"></script><script defer="defer" src="/static/module-i18next.db8a27ed.js"></script><script defer="defer" src="/static/vendor.5a486dfb.js"></script><script defer="defer" src="/static/main.5a486dfb.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Backstage is an open platform for building developer portals"/><link rel="manifest" href="/manifest.json" crossorigin="use-credentials"/><link rel="icon" href="/favicon.ico"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"/><title>Techdocs Preview App</title><script defer="defer" src="/static/runtime.3f749eef.js"></script><script defer="defer" src="/static/module-material-ui.e26d0f76.js"></script><script defer="defer" src="/static/module-lodash.fa492ce2.js"></script><script defer="defer" src="/static/module-date-fns.b8b6c380.js"></script><script defer="defer" src="/static/module-material-table.dc2e7a78.js"></script><script defer="defer" src="/static/module-react-dom.c3454ade.js"></script><script defer="defer" src="/static/module-react-router.fc2430de.js"></script><script defer="defer" src="/static/module-react-router-dom.6a4a6115.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.d66821d2.js"></script><script defer="defer" src="/static/module-zod.9e0f365e.js"></script><script defer="defer" src="/static/module-i18next.db8a27ed.js"></script><script defer="defer" src="/static/vendor.3f749eef.js"></script><script defer="defer" src="/static/main.3f749eef.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -0,0 +1,3 @@
1
+ "use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[7670],{27670:function(v,o,l){l.r(o),l.d(o,{CatalogSearchResultListItem:function(){return g}});var t=l(52322),T=l(2784),c=l(79692),r=l(86136),m=l(49378),x=l(90436),h=l(62774),a=l(7089),y=l(98864),d=l(76079);const f=(0,c.Z)({item:{display:"flex"},flexContainer:{flexWrap:"wrap"},itemText:{width:"100%",wordBreak:"break-all",marginBottom:"1rem"}},{name:"CatalogSearchResultListItem"});function g(s){const e=s.result,i=s.highlight,n=f();return e?(0,t.jsxs)("div",{className:n.item,children:[s.icon&&(0,t.jsx)(r.Z,{children:typeof s.icon=="function"?s.icon(e):s.icon}),(0,t.jsxs)("div",{className:n.flexContainer,children:[(0,t.jsx)(m.Z,{className:n.itemText,primaryTypographyProps:{variant:"h6"},primary:(0,t.jsx)(y.rU,{noTrack:!0,to:e.location,children:i!=null&&i.fields.title?(0,t.jsx)(d.F,{text:i.fields.title,preTag:i.preTag,postTag:i.postTag}):e.title}),secondary:(0,t.jsx)(x.Z,{component:"span",style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:s.lineClamp,overflow:"hidden"},color:"textSecondary",variant:"body2",children:i!=null&&i.fields.text?(0,t.jsx)(d.F,{text:i.fields.text,preTag:i.preTag,postTag:i.postTag}):e.text})}),(0,t.jsxs)(h.Z,{children:[e.kind&&(0,t.jsx)(a.Z,{label:`Kind: ${e.kind}`,size:"small"}),e.type&&(0,t.jsx)(a.Z,{label:`Type: ${e.type}`,size:"small"}),e.lifecycle&&(0,t.jsx)(a.Z,{label:`Lifecycle: ${e.lifecycle}`,size:"small"}),e.owner&&(0,t.jsx)(a.Z,{label:`Owner: ${e.owner}`,size:"small"})]})]})]}):null}}}]);})();
2
+
3
+ //# sourceMappingURL=7670.842d9f01.chunk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static/7670.842d9f01.chunk.js","mappings":"oUAgCA,MAAMA,KAAYC,EAAAA,GAChB,CACEC,KAAM,CACJC,QAAS,MACX,EACAC,cAAe,CACbC,SAAU,MACZ,EACAC,SAAU,CACRC,M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C,EAAOoC,cACN,OAACJ,EAAAA,EAAIA,CAACC,MAAO,cAAcjC,EAAOoC,YAAaF,KAAK,O,GAErDlC,EAAOqC,UACN,OAACL,EAAAA,EAAIA,CAACC,MAAO,UAAUjC,EAAOqC,QAASH,KAAK,O,YAzDlC,IA+DtB,C","sources":["webpack://techdocs-cli-embedded-app/../../plugins/catalog/src/components/CatalogSearchResultListItem/CatalogSearchResultListItem.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode } from 'react';\nimport {\n Box,\n Chip,\n ListItemIcon,\n ListItemText,\n Typography,\n makeStyles,\n} from '@material-ui/core';\nimport { Link } from '@backstage/core-components';\nimport {\n IndexableDocument,\n ResultHighlight,\n} from '@backstage/plugin-search-common';\nimport { HighlightedSearchResultText } from '@backstage/plugin-search-react';\n\nconst useStyles = makeStyles(\n {\n item: {\n display: 'flex',\n },\n flexContainer: {\n flexWrap: 'wrap',\n },\n itemText: {\n width: '100%',\n wordBreak: 'break-all',\n marginBottom: '1rem',\n },\n },\n { name: 'CatalogSearchResultListItem' },\n);\n\n/**\n * Props for {@link CatalogSearchResultListItem}.\n *\n * @public\n */\nexport interface CatalogSearchResultListItemProps {\n icon?: ReactNode | ((result: IndexableDocument) => ReactNode);\n result?: IndexableDocument;\n highlight?: ResultHighlight;\n rank?: number;\n lineClamp?: number;\n}\n\n/** @public */\nexport function CatalogSearchResultListItem(\n props: CatalogSearchResultListItemProps,\n) {\n const result = props.result as any;\n const highlight = props.highlight as ResultHighlight;\n\n const classes = useStyles();\n\n if (!result) return null;\n\n return (\n <div className={classes.item}>\n {props.icon && (\n <ListItemIcon>\n {typeof props.icon === 'function' ? props.icon(result) : props.icon}\n </ListItemIcon>\n )}\n <div className={classes.flexContainer}>\n <ListItemText\n className={classes.itemText}\n primaryTypographyProps={{ variant: 'h6' }}\n primary={\n <Link noTrack to={result.location}>\n {highlight?.fields.title ? (\n <HighlightedSearchResultText\n text={highlight.fields.title}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.title\n )}\n </Link>\n }\n secondary={\n <Typography\n component=\"span\"\n style={{\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: props.lineClamp,\n overflow: 'hidden',\n }}\n color=\"textSecondary\"\n variant=\"body2\"\n >\n {highlight?.fields.text ? (\n <HighlightedSearchResultText\n text={highlight.fields.text}\n preTag={highlight.preTag}\n postTag={highlight.postTag}\n />\n ) : (\n result.text\n )}\n </Typography>\n }\n />\n <Box>\n {result.kind && <Chip label={`Kind: ${result.kind}`} size=\"small\" />}\n {result.type && <Chip label={`Type: ${result.type}`} size=\"small\" />}\n {result.lifecycle && (\n <Chip label={`Lifecycle: ${result.lifecycle}`} size=\"small\" />\n )}\n {result.owner && (\n <Chip label={`Owner: ${result.owner}`} size=\"small\" />\n )}\n </Box>\n </div>\n </div>\n );\n}\n"],"names":["useStyles","makeStyles","item","display","flexContainer","flexWrap","itemText","width","wordBreak","marginBottom","name","CatalogSearchResultListItem","props","result","highlight","classes","div","className","icon","ListItemIcon","ListItemText","primaryTypographyProps","variant","primary","Link","noTrack","to","location","fields","title","HighlightedSearchResultText","text","preTag","postTag","secondary","Typography","component","style","WebkitBoxOrient","WebkitLineClamp","lineClamp","overflow","color","Box","kind","Chip","label","size","type","lifecycle","owner"],"sourceRoot":""}