@techdocs/cli 1.8.9 → 1.8.10
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 +6 -0
- package/dist/cjs/{serve-Di1O6Sm4.cjs.js → serve-jFxB5mn3.cjs.js} +2 -2
- package/dist/cjs/serve-jFxB5mn3.cjs.js.map +1 -0
- package/dist/embedded-app/.config-schema.json +45 -45
- package/dist/embedded-app/index.html +1 -1
- package/dist/embedded-app/static/4036.23d8f59c.chunk.js +3 -0
- package/dist/embedded-app/static/4036.23d8f59c.chunk.js.map +1 -0
- package/dist/embedded-app/static/9605.b5a1f3d6.chunk.js +11 -0
- package/dist/embedded-app/static/9605.b5a1f3d6.chunk.js.map +1 -0
- package/dist/embedded-app/static/{main.e02a8f27.js → main.04529c71.js} +1 -1
- package/dist/embedded-app/static/{main.e02a8f27.js.map → main.04529c71.js.map} +1 -1
- package/dist/embedded-app/static/{runtime.e02a8f27.js → runtime.04529c71.js} +2 -2
- package/dist/embedded-app/static/{runtime.e02a8f27.js.map → runtime.04529c71.js.map} +1 -1
- package/dist/embedded-app/static/{vendor.e02a8f27.js → vendor.04529c71.js} +1 -1
- package/dist/embedded-app/static/{vendor.e02a8f27.js.map → vendor.04529c71.js.map} +1 -1
- package/dist/index.cjs.js +2 -2
- package/package.json +2 -2
- package/dist/cjs/serve-Di1O6Sm4.cjs.js.map +0 -1
- package/dist/embedded-app/static/4036.509d373a.chunk.js +0 -3
- package/dist/embedded-app/static/4036.509d373a.chunk.js.map +0 -1
- package/dist/embedded-app/static/9605.3cd9c86f.chunk.js +0 -11
- package/dist/embedded-app/static/9605.3cd9c86f.chunk.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -62,7 +62,7 @@ class HTTPServer {
|
|
|
62
62
|
const server = http__default.default.createServer(
|
|
63
63
|
(request, response) => {
|
|
64
64
|
var _a;
|
|
65
|
-
if (request.url === "/api/techdocs/cookie") {
|
|
65
|
+
if (request.url === "/api/techdocs/.backstage/auth/v1/cookie") {
|
|
66
66
|
const oneHourInMilliseconds = 60 * 60 * 1e3;
|
|
67
67
|
const expiresAt = new Date(Date.now() + oneHourInMilliseconds);
|
|
68
68
|
const cookie = { expiresAt: expiresAt.toISOString() };
|
|
@@ -210,4 +210,4 @@ Opening browser.`
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
exports.default = serve;
|
|
213
|
-
//# sourceMappingURL=serve-
|
|
213
|
+
//# sourceMappingURL=serve-jFxB5mn3.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-jFxB5mn3.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 // This endpoind is used by the frontend to issue a cookie for the user.\n // But the MkDocs server doesn't expose it as a the Backestage backend does.\n // So we need to fake it here to prevent 404 errors.\n if (request.url === '/api/techdocs/.backstage/auth/v1/cookie') {\n const oneHourInMilliseconds = 60 * 60 * 1000;\n const expiresAt = new Date(Date.now() + oneHourInMilliseconds);\n const cookie = { expiresAt: expiresAt.toISOString() };\n response.setHeader('Content-Type', 'application/json');\n response.end(JSON.stringify(cookie));\n return;\n }\n\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,aAAA,CAAA,IAAA,EAAA,qBAAA,CAAA,CAAA;AACjB,IAAiB,aAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;AAQf,IAAA,IAAA,CAAK,aAAgB,GAAA,gBAAA,CAAA;AACrB,IAAA,IAAA,CAAK,kBAAqB,GAAA,k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AAA,KACF,CAAA;AAAA,GACF;AAEA,EAAM,MAAA,IAAA,GAAO,SAAY,GAAA,oBAAA,GAAuB,IAAK,CAAA,cAAA,CAAA;AACrD,EAAM,MAAA,cAAA,GAAiB,kBAAkB,IAAI,CAAA,CAAA;AAC7C,EAAA,MAAM,aAAa,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,4BAAA,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,mBAAA,CAAA,MAAA,CAAO,aAAe,EAAA,EAAE,CAAA,CAAA;AAAA,KAC5B,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
|
|
@@ -323,51 +323,6 @@
|
|
|
323
323
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
324
324
|
}
|
|
325
325
|
},
|
|
326
|
-
{
|
|
327
|
-
"path": "../core-components/config.d.ts",
|
|
328
|
-
"value": {
|
|
329
|
-
"type": "object",
|
|
330
|
-
"properties": {
|
|
331
|
-
"auth": {
|
|
332
|
-
"type": "object",
|
|
333
|
-
"properties": {
|
|
334
|
-
"autologout": {
|
|
335
|
-
"description": "Autologout feature configuration",
|
|
336
|
-
"type": "object",
|
|
337
|
-
"properties": {
|
|
338
|
-
"enabled": {
|
|
339
|
-
"description": "Enable or disable the autologout feature",
|
|
340
|
-
"visibility": "frontend",
|
|
341
|
-
"type": "boolean"
|
|
342
|
-
},
|
|
343
|
-
"idleTimeoutMinutes": {
|
|
344
|
-
"description": "Number of minutes after which the inactive user is logged out automatically.\nDefault is 60 minutes (1 hour)",
|
|
345
|
-
"visibility": "frontend",
|
|
346
|
-
"type": "number"
|
|
347
|
-
},
|
|
348
|
-
"promptBeforeIdleSeconds": {
|
|
349
|
-
"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.",
|
|
350
|
-
"visibility": "frontend",
|
|
351
|
-
"type": "number"
|
|
352
|
-
},
|
|
353
|
-
"useWorkerTimers": {
|
|
354
|
-
"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.",
|
|
355
|
-
"visibility": "frontend",
|
|
356
|
-
"type": "boolean"
|
|
357
|
-
},
|
|
358
|
-
"logoutIfDisconnected": {
|
|
359
|
-
"description": "Enable/disable the automatic logout also on users that are logged in but with no Backstage tabs open.\nDefault is true.",
|
|
360
|
-
"visibility": "frontend",
|
|
361
|
-
"type": "boolean"
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
},
|
|
368
|
-
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
369
|
-
}
|
|
370
|
-
},
|
|
371
326
|
{
|
|
372
327
|
"path": "../../plugins/techdocs/config.d.ts",
|
|
373
328
|
"value": {
|
|
@@ -416,6 +371,51 @@
|
|
|
416
371
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
417
372
|
}
|
|
418
373
|
},
|
|
374
|
+
{
|
|
375
|
+
"path": "../core-components/config.d.ts",
|
|
376
|
+
"value": {
|
|
377
|
+
"type": "object",
|
|
378
|
+
"properties": {
|
|
379
|
+
"auth": {
|
|
380
|
+
"type": "object",
|
|
381
|
+
"properties": {
|
|
382
|
+
"autologout": {
|
|
383
|
+
"description": "Autologout feature configuration",
|
|
384
|
+
"type": "object",
|
|
385
|
+
"properties": {
|
|
386
|
+
"enabled": {
|
|
387
|
+
"description": "Enable or disable the autologout feature",
|
|
388
|
+
"visibility": "frontend",
|
|
389
|
+
"type": "boolean"
|
|
390
|
+
},
|
|
391
|
+
"idleTimeoutMinutes": {
|
|
392
|
+
"description": "Number of minutes after which the inactive user is logged out automatically.\nDefault is 60 minutes (1 hour)",
|
|
393
|
+
"visibility": "frontend",
|
|
394
|
+
"type": "number"
|
|
395
|
+
},
|
|
396
|
+
"promptBeforeIdleSeconds": {
|
|
397
|
+
"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.",
|
|
398
|
+
"visibility": "frontend",
|
|
399
|
+
"type": "number"
|
|
400
|
+
},
|
|
401
|
+
"useWorkerTimers": {
|
|
402
|
+
"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.",
|
|
403
|
+
"visibility": "frontend",
|
|
404
|
+
"type": "boolean"
|
|
405
|
+
},
|
|
406
|
+
"logoutIfDisconnected": {
|
|
407
|
+
"description": "Enable/disable the automatic logout also on users that are logged in but with no Backstage tabs open.\nDefault is true.",
|
|
408
|
+
"visibility": "frontend",
|
|
409
|
+
"type": "boolean"
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
419
|
{
|
|
420
420
|
"path": "../integration/config.d.ts",
|
|
421
421
|
"value": {
|
|
@@ -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 source framework 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><meta name="backstage-app-mode" content="public"><script defer="defer" src="/static/runtime.
|
|
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 source framework 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><meta name="backstage-app-mode" content="public"><script defer="defer" src="/static/runtime.04529c71.js"></script><script defer="defer" src="/static/module-material-ui.1eefc717.js"></script><script defer="defer" src="/static/module-material-table.145eb704.js"></script><script defer="defer" src="/static/module-lodash.1a2b8e11.js"></script><script defer="defer" src="/static/module-mui.3056800b.js"></script><script defer="defer" src="/static/module-react-dom.3e65b8bc.js"></script><script defer="defer" src="/static/module-react-router.07ec2a81.js"></script><script defer="defer" src="/static/module-react-router-dom.ba9d01bf.js"></script><script defer="defer" src="/static/module-react-beautiful-dnd.8a51ed97.js"></script><script defer="defer" src="/static/module-zod.955be94f.js"></script><script defer="defer" src="/static/module-i18next.40b7c233.js"></script><script defer="defer" src="/static/vendor.04529c71.js"></script><script defer="defer" src="/static/main.04529c71.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([[4036],{70048:function(I,v,t){t.d(v,{K:function(){return a}});var e=t(18690);function a(C){return(0,e.g)()}},93160:function(I,v,t){t.d(v,{b:function(){return V},W:function(){return Z}});var e=t(31085),a=t(14041),C=t(18690),D=t(24504),P=t(72020),x=t(86892),B=t(16203),L=t(45061),S=t(39299),K=t(82779),U=t(70048),m=t(19402),W=t(22020),F=t(82266),R=t(64947),M=t(72427),O=t(70795),p=t(57405),H=t(16261);function Y(u,c){const[E,h]=(0,a.useState)({status:"not-executed",error:void 0,result:c}),s=(0,a.useRef)(),n=(0,a.useRef)(),g=(0,H.J)({execute(...l){n.current=l;const i=u(...l);return s.current=i,h(o=>({...o,status:"loading"})),i.then(o=>{i===s.current&&h(r=>({...r,status:"success",error:void 0,result:o}))},o=>{i===s.current&&h(r=>({...r,status:"error",error:o}))}),i},reset(){h({status:"not-executed",error:void 0,result:c}),s.current=void 0,n.current=void 0}});return[E,(0,a.useMemo)(()=>({reset(){g.current.reset()},execute:(...l)=>g.current.execute(...l)}),[]),{promise:s.current,lastArgs:n.current}]}var $=t(76842),N=t(70835);const T="/.backstage/auth/v1/cookie",y=365*24*36e5;function A(u){const{pluginId:c}=u!=null?u:{},E=(0,M.gf)(O.a),h=(0,M.gf)(p.I),s=(0,a.useMemo)(()=>"BroadcastChannel"in window?new BroadcastChannel(`${c}-auth-cookie-expires-at`):null,[c]),[n,g]=Y(async()=>{const r=`${await h.getBaseUrl(c)}${T}`,d=await E.fetch(`${r}`,{credentials:"include"});if(!d.ok){if(d.status===404)return{expiresAt:new Date(Date.now()+y)};throw await N.o.fromResponse(d)}const f=await d.json();if(!f.expiresAt)throw new Error("No expiration date found in response");return f});(0,$.u)(g.execute);const l=(0,a.useCallback)(()=>{g.execute()},[g]),i=(0,a.useCallback)(o=>{const r=(1+3*Math.random())*6e4,d=Date.parse(o.expiresAt)-Date.now()-r,f=setTimeout(l,d);return()=>clearTimeout(f)},[l]);return(0,a.useEffect)(()=>{if(n.status!=="success"||!n.result)return()=>{};s==null||s.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:n.result});let o=i(n.result);const r=d=>{const{action:f,payload:z}=d.data;f==="COOKIE_REFRESH_SUCCESS"&&(o(),o=i(z))};return s==null||s.addEventListener("message",r),()=>{o(),s==null||s.removeEventListener("message",r)}},[n,i,s]),n.status==="not-executed"?{status:"loading"}:n.status==="loading"&&!n.result?{status:"loading"}:n.status==="loading"&&n.error?{status:"loading"}:n.status==="error"&&n.error?{status:"error",error:n.error,retry:l}:{status:"success",data:n.result}}function j(u){const{children:c,...E}=u,h=(0,F.n)(),{Progress:s}=h.getComponents(),n=A(E);return n.status==="loading"?(0,e.jsx)(s,{}):n.status==="error"?(0,e.jsx)(W.b,{error:n.error,children:(0,e.jsx)(R.A,{variant:"outlined",onClick:n.retry,children:"Retry"})}):(0,e.jsx)(e.Fragment,{children:c})}const V=u=>{const{withSearch:c,withHeader:E=!0}=u;return(0,e.jsxs)(D.Y,{themeId:"documentation",children:[E&&(0,e.jsx)(L.T,{}),(0,e.jsx)(S.Z,{}),(0,e.jsx)(B.p,{withSearch:c})]})},Z=u=>{const{kind:c,name:E,namespace:h}=(0,U.K)(K.Oc),{children:s,entityRef:n={kind:c,name:E,namespace:h}}=u,g=(0,C.P1)();if(!s){const o=(g?a.Children.toArray(g.props.children):[]).flatMap(r=>{var d,f;return(f=r==null||(d=r.props)===null||d===void 0?void 0:d.children)!==null&&f!==void 0?f:[]}).find(r=>!(0,m.E)(r,P.AF)&&!(0,m.E)(r,P.Wm));return(0,e.jsx)(j,{pluginId:"techdocs",children:(0,e.jsx)(x.R,{entityRef:n,children:o||(0,e.jsx)(V,{})})})}return(0,e.jsx)(j,{pluginId:"techdocs",children:(0,e.jsx)(x.R,{entityRef:n,children:({metadata:l,entityMetadata:i,onReady:o})=>(0,e.jsx)("div",{className:"techdocs-reader-page",children:(0,e.jsx)(D.Y,{themeId:"documentation",children:s instanceof Function?s({entityRef:n,techdocsMetadataValue:l.value,entityMetadataValue:i.value,onReady:o}):s})})})})}},84036:function(I,v,t){t.r(v),t.d(v,{TechDocsReaderLayout:function(){return e.b},TechDocsReaderPage:function(){return e.W}});var e=t(93160)},39299:function(I,v,t){t.d(v,{Z:function(){return F}});var e=t(31085),a=t(14041),C=t(58837),D=t(29365),P=t(75173),x=t(71677),B=t(37757),L=t(10394),S=t(9684),K=t(86892),U=t(72020),m=t(99730);const W=(0,C.A)(R=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:R.spacing(3,3,0),"@media print":{display:"none"}}})),F=R=>{const M=W(),[O,p]=(0,a.useState)(null),H=(0,a.useCallback)(j=>{p(j.currentTarget)},[]),Y=(0,a.useCallback)(()=>{p(null)},[]),{entityMetadata:{value:$,loading:N}}=(0,K.V)(),T=(0,U.YR)(),y=T.renderComponentsByLocation(m.e.Subheader),A=T.renderComponentsByLocation(m.e.Settings);return!y&&!A||N===!1&&!$?null:(0,e.jsx)(P.A,{classes:M,...R.toolbarProps,children:(0,e.jsxs)(L.A,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[y,A?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(x.Ay,{title:"Settings",children:(0,e.jsx)(D.A,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:H,children:(0,e.jsx)(S.A,{})})}),(0,e.jsx)(B.A,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:O,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!!O,onClose:Y,keepMounted:!0,children:(0,e.jsx)("div",{children:A})})]}):null]})})}}}]);})();
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=4036.23d8f59c.chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static/4036.23d8f59c.chunk.js","mappings":"kMAwBO,SAASA,EACdC,EAAiD,CAEjD,SAAOC,EAAAA,GAAU,CACnB,C,oSC1BO,SAASC,EAASC,EAASC,EAAc,CAC5C,KAAM,CAACC,EAAOC,CAAQ,KAAI,YAAS,CAC/B,OAAQ,eACR,MAAO,OACP,OAAQF,CACZ,CAAC,EACKG,KAAa,UAAO,EACpBC,KAAU,UAAO,EACjBC,KAAUC,EAAA,GAAa,CACzB,WAAWC,EAAQ,CACfH,EAAQ,QAAUG,EAClB,MAAMC,EAAUT,EAAQ,GAAGQ,CAAM,EACjC,OAAAJ,EAAW,QAAUK,EACrBN,EAAUO,IAAO,CAAE,GAAGA,EAAG,OAAQ,SAAU,EAAE,EAC7CD,EAAQ,KAAME,GAAW,CACjBF,IAAYL,EAAW,SACvBD,EAAUO,IAAO,CAAE,GAAGA,EAAG,OAAQ,UAAW,MAAO,OAAW,OAAAC,CAAO,EAAE,CAE/E,EAAIC,GAAU,CACNH,IAAYL,EAAW,SACvBD,EAAUO,IAAO,CAAE,GAAGA,EAAG,OAAQ,QAAS,MAAAE,CAAM,EAAE,CAE1D,CAAC,EACMH,CACX,EACA,OAAQ,CACJN,EAAS,CACL,OAAQ,eACR,MAAO,OACP,OAAQF,CACZ,CAAC,EACDG,EAAW,QAAU,OACrBC,EAAQ,QAAU,MACtB,CACJ,CAAC,EACD,MAAO,CACHH,KACA,WAAQ,KAAO,CACX,OAAQ,CACJI,EAAQ,QAAQ,MAAM,CAC1B,EACA,QAAS,IAAIE,IAAWF,EAAQ,QAAQ,QAAQ,GAAGE,CAAM,CAC7D,GAAI,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e,WACfC,MAAM,OACNC,SAAS,O,UAERX,EACAI,KACC,oB,aACE,OAACQ,EAAAA,GAAOA,CAACC,MAAM,W,YACb,OAACC,EAAAA,EAAUA,CACTC,gBAAc,iCACdC,gBAAc,OACd3E,QAASmD,E,YAET,OAACyB,EAAAA,EAAYA,CAAAA,CAAAA,C,QAGjB,OAACC,EAAAA,EAAIA,CACHC,GAAG,iCACHC,mBAAoB,KACpB/B,SAAUA,EACVgC,aAAc,CAAEC,SAAU,SAAUC,WAAY,OAAQ,EACxDC,KAAMC,EAAQpC,EACdqC,QAAShC,EACTiC,YAAW,G,YAEX,OAACvD,MAAAA,C,SAAKgC,C,QAGR,I,KAIZ,C","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../node_modules/@react-hookz/web/src/useAsync/index.js","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.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 { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\n}\n","import { useMemo, useRef, useState } from 'react';\nimport { useSyncedRef } from '../useSyncedRef/index.js';\nexport function useAsync(asyncFn, initialValue) {\n const [state, setState] = useState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n const promiseRef = useRef();\n const argsRef = useRef();\n const methods = useSyncedRef({\n execute(...params) {\n argsRef.current = params;\n const promise = asyncFn(...params);\n promiseRef.current = promise;\n setState((s) => ({ ...s, status: 'loading' }));\n promise.then((result) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'success', error: undefined, result }));\n }\n }, (error) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'error', error }));\n }\n });\n return promise;\n },\n reset() {\n setState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n promiseRef.current = undefined;\n argsRef.current = undefined;\n },\n });\n return [\n state,\n useMemo(() => ({\n reset() {\n methods.current.reset();\n },\n execute: (...params) => methods.current.execute(...params),\n }), []),\n { promise: promiseRef.current, lastArgs: argsRef.current },\n ];\n}\n","/*\n * Copyright 2024 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 { useEffect, useCallback, useMemo } from 'react';\nimport {\n discoveryApiRef,\n fetchApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsync, useMountEffect } from '@react-hookz/web';\nimport { ResponseError } from '@backstage/errors';\n\nconst COOKIE_PATH = '/.backstage/auth/v1/cookie';\nconst ONE_YEAR_MS = 365 * 24 * 3600_000;\n\n/**\n * @public\n * A hook that will refresh the cookie when it is about to expire.\n * @param options - Options for configuring the refresh cookie endpoint\n */\nexport function useCookieAuthRefresh(options: {\n // The plugin id used for discovering the API origin\n pluginId: string;\n}):\n | { status: 'loading' }\n | { status: 'error'; error: Error; retry: () => void }\n | { status: 'success'; data: { expiresAt: string } } {\n const { pluginId } = options ?? {};\n const fetchApi = useApi(fetchApiRef);\n const discoveryApi = useApi(discoveryApiRef);\n\n const channel = useMemo(() => {\n return 'BroadcastChannel' in window\n ? new BroadcastChannel(`${pluginId}-auth-cookie-expires-at`)\n : null;\n }, [pluginId]);\n\n const [state, actions] = useAsync<{ expiresAt: string }>(async () => {\n const apiOrigin = await discoveryApi.getBaseUrl(pluginId);\n const requestUrl = `${apiOrigin}${COOKIE_PATH}`;\n const response = await fetchApi.fetch(`${requestUrl}`, {\n credentials: 'include',\n });\n if (!response.ok) {\n // If we get a 404 from the cookie endpoint we assume that it does not\n // exist and cookie auth is not needed. For all active tabs we don't\n // schedule another refresh for the forseeable future, but new tabs will\n // still check if cookie auth has been added to the deployment.\n // TODO(Rugvip): Once the legacy backend system is no longer supported we should remove this check\n if (response.status === 404) {\n return { expiresAt: new Date(Date.now() + ONE_YEAR_MS) };\n }\n throw await ResponseError.fromResponse(response);\n }\n const data = await response.json();\n if (!data.expiresAt) {\n throw new Error('No expiration date found in response');\n }\n return data;\n });\n\n useMountEffect(actions.execute);\n\n const retry = useCallback(() => {\n actions.execute();\n }, [actions]);\n\n const refresh = useCallback(\n (params: { expiresAt: string }) => {\n // Randomize the refreshing margin with a margin of 1-4 minutes to avoid all tabs refreshing at the same time\n // It cannot be less than 5 minutes otherwise the backend will return the same expiration date\n const margin = (1 + 3 * Math.random()) * 60000;\n const delay = Date.parse(params.expiresAt) - Date.now() - margin;\n const timeout = setTimeout(retry, delay);\n return () => clearTimeout(timeout);\n },\n [retry],\n );\n\n useEffect(() => {\n // Only schedule a refresh if we have a successful response\n if (state.status !== 'success' || !state.result) {\n return () => {};\n }\n channel?.postMessage({\n action: 'COOKIE_REFRESH_SUCCESS',\n payload: state.result,\n });\n let cancel = refresh(state.result);\n const listener = (\n event: MessageEvent<{ action: string; payload: { expiresAt: string } }>,\n ) => {\n const { action, payload } = event.data;\n if (action === 'COOKIE_REFRESH_SUCCESS') {\n cancel();\n cancel = refresh(payload);\n }\n };\n channel?.addEventListener('message', listener);\n return () => {\n cancel();\n channel?.removeEventListener('message', listener);\n };\n }, [state, refresh, channel]);\n\n // Initialising\n if (state.status === 'not-executed') {\n return { status: 'loading' };\n }\n\n // First refresh or retrying without any success before\n // Possible state transitions:\n // e.g. not-executed -> loading (first-refresh)\n // e.g. not-executed -> loading (first-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && !state.result) {\n return { status: 'loading' };\n }\n\n // Retrying after having succeeding at least once\n // Current state is: { status: 'loading', result: {...}, error: undefined | Error }\n // e.g. not-executed -> loading (first-refresh) -> success -> loading (scheduled-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && state.error) {\n return { status: 'loading' };\n }\n\n // Something went wrong during any situation of a refresh\n if (state.status === 'error' && state.error) {\n return { status: 'error', error: state.error, retry };\n }\n\n // At this point it should be safe to assume that we have a successful refresh\n return { status: 'success', data: state.result! };\n}\n","/*\n * Copyright 2024 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 { ErrorPanel } from '@backstage/core-components';\nimport { useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport { useCookieAuthRefresh } from '../../hooks';\n\n/**\n * @public\n * Props for the {@link CookieAuthRefreshProvider} component.\n */\nexport type CookieAuthRefreshProviderProps = {\n // The plugin ID used for discovering the API origin\n pluginId: string;\n // The children to render when the refresh is successful\n children: ReactNode;\n};\n\n/**\n * @public\n * A provider that will refresh the cookie when it is about to expire.\n */\nexport function CookieAuthRefreshProvider(\n props: CookieAuthRefreshProviderProps,\n): JSX.Element {\n const { children, ...options } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n\n const result = useCookieAuthRefresh(options);\n\n if (result.status === 'loading') {\n return <Progress />;\n }\n\n if (result.status === 'error') {\n return (\n <ErrorPanel error={result.error}>\n <Button variant=\"outlined\" onClick={result.retry}>\n Retry\n </Button>\n </ErrorPanel>\n );\n }\n\n return <>{children}</>;\n}\n","/*\n * Copyright 2022 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, Children, ReactElement } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport { Page } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TECHDOCS_ADDONS_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\n\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\n\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\n\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n};\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n if (!children) {\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n const page: React.ReactNode = grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n return (\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n );\n }\n\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <div className=\"techdocs-reader-page\">\n <Page themeId=\"documentation\">\n {children instanceof Function\n ? children({\n entityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </Page>\n </div>\n )}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n );\n};\n","/*\n * Copyright 2022 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, { MouseEvent, useState, useCallback } from 'react';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { ToolbarProps } from '@material-ui/core/Toolbar';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Menu from '@material-ui/core/Menu';\nimport Box from '@material-ui/core/Box';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport {\n TechDocsAddonLocations as locations,\n useTechDocsAddons,\n useTechDocsReaderPage,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageSubheader',\n flexDirection: 'column',\n minHeight: 'auto',\n padding: theme.spacing(3, 3, 0),\n '@media print': {\n display: 'none',\n },\n },\n}));\n\n/**\n * Renders the reader page subheader.\n * Please use the Tech Docs add-ons to customize it\n * @public\n */\nexport const TechDocsReaderPageSubheader = (props: {\n toolbarProps?: ToolbarProps;\n}) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const handleClose = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const {\n entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },\n } = useTechDocsReaderPage();\n\n const addons = useTechDocsAddons();\n\n const subheaderAddons = addons.renderComponentsByLocation(\n locations.Subheader,\n );\n\n const settingsAddons = addons.renderComponentsByLocation(locations.Settings);\n\n if (!subheaderAddons && !settingsAddons) return null;\n\n // No entity metadata = 404. Don't render subheader on 404.\n if (entityMetadataLoading === false && !entityMetadata) return null;\n\n return (\n <Toolbar classes={classes} {...props.toolbarProps}>\n <Box\n display=\"flex\"\n justifyContent=\"flex-end\"\n width=\"100%\"\n flexWrap=\"wrap\"\n >\n {subheaderAddons}\n {settingsAddons ? (\n <>\n <Tooltip title=\"Settings\">\n <IconButton\n aria-controls=\"tech-docs-reader-page-settings\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n >\n <SettingsIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"tech-docs-reader-page-settings\"\n getContentAnchorEl={null}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n open={Boolean(anchorEl)}\n onClose={handleClose}\n keepMounted\n >\n <div>{settingsAddons}</div>\n </Menu>\n </>\n ) : null}\n </Box>\n </Toolbar>\n );\n};\n"],"names":["useRouteRefParams","_routeRef","useParams","useAsync","asyncFn","initialValue","state","setState","promiseRef","argsRef","methods","useSyncedRef","params","promise","s","result","error","COOKIE_PATH","ONE_YEAR_MS","useCookieAuthRefresh","options","pluginId","fetchApi","useApi","fetchApiRef","discoveryApi","discoveryApiRef","channel","useMemo","window","BroadcastChannel","actions","requestUrl","getBaseUrl","response","fetch","credentials","ok","status","expiresAt","Date","now","ResponseError","fromResponse","data","json","Error","useMountEffect","execute","retry","useCallback","refresh","margin","Math","random","delay","parse","timeout","setTimeout","clearTimeout","useEffect","postMessage","action","payload","cancel","listener","event","addEventListener","removeEventListener","CookieAuthRefreshProvider","props","children","app","useApp","Progress","getComponents","ErrorPanel","Button","variant","onClick","TechDocsReaderLayout","withSearch","withHeader","Page","themeId","TechDocsReaderPageHeader","TechDocsReaderPageSubheader","TechDocsReaderPageContent","TechDocsReaderPage","kind","name","namespace","rootDocsRouteRef","entityRef","outlet","useOutlet","page","Children","toArray","flatMap","child","find","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","TechDocsReaderPageProvider","metadata","entityMetadata","onReady","div","className","Function","techdocsMetadataValue","value","entityMetadataValue","useStyles","makeStyles","theme","root","gridArea","flexDirection","minHeight","padding","spacing","display","classes","anchorEl","setAnchorEl","useState","handleClick","currentTarget","handleClose","loading","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","renderComponentsByLocation","locations","Subheader","settingsAddons","Settings","Toolbar","toolbarProps","Box","justifyContent","width","flexWrap","Tooltip","title","IconButton","aria-controls","aria-haspopup","SettingsIcon","Menu","id","getContentAnchorEl","anchorOrigin","vertical","horizontal","open","Boolean","onClose","keepMounted"],"sourceRoot":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";(()=>{(self.webpackChunktechdocs_cli_embedded_app=self.webpackChunktechdocs_cli_embedded_app||[]).push([[9605,5788],{70048:function(N,f,t){t.d(f,{K:function(){return u}});var n=t(18690);function u(x){return(0,n.g)()}},99538:function(N,f,t){t.d(f,{T7:function(){return T},TY:function(){return S},tN:function(){return L}});var n=t(31085),u=t(6820),x=t(25862),y=t(43836),P=t(10602),M=t(14041);const j=(0,y.tK)("entity-context"),T=l=>{const{children:E,entity:A,loading:D,error:R,refresh:C}=l,p={entity:A,loading:D,error:R,refresh:C};return(0,n.jsx)(j.Provider,{value:(0,P.B)({1:p}),children:(0,n.jsx)(x.Ig,{attributes:{...A?{entityRef:(0,u.U2)(A)}:void 0},children:E})})},K=l=>_jsx(T,{entity:l.entity,loading:!l.entity,error:void 0,refresh:void 0,children:l.children});function L(){const l=(0,y.qO)("entity-context");if(!l)throw new Error("Entity context is not available");const E=l.atVersion(1);if(!E)throw new Error("EntityContext v1 not available");if(!E.entity)throw new Error("useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.");return{entity:E.entity}}function S(){const l=(0,y.qO)("entity-context");if(!l)throw new Error("Entity context is not available");const E=l.atVersion(1);if(!E)throw new Error("EntityContext v1 not available");const{entity:A,loading:D,error:R,refresh:C}=E;return{entity:A,loading:D,error:R,refresh:C}}},29605:function(N,f,t){t.r(f),t.d(f,{EmbeddedDocsRouter:function(){return z},Router:function(){return V},isTechDocsAvailable:function(){return W}});var n=t(31085),u=t(14041),x=t(18690),y=t(6820),P=t(39278),M=t(16203),j=t(39299);const T="backstage.io/techdocs-entity",K=({entity:s})=>{var e;let r=(0,y.sM)(s);if(!((e=s.metadata.annotations)===null||e===void 0)&&e[T])try{var i;r=(0,y.KU)((i=s.metadata.annotations)===null||i===void 0?void 0:i[T])}catch{}return(0,n.jsxs)(P.Wj,{entityRef:r,children:[(0,n.jsx)(j.Z,{}),(0,n.jsx)(M.p,{withSearch:!1})]})};var L=t(85788),S=t(93160),l=t(99538),E=t(10394),A=t(64947),D=t(58837),R=t(72501),C=t(44186),p=t(77310),H=t(72072);const F=(0,D.A)(s=>({code:{borderRadius:6,margin:s.spacing(2,0),background:s.palette.type==="dark"?"#444":s.palette.common.white}}),{name:"BackstageMissingAnnotationEmptyState"});function $(s,e){var r,i;const o=(e==null?void 0:e.kind)||"Component",a=(e==null?void 0:e.metadata.name)||"example",m=(e==null||(r=e.spec)===null||r===void 0?void 0:r.type)||"website",h=(e==null||(i=e.spec)===null||i===void 0?void 0:i.owner)||"user:default/guest",v=`apiVersion: backstage.io/v1alpha1
|
|
2
|
+
kind: ${o}
|
|
3
|
+
metadata:
|
|
4
|
+
name: ${a}
|
|
5
|
+
annotations:${s.map(g=>`
|
|
6
|
+
${g}: value`).join("")}
|
|
7
|
+
spec:
|
|
8
|
+
type: ${m}
|
|
9
|
+
owner: ${h}`;let d=6;const c=[];return s.forEach(()=>{c.push(d),d++}),{yamlText:v,lineNumbers:c}}function Y(s,e="Component"){const r=s.length<=1;return(0,n.jsxs)(n.Fragment,{children:["The ",r?"annotation":"annotations"," ",s.map(i=>(0,n.jsx)("code",{children:i})).reduce((i,o)=>(0,n.jsxs)(n.Fragment,{children:[i,", ",o]}))," ",r?"is":"are"," missing. You need to add the"," ",r?"annotation":"annotations"," to your ",e," if you want to enable this tool."]})}function U(s){let e;try{e=(0,l.tN)().entity}catch{}const{annotation:r,readMoreUrl:i}=s,o=Array.isArray(r)?r:[r],a=i||"https://backstage.io/docs/features/software-catalog/well-known-annotations",m=F(),h=(e==null?void 0:e.kind)||"Component",{yamlText:v,lineNumbers:d}=$(o,e);return(0,n.jsx)(C.p,{missing:"field",title:"Missing Annotation",description:Y(o,h),action:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(R.A,{variant:"body1",children:["Add the annotation to your ",h," YAML as shown in the highlighted example below:"]}),(0,n.jsx)(E.A,{className:m.code,children:(0,n.jsx)(p.z,{text:v,language:"yaml",showLineNumbers:!0,highlightedNumbers:d,customStyle:{background:"inherit",fontSize:"115%"}})}),(0,n.jsx)(A.A,{color:"primary",component:H.N_,to:a,children:"Read more"})]})})}const I="backstage.io/techdocs-ref",B="backstage.io/techdocs-entity",W=s=>{var e,r,i,o;return!!(!(s==null||(r=s.metadata)===null||r===void 0||(e=r.annotations)===null||e===void 0)&&e[I])||!!(!(s==null||(o=s.metadata)===null||o===void 0||(i=o.annotations)===null||i===void 0)&&i[B])},V=()=>(0,n.jsxs)(x.BV,{children:[(0,n.jsx)(x.qh,{path:"/",element:(0,n.jsx)(L.TechDocsIndexPage,{})}),(0,n.jsx)(x.qh,{path:"/:namespace/:kind/:name/*",element:(0,n.jsx)(S.W,{})})]}),z=s=>{var e,r;const{children:i}=s,{entity:o}=(0,l.tN)(),a=(0,x.Ye)([{path:"/*",element:(0,n.jsx)(K,{entity:o}),children:[{path:"*",element:i}]}]);return((e=o.metadata.annotations)===null||e===void 0?void 0:e[I])||((r=o.metadata.annotations)===null||r===void 0?void 0:r[B])?a:(0,n.jsx)(U,{annotation:[I]})}},85788:function(N,f,t){t.r(f),t.d(f,{TechDocsIndexPage:function(){return P}});var n=t(31085),u=t(14041),x=t(18690),y=t(85920);const P=M=>(0,x.P1)()||(0,n.jsx)(y.K,{...M})},93160:function(N,f,t){t.d(f,{b:function(){return V},W:function(){return z}});var n=t(31085),u=t(14041),x=t(18690),y=t(24504),P=t(72020),M=t(86892),j=t(16203),T=t(45061),K=t(39299),L=t(82779),S=t(70048),l=t(19402),E=t(22020),A=t(82266),D=t(64947),R=t(72427),C=t(70795),p=t(57405),H=t(16261);function F(s,e){const[r,i]=(0,u.useState)({status:"not-executed",error:void 0,result:e}),o=(0,u.useRef)(),a=(0,u.useRef)(),m=(0,H.J)({execute(...h){a.current=h;const v=s(...h);return o.current=v,i(d=>({...d,status:"loading"})),v.then(d=>{v===o.current&&i(c=>({...c,status:"success",error:void 0,result:d}))},d=>{v===o.current&&i(c=>({...c,status:"error",error:d}))}),v},reset(){i({status:"not-executed",error:void 0,result:e}),o.current=void 0,a.current=void 0}});return[r,(0,u.useMemo)(()=>({reset(){m.current.reset()},execute:(...h)=>m.current.execute(...h)}),[]),{promise:o.current,lastArgs:a.current}]}var $=t(76842),Y=t(70835);const U="/.backstage/auth/v1/cookie",I=365*24*36e5;function B(s){const{pluginId:e}=s!=null?s:{},r=(0,R.gf)(C.a),i=(0,R.gf)(p.I),o=(0,u.useMemo)(()=>"BroadcastChannel"in window?new BroadcastChannel(`${e}-auth-cookie-expires-at`):null,[e]),[a,m]=F(async()=>{const c=`${await i.getBaseUrl(e)}${U}`,g=await r.fetch(`${c}`,{credentials:"include"});if(!g.ok){if(g.status===404)return{expiresAt:new Date(Date.now()+I)};throw await Y.o.fromResponse(g)}const O=await g.json();if(!O.expiresAt)throw new Error("No expiration date found in response");return O});(0,$.u)(m.execute);const h=(0,u.useCallback)(()=>{m.execute()},[m]),v=(0,u.useCallback)(d=>{const c=(1+3*Math.random())*6e4,g=Date.parse(d.expiresAt)-Date.now()-c,O=setTimeout(h,g);return()=>clearTimeout(O)},[h]);return(0,u.useEffect)(()=>{if(a.status!=="success"||!a.result)return()=>{};o==null||o.postMessage({action:"COOKIE_REFRESH_SUCCESS",payload:a.result});let d=v(a.result);const c=g=>{const{action:O,payload:Z}=g.data;O==="COOKIE_REFRESH_SUCCESS"&&(d(),d=v(Z))};return o==null||o.addEventListener("message",c),()=>{d(),o==null||o.removeEventListener("message",c)}},[a,v,o]),a.status==="not-executed"?{status:"loading"}:a.status==="loading"&&!a.result?{status:"loading"}:a.status==="loading"&&a.error?{status:"loading"}:a.status==="error"&&a.error?{status:"error",error:a.error,retry:h}:{status:"success",data:a.result}}function W(s){const{children:e,...r}=s,i=(0,A.n)(),{Progress:o}=i.getComponents(),a=B(r);return a.status==="loading"?(0,n.jsx)(o,{}):a.status==="error"?(0,n.jsx)(E.b,{error:a.error,children:(0,n.jsx)(D.A,{variant:"outlined",onClick:a.retry,children:"Retry"})}):(0,n.jsx)(n.Fragment,{children:e})}const V=s=>{const{withSearch:e,withHeader:r=!0}=s;return(0,n.jsxs)(y.Y,{themeId:"documentation",children:[r&&(0,n.jsx)(T.T,{}),(0,n.jsx)(K.Z,{}),(0,n.jsx)(j.p,{withSearch:e})]})},z=s=>{const{kind:e,name:r,namespace:i}=(0,S.K)(L.Oc),{children:o,entityRef:a={kind:e,name:r,namespace:i}}=s,m=(0,x.P1)();if(!o){const d=(m?u.Children.toArray(m.props.children):[]).flatMap(c=>{var g,O;return(O=c==null||(g=c.props)===null||g===void 0?void 0:g.children)!==null&&O!==void 0?O:[]}).find(c=>!(0,l.E)(c,P.AF)&&!(0,l.E)(c,P.Wm));return(0,n.jsx)(W,{pluginId:"techdocs",children:(0,n.jsx)(M.R,{entityRef:a,children:d||(0,n.jsx)(V,{})})})}return(0,n.jsx)(W,{pluginId:"techdocs",children:(0,n.jsx)(M.R,{entityRef:a,children:({metadata:h,entityMetadata:v,onReady:d})=>(0,n.jsx)("div",{className:"techdocs-reader-page",children:(0,n.jsx)(y.Y,{themeId:"documentation",children:o instanceof Function?o({entityRef:a,techdocsMetadataValue:h.value,entityMetadataValue:v.value,onReady:d}):o})})})})}},39299:function(N,f,t){t.d(f,{Z:function(){return A}});var n=t(31085),u=t(14041),x=t(58837),y=t(29365),P=t(75173),M=t(71677),j=t(37757),T=t(10394),K=t(9684),L=t(86892),S=t(72020),l=t(99730);const E=(0,x.A)(D=>({root:{gridArea:"pageSubheader",flexDirection:"column",minHeight:"auto",padding:D.spacing(3,3,0),"@media print":{display:"none"}}})),A=D=>{const R=E(),[C,p]=(0,u.useState)(null),H=(0,u.useCallback)(W=>{p(W.currentTarget)},[]),F=(0,u.useCallback)(()=>{p(null)},[]),{entityMetadata:{value:$,loading:Y}}=(0,L.V)(),U=(0,S.YR)(),I=U.renderComponentsByLocation(l.e.Subheader),B=U.renderComponentsByLocation(l.e.Settings);return!I&&!B||Y===!1&&!$?null:(0,n.jsx)(P.A,{classes:R,...D.toolbarProps,children:(0,n.jsxs)(T.A,{display:"flex",justifyContent:"flex-end",width:"100%",flexWrap:"wrap",children:[I,B?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(M.Ay,{title:"Settings",children:(0,n.jsx)(y.A,{"aria-controls":"tech-docs-reader-page-settings","aria-haspopup":"true",onClick:H,children:(0,n.jsx)(K.A,{})})}),(0,n.jsx)(j.A,{id:"tech-docs-reader-page-settings",getContentAnchorEl:null,anchorEl:C,anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!!C,onClose:F,keepMounted:!0,children:(0,n.jsx)("div",{children:B})})]}):null]})})}}}]);})();
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=9605.b5a1f3d6.chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static/9605.b5a1f3d6.chunk.js","mappings":"uMAwBO,SAASA,EACdC,EAAiD,CAEjD,SAAOC,EAAAA,GAAU,CACnB,C,8KCOA,MAAMC,KAAmBC,EAAAA,IACvB,gBAAgB,EAqBLC,EAAuBC,GAAAA,CAClC,KAAM,CAAEC,SAAAA,EAAUC,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,EAAIL,EAChDM,EAAQ,CAAEJ,OAAAA,EAAQC,QAAAA,EAASC,MAAAA,EAAOC,QAAAA,CAAQ,EAGhD,SACE,OAACR,EAAiBU,SAAQ,CAACD,SAAOE,EAAAA,GAAwB,CAAE,EAAGF,CAAM,CAAC,E,YACpE,OAACG,EAAAA,GAAgBA,CACfC,WAAY,CACV,GAAIR,EAAS,CAAES,aAAWC,EAAAA,IAAmBV,CAAM,CAAE,EAAIW,MAC3D,E,SAECZ,C,IAIT,EAiBaa,EAAkBd,GAC7B,KAACD,EAAAA,CACCG,OAAQF,EAAME,OACdC,QAAS,CAASH,EAAME,OACxBE,MAAOS,OACPR,QAASQ,OACTZ,SAAUD,EAAMC,Q,GAUb,SAASc,GAAAA,CAGd,MAAMC,KAAkBC,EAAAA,IACtB,gBAAgB,EAGlB,GAAI,CAACD,EACH,MAAM,IAAIE,MAAM,iCAAiC,EAGnD,MAAMZ,EAAQU,EAAgBG,UAAU,CAAC,EACzC,GAAI,CAACb,EACH,MAAM,IAAIY,MAAM,gCAAgC,EAGlD,GAAI,CAACZ,EAAMJ,OACT,MAAM,IAAIgB,MACR,4JAA4J,EAIhK,MAAO,CAAEhB,OAAQI,EAA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AAsB,CAAC,KACvEC,EAAAA,GAAsB,EAEpBC,KAASC,EAAAA,IAAkB,EAE3BC,EAAkBF,EAAOG,2BAC7BC,EAAAA,EAAUC,SAAS,EAGfC,EAAiBN,EAAOG,2BAA2BC,EAAAA,EAAUG,QAAQ,EAK3E,MAHI,CAACL,GAAmB,CAACI,GAGrBR,IAA0B,IAAS,CAAClB,EAAuB,QAG7D,OAAC4B,EAAAA,EAAOA,CAACtJ,QAASA,EAAU,GAAGrE,EAAM4N,a,YACnC,QAAC/I,EAAAA,EAAGA,CACF6H,QAAQ,OACRmB,eAAe,WACfC,MAAM,OACNC,SAAS,O,UAERV,EACAI,KACC,oB,aACE,OAACO,EAAAA,GAAOA,CAACxJ,MAAM,W,YACb,OAACyJ,EAAAA,EAAUA,CACTC,gBAAc,iCACdC,gBAAc,OACdxD,QAASmC,E,YAET,OAACsB,EAAAA,EAAYA,CAAAA,CAAAA,C,QAGjB,OAACC,EAAAA,EAAIA,CACHC,GAAG,iCACHC,mBAAoB,KACpB5B,SAAUA,EACV6B,aAAc,CAAEC,SAAU,SAAUC,WAAY,OAAQ,EACxDC,KAAM9I,EAAQ8G,EACdiC,QAAS5B,EACT6B,YAAW,G,YAEX,OAAC5C,MAAAA,C,SAAKwB,C,QAGR,I,KAIZ,C","sources":["webpack://techdocs-cli-embedded-app/../core-plugin-api/src/routing/useRouteRefParams.ts","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/hooks/useEntity.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/EntityPageDocs.tsx","webpack://techdocs-cli-embedded-app/../../plugins/catalog-react/src/components/MissingAnnotationEmptyState/MissingAnnotationEmptyState.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/Router.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/home/components/TechDocsIndexPage.tsx","webpack://techdocs-cli-embedded-app/../../node_modules/@react-hookz/web/src/useAsync/index.js","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/hooks/useCookieAuthRefresh/useCookieAuthRefresh.tsx","webpack://techdocs-cli-embedded-app/../../plugins/auth-react/src/components/CookieAuthRefreshProvider/CookieAuthRefreshProvider.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.tsx","webpack://techdocs-cli-embedded-app/../../plugins/techdocs/src/reader/components/TechDocsReaderPageSubheader/TechDocsReaderPageSubheader.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 { useParams } from 'react-router-dom';\nimport { RouteRef, AnyParams, SubRouteRef } from './types';\n\n/**\n * React hook for retrieving dynamic params from the current URL.\n * @param _routeRef - Ref of the current route.\n * @public\n */\nexport function useRouteRefParams<Params extends AnyParams>(\n _routeRef: RouteRef<Params> | SubRouteRef<Params>,\n): Params {\n return useParams() as Params;\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 */\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { AnalyticsContext } from '@backstage/core-plugin-api';\nimport {\n createVersionedContext,\n createVersionedValueMap,\n useVersionedContext,\n} from '@backstage/version-bridge';\nimport React, { ReactNode } from 'react';\n\n/** @public */\nexport type EntityLoadingStatus<TEntity extends Entity = Entity> = {\n entity?: TEntity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n};\n\n// This context has support for multiple concurrent versions of this package.\n// It is currently used in parallel with the old context in order to provide\n// a smooth transition, but will eventually be the only context we use.\nconst NewEntityContext = createVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n);\n\n/**\n * Properties for the AsyncEntityProvider component.\n *\n * @public\n */\nexport interface AsyncEntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n loading: boolean;\n error?: Error;\n refresh?: VoidFunction;\n}\n\n/**\n * Provides a loaded entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const AsyncEntityProvider = (props: AsyncEntityProviderProps) => {\n const { children, entity, loading, error, refresh } = props;\n const value = { entity, loading, error, refresh };\n // We provide both the old and the new context, since\n // consumers might be doing things like `useContext(EntityContext)`\n return (\n <NewEntityContext.Provider value={createVersionedValueMap({ 1: value })}>\n <AnalyticsContext\n attributes={{\n ...(entity ? { entityRef: stringifyEntityRef(entity) } : undefined),\n }}\n >\n {children}\n </AnalyticsContext>\n </NewEntityContext.Provider>\n );\n};\n\n/**\n * Properties for the EntityProvider component.\n *\n * @public\n */\nexport interface EntityProviderProps {\n children: ReactNode;\n entity?: Entity;\n}\n\n/**\n * Provides an entity to be picked up by the `useEntity` hook.\n *\n * @public\n */\nexport const EntityProvider = (props: EntityProviderProps) => (\n <AsyncEntityProvider\n entity={props.entity}\n loading={!Boolean(props.entity)}\n error={undefined}\n refresh={undefined}\n children={props.children}\n />\n);\n\n/**\n * Grab the current entity from the context, throws if the entity has not yet been loaded\n * or is not available.\n *\n * @public\n */\nexport function useEntity<TEntity extends Entity = Entity>(): {\n entity: TEntity;\n} {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n if (!value.entity) {\n throw new Error(\n 'useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.',\n );\n }\n\n return { entity: value.entity as TEntity };\n}\n\n/**\n * Grab the current entity from the context, provides loading state and errors, and the ability to refresh.\n *\n * @public\n */\nexport function useAsyncEntity<\n TEntity extends Entity = Entity,\n>(): EntityLoadingStatus<TEntity> {\n const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>(\n 'entity-context',\n );\n\n if (!versionedHolder) {\n throw new Error('Entity context is not available');\n }\n const value = versionedHolder.atVersion(1);\n if (!value) {\n throw new Error('EntityContext v1 not available');\n }\n\n const { entity, loading, error, refresh } = value;\n return { entity: entity as TEntity, loading, error, refresh };\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 {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n} from '@backstage/catalog-model';\n\nimport React from 'react';\nimport { TechDocsReaderPage } from './plugin';\nimport { TechDocsReaderPageContent } from './reader/components/TechDocsReaderPageContent';\nimport { TechDocsReaderPageSubheader } from './reader/components/TechDocsReaderPageSubheader';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\ntype EntityPageDocsProps = { entity: Entity };\n\nexport const EntityPageDocs = ({ entity }: EntityPageDocsProps) => {\n let entityRef = getCompoundEntityRef(entity);\n\n if (entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) {\n try {\n entityRef = parseEntityRef(\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION],\n );\n } catch {\n // not a fan of this but we don't care if the parseEntityRef fails\n }\n }\n\n return (\n <TechDocsReaderPage entityRef={entityRef}>\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={false} />\n </TechDocsReaderPage>\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 Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { CodeSnippet, Link, EmptyState } from '@backstage/core-components';\nimport { Entity } from '@backstage/catalog-model';\nimport { useEntity } from '../../hooks';\n\n/** @public */\nexport type MissingAnnotationEmptyStateClassKey = 'code';\n\nconst useStyles = makeStyles(\n theme => ({\n code: {\n borderRadius: 6,\n margin: theme.spacing(2, 0),\n background:\n theme.palette.type === 'dark' ? '#444' : theme.palette.common.white,\n },\n }),\n { name: 'BackstageMissingAnnotationEmptyState' },\n);\n\nfunction generateYamlExample(\n annotations: string[],\n entity?: Entity,\n): { yamlText: string; lineNumbers: number[] } {\n const kind = entity?.kind || 'Component';\n const name = entity?.metadata.name || 'example';\n const type = entity?.spec?.type || 'website';\n const owner = entity?.spec?.owner || 'user:default/guest';\n\n const yamlText = `apiVersion: backstage.io/v1alpha1\nkind: ${kind}\nmetadata:\n name: ${name}\n annotations:${annotations.map(ann => `\\n ${ann}: value`).join('')}\nspec:\n type: ${type}\n owner: ${owner}`;\n\n let line = 6; // Line 6 is the line number that annotations are added to.\n const lineNumbers: number[] = [];\n annotations.forEach(() => {\n lineNumbers.push(line);\n line++;\n });\n\n return {\n yamlText,\n lineNumbers,\n };\n}\n\nfunction generateDescription(annotations: string[], entityKind = 'Component') {\n const isSingular = annotations.length <= 1;\n return (\n <>\n The {isSingular ? 'annotation' : 'annotations'}{' '}\n {annotations\n .map(ann => <code>{ann}</code>)\n .reduce((prev, curr) => (\n <>\n {prev}, {curr}\n </>\n ))}{' '}\n {isSingular ? 'is' : 'are'} missing. You need to add the{' '}\n {isSingular ? 'annotation' : 'annotations'} to your {entityKind} if you\n want to enable this tool.\n </>\n );\n}\n\n/**\n * @public\n * Renders an empty state when an annotation is missing from an entity.\n */\nexport function MissingAnnotationEmptyState(props: {\n annotation: string | string[];\n readMoreUrl?: string;\n}) {\n let entity: Entity | undefined;\n try {\n const entityContext = useEntity();\n entity = entityContext.entity;\n } catch (err) {\n // ignore when entity context doesnt exist\n }\n\n const { annotation, readMoreUrl } = props;\n const annotations = Array.isArray(annotation) ? annotation : [annotation];\n const url =\n readMoreUrl ||\n 'https://backstage.io/docs/features/software-catalog/well-known-annotations';\n const classes = useStyles();\n\n const entityKind = entity?.kind || 'Component';\n const { yamlText, lineNumbers } = generateYamlExample(annotations, entity);\n return (\n <EmptyState\n missing=\"field\"\n title=\"Missing Annotation\"\n description={generateDescription(annotations, entityKind)}\n action={\n <>\n <Typography variant=\"body1\">\n Add the annotation to your {entityKind} YAML as shown in the\n highlighted example below:\n </Typography>\n <Box className={classes.code}>\n <CodeSnippet\n text={yamlText}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={lineNumbers}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n </Box>\n <Button color=\"primary\" component={Link} to={url}>\n Read more\n </Button>\n </>\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 React, { PropsWithChildren } from 'react';\nimport { Route, Routes, useRoutes } from 'react-router-dom';\n\nimport { Entity } from '@backstage/catalog-model';\nimport { EntityPageDocs } from './EntityPageDocs';\nimport { TechDocsIndexPage } from './home/components/TechDocsIndexPage';\nimport { TechDocsReaderPage } from './reader/components/TechDocsReaderPage';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\n\nconst TECHDOCS_ANNOTATION = 'backstage.io/techdocs-ref';\n\nconst TECHDOCS_EXTERNAL_ANNOTATION = 'backstage.io/techdocs-entity';\n\n/**\n * Helper that takes in entity and returns true/false if TechDocs is available for the entity\n *\n * @public\n */\nexport const isTechDocsAvailable = (entity: Entity) =>\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_ANNOTATION]) ||\n Boolean(entity?.metadata?.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]);\n\n/**\n * Responsible for registering routes for TechDocs, TechDocs Homepage and separate TechDocs page\n *\n * @public\n */\nexport const Router = () => {\n return (\n <Routes>\n <Route path=\"/\" element={<TechDocsIndexPage />} />\n <Route\n path=\"/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n />\n </Routes>\n );\n};\n\n/**\n * Responsible for registering route to view docs on Entity page\n *\n * @public\n */\nexport const EmbeddedDocsRouter = (props: PropsWithChildren<{}>) => {\n const { children } = props;\n const { entity } = useEntity();\n\n // Using objects instead of <Route> elements, otherwise \"outlet\" will be null on sub-pages and add-ons won't render\n const element = useRoutes([\n {\n path: '/*',\n element: <EntityPageDocs entity={entity} />,\n children: [\n {\n path: '*',\n element: children,\n },\n ],\n },\n ]);\n\n const projectId =\n entity.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION];\n\n if (!projectId) {\n return <MissingAnnotationEmptyState annotation={[TECHDOCS_ANNOTATION]} />;\n }\n\n return element;\n};\n","/*\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 from 'react';\nimport { useOutlet } from 'react-router-dom';\nimport { TableColumn, TableProps } from '@backstage/core-components';\nimport { UserListFilterKind } from '@backstage/plugin-catalog-react';\nimport { DefaultTechDocsHome } from './DefaultTechDocsHome';\nimport { DocsTableRow } from './Tables';\n\n/**\n * Props for {@link TechDocsIndexPage}\n *\n * @public\n */\nexport type TechDocsIndexPageProps = {\n initialFilter?: UserListFilterKind;\n columns?: TableColumn<DocsTableRow>[];\n actions?: TableProps<DocsTableRow>['actions'];\n};\n\nexport const TechDocsIndexPage = (props: TechDocsIndexPageProps) => {\n const outlet = useOutlet();\n\n return outlet || <DefaultTechDocsHome {...props} />;\n};\n","import { useMemo, useRef, useState } from 'react';\nimport { useSyncedRef } from '../useSyncedRef/index.js';\nexport function useAsync(asyncFn, initialValue) {\n const [state, setState] = useState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n const promiseRef = useRef();\n const argsRef = useRef();\n const methods = useSyncedRef({\n execute(...params) {\n argsRef.current = params;\n const promise = asyncFn(...params);\n promiseRef.current = promise;\n setState((s) => ({ ...s, status: 'loading' }));\n promise.then((result) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'success', error: undefined, result }));\n }\n }, (error) => {\n if (promise === promiseRef.current) {\n setState((s) => ({ ...s, status: 'error', error }));\n }\n });\n return promise;\n },\n reset() {\n setState({\n status: 'not-executed',\n error: undefined,\n result: initialValue,\n });\n promiseRef.current = undefined;\n argsRef.current = undefined;\n },\n });\n return [\n state,\n useMemo(() => ({\n reset() {\n methods.current.reset();\n },\n execute: (...params) => methods.current.execute(...params),\n }), []),\n { promise: promiseRef.current, lastArgs: argsRef.current },\n ];\n}\n","/*\n * Copyright 2024 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 { useEffect, useCallback, useMemo } from 'react';\nimport {\n discoveryApiRef,\n fetchApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useAsync, useMountEffect } from '@react-hookz/web';\nimport { ResponseError } from '@backstage/errors';\n\nconst COOKIE_PATH = '/.backstage/auth/v1/cookie';\nconst ONE_YEAR_MS = 365 * 24 * 3600_000;\n\n/**\n * @public\n * A hook that will refresh the cookie when it is about to expire.\n * @param options - Options for configuring the refresh cookie endpoint\n */\nexport function useCookieAuthRefresh(options: {\n // The plugin id used for discovering the API origin\n pluginId: string;\n}):\n | { status: 'loading' }\n | { status: 'error'; error: Error; retry: () => void }\n | { status: 'success'; data: { expiresAt: string } } {\n const { pluginId } = options ?? {};\n const fetchApi = useApi(fetchApiRef);\n const discoveryApi = useApi(discoveryApiRef);\n\n const channel = useMemo(() => {\n return 'BroadcastChannel' in window\n ? new BroadcastChannel(`${pluginId}-auth-cookie-expires-at`)\n : null;\n }, [pluginId]);\n\n const [state, actions] = useAsync<{ expiresAt: string }>(async () => {\n const apiOrigin = await discoveryApi.getBaseUrl(pluginId);\n const requestUrl = `${apiOrigin}${COOKIE_PATH}`;\n const response = await fetchApi.fetch(`${requestUrl}`, {\n credentials: 'include',\n });\n if (!response.ok) {\n // If we get a 404 from the cookie endpoint we assume that it does not\n // exist and cookie auth is not needed. For all active tabs we don't\n // schedule another refresh for the forseeable future, but new tabs will\n // still check if cookie auth has been added to the deployment.\n // TODO(Rugvip): Once the legacy backend system is no longer supported we should remove this check\n if (response.status === 404) {\n return { expiresAt: new Date(Date.now() + ONE_YEAR_MS) };\n }\n throw await ResponseError.fromResponse(response);\n }\n const data = await response.json();\n if (!data.expiresAt) {\n throw new Error('No expiration date found in response');\n }\n return data;\n });\n\n useMountEffect(actions.execute);\n\n const retry = useCallback(() => {\n actions.execute();\n }, [actions]);\n\n const refresh = useCallback(\n (params: { expiresAt: string }) => {\n // Randomize the refreshing margin with a margin of 1-4 minutes to avoid all tabs refreshing at the same time\n // It cannot be less than 5 minutes otherwise the backend will return the same expiration date\n const margin = (1 + 3 * Math.random()) * 60000;\n const delay = Date.parse(params.expiresAt) - Date.now() - margin;\n const timeout = setTimeout(retry, delay);\n return () => clearTimeout(timeout);\n },\n [retry],\n );\n\n useEffect(() => {\n // Only schedule a refresh if we have a successful response\n if (state.status !== 'success' || !state.result) {\n return () => {};\n }\n channel?.postMessage({\n action: 'COOKIE_REFRESH_SUCCESS',\n payload: state.result,\n });\n let cancel = refresh(state.result);\n const listener = (\n event: MessageEvent<{ action: string; payload: { expiresAt: string } }>,\n ) => {\n const { action, payload } = event.data;\n if (action === 'COOKIE_REFRESH_SUCCESS') {\n cancel();\n cancel = refresh(payload);\n }\n };\n channel?.addEventListener('message', listener);\n return () => {\n cancel();\n channel?.removeEventListener('message', listener);\n };\n }, [state, refresh, channel]);\n\n // Initialising\n if (state.status === 'not-executed') {\n return { status: 'loading' };\n }\n\n // First refresh or retrying without any success before\n // Possible state transitions:\n // e.g. not-executed -> loading (first-refresh)\n // e.g. not-executed -> loading (first-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && !state.result) {\n return { status: 'loading' };\n }\n\n // Retrying after having succeeding at least once\n // Current state is: { status: 'loading', result: {...}, error: undefined | Error }\n // e.g. not-executed -> loading (first-refresh) -> success -> loading (scheduled-refresh) -> error -> loading (manual-retry)\n if (state.status === 'loading' && state.error) {\n return { status: 'loading' };\n }\n\n // Something went wrong during any situation of a refresh\n if (state.status === 'error' && state.error) {\n return { status: 'error', error: state.error, retry };\n }\n\n // At this point it should be safe to assume that we have a successful refresh\n return { status: 'success', data: state.result! };\n}\n","/*\n * Copyright 2024 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 { ErrorPanel } from '@backstage/core-components';\nimport { useApp } from '@backstage/core-plugin-api';\nimport Button from '@material-ui/core/Button';\nimport { useCookieAuthRefresh } from '../../hooks';\n\n/**\n * @public\n * Props for the {@link CookieAuthRefreshProvider} component.\n */\nexport type CookieAuthRefreshProviderProps = {\n // The plugin ID used for discovering the API origin\n pluginId: string;\n // The children to render when the refresh is successful\n children: ReactNode;\n};\n\n/**\n * @public\n * A provider that will refresh the cookie when it is about to expire.\n */\nexport function CookieAuthRefreshProvider(\n props: CookieAuthRefreshProviderProps,\n): JSX.Element {\n const { children, ...options } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n\n const result = useCookieAuthRefresh(options);\n\n if (result.status === 'loading') {\n return <Progress />;\n }\n\n if (result.status === 'error') {\n return (\n <ErrorPanel error={result.error}>\n <Button variant=\"outlined\" onClick={result.retry}>\n Retry\n </Button>\n </ErrorPanel>\n );\n }\n\n return <>{children}</>;\n}\n","/*\n * Copyright 2022 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, Children, ReactElement } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport { Page } from '@backstage/core-components';\nimport { CompoundEntityRef } from '@backstage/catalog-model';\nimport {\n TECHDOCS_ADDONS_WRAPPER_KEY,\n TECHDOCS_ADDONS_KEY,\n TechDocsReaderPageProvider,\n} from '@backstage/plugin-techdocs-react';\n\nimport { TechDocsReaderPageRenderFunction } from '../../../types';\n\nimport { TechDocsReaderPageContent } from '../TechDocsReaderPageContent';\nimport { TechDocsReaderPageHeader } from '../TechDocsReaderPageHeader';\nimport { TechDocsReaderPageSubheader } from '../TechDocsReaderPageSubheader';\nimport { rootDocsRouteRef } from '../../../routes';\nimport {\n getComponentData,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\n\nimport { CookieAuthRefreshProvider } from '@backstage/plugin-auth-react';\n\n/* An explanation for the multiple ways of customizing the TechDocs reader page\n\nPlease refer to this page on the microsite for the latest recommended approach:\nhttps://backstage.io/docs/features/techdocs/how-to-guides#how-to-customize-the-techdocs-reader-page\n\nThe <TechDocsReaderPage> component is responsible for rendering the <TechDocsReaderPageProvider> and\nits contained version of a <Page>, which in turn renders the <TechDocsReaderPageContent>.\n\nHistorically, there have been different approaches on how this <Page> can be customized, and how the\n<TechDocsReaderPageContent> inside could be exchanged for a custom implementation (which was not\npossible before). Also, the current implementation supports every scenario to avoid breaking default\nconfigurations of TechDocs.\n\nIn particular, there are 4 different TechDocs page configurations:\n\nCONFIGURATION 1: <TechDocsReaderPage> only, no children\n\n<Route path=\"/docs/:namespace/:kind/:name/*\" element={<TechDocsReaderPage />} >\n\nThis is the simplest way to use TechDocs. Only a full page is passed, assuming that it comes with\nits content inside. Since we allowed customizing it, we started providing <TechDocsReaderLayout> as\na default implementation (which contains <TechDocsReaderPageContent>).\n\nCONFIGURATION 2 (not advised): <TechDocsReaderPage> with element children\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {techdocsPage}\n </TechDocsReaderPage>\n }\n/>\n\nPreviously, there were two ways of passing children to <TechDocsReaderPage>: either as elements (as\nshown above), or as a render function (described below in CONFIGURATION 3). The \"techdocsPage\" is\nlocated in packages/app/src/components/techdocs and is the default implementation of the content\ninside.\n\nCONFIGURATION 3 (not advised): <TechDocsReaderPage> with render function as child\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={\n <TechDocsReaderPage>\n {({ metadata, entityMetadata, onReady }) => (\n techdocsPage\n )}\n </TechDocsReaderPage>\n }\n/>\n\nSimilar to CONFIGURATION 2, the direct children will be passed to the <TechDocsReaderPage> but in\nthis case interpreted as render prop.\n\nCONFIGURATION 4: <TechDocsReaderPage> and provided content in <Route>\n\n<Route\n path=\"/docs/:namespace/:kind/:name/*\"\n element={<TechDocsReaderPage />}\n>\n {techDocsPage}\n <TechDocsAddons>\n <ExpandableNavigation />\n <ReportIssue />\n <TextSize />\n <LightBox />\n </TechDocsAddons>\n</Route>\n\nThis is the current state in packages/app/src/App.tsx and moved the location of children from inside\nthe element prop in the <Route> to the children of the <Route>. Then, in <TechDocsReaderPage> they\nare retrieved using the useOutlet hook from React Router.\n\nNOTE: Render functions are no longer supported in this approach.\n*/\n\n/**\n * Props for {@link TechDocsReaderLayout}\n * @public\n */\nexport type TechDocsReaderLayoutProps = {\n /**\n * Show or hide the header, defaults to true.\n */\n withHeader?: boolean;\n /**\n * Show or hide the content search bar, defaults to true.\n */\n withSearch?: boolean;\n};\n\n/**\n * Default TechDocs reader page structure composed with a header and content\n * @public\n */\nexport const TechDocsReaderLayout = (props: TechDocsReaderLayoutProps) => {\n const { withSearch, withHeader = true } = props;\n return (\n <Page themeId=\"documentation\">\n {withHeader && <TechDocsReaderPageHeader />}\n <TechDocsReaderPageSubheader />\n <TechDocsReaderPageContent withSearch={withSearch} />\n </Page>\n );\n};\n\n/**\n * @public\n */\nexport type TechDocsReaderPageProps = {\n entityRef?: CompoundEntityRef;\n children?: TechDocsReaderPageRenderFunction | ReactNode;\n};\n\n/**\n * An addon-aware implementation of the TechDocsReaderPage.\n *\n * @public\n */\nexport const TechDocsReaderPage = (props: TechDocsReaderPageProps) => {\n const { kind, name, namespace } = useRouteRefParams(rootDocsRouteRef);\n const { children, entityRef = { kind, name, namespace } } = props;\n\n const outlet = useOutlet();\n\n if (!children) {\n const childrenList = outlet ? Children.toArray(outlet.props.children) : [];\n\n const grandChildren = childrenList.flatMap<ReactElement>(\n child => (child as ReactElement)?.props?.children ?? [],\n );\n\n const page: React.ReactNode = grandChildren.find(\n grandChild =>\n !getComponentData(grandChild, TECHDOCS_ADDONS_WRAPPER_KEY) &&\n !getComponentData(grandChild, TECHDOCS_ADDONS_KEY),\n );\n\n // As explained above, \"page\" is configuration 4 and <TechDocsReaderLayout> is 1\n return (\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {(page as JSX.Element) || <TechDocsReaderLayout />}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n );\n }\n\n // As explained above, a render function is configuration 3 and React element is 2\n return (\n <CookieAuthRefreshProvider pluginId=\"techdocs\">\n <TechDocsReaderPageProvider entityRef={entityRef}>\n {({ metadata, entityMetadata, onReady }) => (\n <div className=\"techdocs-reader-page\">\n <Page themeId=\"documentation\">\n {children instanceof Function\n ? children({\n entityRef,\n techdocsMetadataValue: metadata.value,\n entityMetadataValue: entityMetadata.value,\n onReady,\n })\n : children}\n </Page>\n </div>\n )}\n </TechDocsReaderPageProvider>\n </CookieAuthRefreshProvider>\n );\n};\n","/*\n * Copyright 2022 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, { MouseEvent, useState, useCallback } from 'react';\n\nimport { makeStyles } from '@material-ui/core/styles';\nimport IconButton from '@material-ui/core/IconButton';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport { ToolbarProps } from '@material-ui/core/Toolbar';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Menu from '@material-ui/core/Menu';\nimport Box from '@material-ui/core/Box';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport {\n TechDocsAddonLocations as locations,\n useTechDocsAddons,\n useTechDocsReaderPage,\n} from '@backstage/plugin-techdocs-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageSubheader',\n flexDirection: 'column',\n minHeight: 'auto',\n padding: theme.spacing(3, 3, 0),\n '@media print': {\n display: 'none',\n },\n },\n}));\n\n/**\n * Renders the reader page subheader.\n * Please use the Tech Docs add-ons to customize it\n * @public\n */\nexport const TechDocsReaderPageSubheader = (props: {\n toolbarProps?: ToolbarProps;\n}) => {\n const classes = useStyles();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const handleClick = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }, []);\n\n const handleClose = useCallback(() => {\n setAnchorEl(null);\n }, []);\n\n const {\n entityMetadata: { value: entityMetadata, loading: entityMetadataLoading },\n } = useTechDocsReaderPage();\n\n const addons = useTechDocsAddons();\n\n const subheaderAddons = addons.renderComponentsByLocation(\n locations.Subheader,\n );\n\n const settingsAddons = addons.renderComponentsByLocation(locations.Settings);\n\n if (!subheaderAddons && !settingsAddons) return null;\n\n // No entity metadata = 404. Don't render subheader on 404.\n if (entityMetadataLoading === false && !entityMetadata) return null;\n\n return (\n <Toolbar classes={classes} {...props.toolbarProps}>\n <Box\n display=\"flex\"\n justifyContent=\"flex-end\"\n width=\"100%\"\n flexWrap=\"wrap\"\n >\n {subheaderAddons}\n {settingsAddons ? (\n <>\n <Tooltip title=\"Settings\">\n <IconButton\n aria-controls=\"tech-docs-reader-page-settings\"\n aria-haspopup=\"true\"\n onClick={handleClick}\n >\n <SettingsIcon />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"tech-docs-reader-page-settings\"\n getContentAnchorEl={null}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n open={Boolean(anchorEl)}\n onClose={handleClose}\n keepMounted\n >\n <div>{settingsAddons}</div>\n </Menu>\n </>\n ) : null}\n </Box>\n </Toolbar>\n );\n};\n"],"names":["useRouteRefParams","_routeRef","useParams","NewEntityContext","createVersionedContext","AsyncEntityProvider","props","children","entity","loading","error","refresh","value","Provider","createVersionedValueMap","AnalyticsContext","attributes","entityRef","stringifyEntityRef","undefined","EntityProvider","useEntity","versionedHolder","useVersionedContext","Error","atVersion","useAsyncEntity","TECHDOCS_EXTERNAL_ANNOTATION","EntityPageDocs","getCompoundEntityRef","metadata","annotations","parseEntityRef","TechDocsReaderPage","TechDocsReaderPageSubheader","TechDocsReaderPageContent","withSearch","useStyles","makeStyles","theme","code","borderRadius","margin","spacing","background","palette","type","common","white","name","generateYamlExample","kind","spec","owner","yamlText","map","ann","join","line","lineNumbers","forEach","push","generateDescription","entityKind","isSingular","length","reduce","prev","curr","MissingAnnotationEmptyState","annotation","readMoreUrl","Array","isArray","url","classes","EmptyState","missing","title","description","action","Typography","variant","Box","className","CodeSnippet","text","language","showLineNumbers","highlightedNumbers","customStyle","fontSize","Button","color","component","Link","to","TECHDOCS_ANNOTATION","isTechDocsAvailable","Boolean","Router","Routes","Route","path","element","TechDocsIndexPage","EmbeddedDocsRouter","useRoutes","useOutlet","DefaultTechDocsHome","useAsync","asyncFn","initialValue","state","setState","promiseRef","argsRef","methods","useSyncedRef","params","promise","s","result","COOKIE_PATH","ONE_YEAR_MS","useCookieAuthRefresh","options","pluginId","fetchApi","useApi","fetchApiRef","discoveryApi","discoveryApiRef","channel","useMemo","window","BroadcastChannel","actions","requestUrl","getBaseUrl","response","fetch","credentials","ok","status","expiresAt","Date","now","ResponseError","fromResponse","data","json","useMountEffect","execute","retry","useCallback","Math","random","delay","parse","timeout","setTimeout","clearTimeout","useEffect","postMessage","payload","cancel","listener","event","addEventListener","removeEventListener","CookieAuthRefreshProvider","app","useApp","Progress","getComponents","ErrorPanel","onClick","TechDocsReaderLayout","withHeader","Page","themeId","TechDocsReaderPageHeader","namespace","rootDocsRouteRef","outlet","page","Children","toArray","flatMap","child","find","grandChild","getComponentData","TECHDOCS_ADDONS_WRAPPER_KEY","TECHDOCS_ADDONS_KEY","TechDocsReaderPageProvider","entityMetadata","onReady","div","Function","techdocsMetadataValue","entityMetadataValue","root","gridArea","flexDirection","minHeight","padding","display","anchorEl","setAnchorEl","useState","handleClick","currentTarget","handleClose","entityMetadataLoading","useTechDocsReaderPage","addons","useTechDocsAddons","subheaderAddons","renderComponentsByLocation","locations","Subheader","settingsAddons","Settings","Toolbar","toolbarProps","justifyContent","width","flexWrap","Tooltip","IconButton","aria-controls","aria-haspopup","SettingsIcon","Menu","id","getContentAnchorEl","anchorOrigin","vertical","horizontal","open","onClose","keepMounted"],"sourceRoot":""}
|
|
@@ -494,4 +494,4 @@ ${$.href}
|
|
|
494
494
|
|
|
495
495
|
Feedback:`),Kt=(X==null?void 0:X.type)==="github"?(0,Uo.F)(Q.href,"blob"):Q.href,Yt=No()(Kt),Vt=`/${Yt.organization}/${Yt.name}`,It=$.cloneNode();switch(X==null?void 0:X.type){case"gitlab":It.href=`${Q.origin}${Vt}/issues/new?issue[title]=${Ct}&issue[description]=${Ut}`;break;case"github":It.href=`${Q.origin}${Vt}/issues/new?title=${Ct}&body=${Ut}`;break;default:return I}return Tn(i.createElement(Fo.A),It),It.style.paddingLeft="5px",It.title="Leave feedback for this page",It.id="git-feedback-link",$==null||$.insertAdjacentElement("beforebegin",It),I},Qn=()=>p=>(setTimeout(()=>{const I=p==null?void 0:p.querySelectorAll("li.md-nav__item--active");I.length!==0&&(I.forEach($=>{const Q=$==null?void 0:$.querySelector("input");Q!=null&&Q.checked||Q==null||Q.click()}),I[I.length-1].scrollIntoView())},200),p);var ko=t(50868),Ko=t(10437),Zn=t(71677),Jn=t(87051),zo=t(36338);const Rn=(0,Jn.A)(p=>({tooltip:{fontSize:"inherit",color:p.palette.text.primary,margin:0,padding:p.spacing(.5),backgroundColor:"transparent",boxShadow:"none"}}))(Zn.Ay),In=()=>(0,o.jsx)(Ko.A,{children:(0,o.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"})}),Ho=({text:p})=>{const[I,F]=(0,i.useState)(!1),[,$]=(0,zo.A)(),Q=(0,i.useCallback)(()=>{$(p),F(!0)},[p,$]),X=(0,i.useCallback)(()=>{F(!1)},[F]);return(0,o.jsx)(Rn,{title:"Copied to clipboard",placement:"left",open:I,onClose:X,leaveDelay:1e3,children:(0,o.jsx)(ht.A,{style:{color:"inherit"},className:"md-clipboard md-icon",onClick:Q,children:(0,o.jsx)(In,{})})})},Xn=p=>I=>{const F=I.querySelectorAll("pre > code");for(const Q of F){var $;const X=Q.textContent||"",at=document.createElement("div");Q==null||($=Q.parentElement)===null||$===void 0||$.prepend(at),Tn((0,o.jsx)(ko.A,{theme:p,children:(0,o.jsx)(Ho,{text:X})}),at)}return I},qn=({baseUrl:p,onClick:I})=>F=>(Array.from(F.getElementsByTagName("a")).forEach($=>{$.addEventListener("click",Q=>{const at=$.getAttribute("href");at&&at.startsWith(p)&&!$.hasAttribute("download")&&(Q.preventDefault(),I(Q,at))})}),F),to=({onLoading:p,onLoaded:I})=>F=>(p(),F.addEventListener(A,function $(){I(),F.removeEventListener(A,$)}),F);function Vo(p,I){const F=new URL(I),$=`${F.origin}${F.pathname.replace(/\/$/,"")}`,Q=p.replace($,"").replace(/^\/+/,""),X=new URL(`http://localhost/${Q}`);return`${X.pathname}${X.search}${X.hash}`}function Go(){const p=(0,Wt.Zp)(),F=(0,_.gf)(q.U).getOptionalString("app.baseUrl");return(0,i.useCallback)(Q=>{let X=Q;if(F)try{X=Vo(Q,F)}catch{}p(X)},[p,F])}const _o="screen and (max-width: 76.1875em)",Yo=p=>{const I=Go(),F=(0,L.A)(),$=(0,$e.A)(_o),Q=Ce(),X=pn(),at=(0,H.s)(),Ct=(0,_.gf)(Ye.s),Ut=(0,_.gf)(f.Y),{state:Kt,path:Yt,content:Vt}=he(),[It,ce]=(0,i.useState)(null),ye=u(It),Zt=(0,i.useCallback)(()=>{if(!It)return;It.querySelectorAll(".md-sidebar").forEach(_t=>{if($)_t.style.top="0px";else{var te;const je=(te=document)===null||te===void 0?void 0:te.querySelector(".techdocs-reader-page");var Ae;const se=(Ae=je==null?void 0:je.getBoundingClientRect().top)!==null&&Ae!==void 0?Ae:0;var Be;let Ln=(Be=It.getBoundingClientRect().top)!==null&&Be!==void 0?Be:0;const Bn=It.querySelector(".md-container > .md-tabs");var Ne;const jn=(Ne=Bn==null?void 0:Bn.getBoundingClientRect().height)!==null&&Ne!==void 0?Ne:0;Ln<se&&(Ln=se);const oo=Math.max(Ln,0)+jn;_t.style.top=`${oo}px`;const nn=It.querySelector(".md-container > .md-footer");var fe;const gn=(fe=nn==null?void 0:nn.getBoundingClientRect().top)!==null&&fe!==void 0?fe:window.innerHeight;_t.style.height=`${gn-oo}px`}_t.style.setProperty("opacity","1")})},[It,$]);(0,i.useEffect)(()=>(window.addEventListener("resize",Zt),window.addEventListener("scroll",Zt,!0),()=>{window.removeEventListener("resize",Zt),window.removeEventListener("scroll",Zt,!0)}),[It,Zt]);const Gt=(0,i.useCallback)(()=>{if(!It)return;const jt=It.querySelector(".md-footer");jt&&(jt.style.width=`${It.getBoundingClientRect().width}px`)},[It]);(0,i.useEffect)(()=>(window.addEventListener("resize",Gt),()=>{window.removeEventListener("resize",Gt)}),[It,Gt]),(0,i.useEffect)(()=>{ye||(Gt(),Zt())},[Kt,ye,Gt,Zt]);const ie=(0,i.useCallback)((jt,_t)=>_n(jt,[Q,Do({techdocsStorageApi:Ct,entityId:p,path:_t}),Mo(),Yn(),Bo(),jo(),Wo(Ut),X]),[p,Ut,Ct,Q,X]),Ee=(0,i.useCallback)(async jt=>_n(jt,[Qn(),Xn(F),qn({baseUrl:window.location.origin,onClick:(_t,te)=>{var Ae;const Be=_t.ctrlKey||_t.metaKey,Ne=new URL(te),fe=((Ae=_t.target)===null||Ae===void 0?void 0:Ae.innerText)||te,je=te.replace(window.location.origin,"");if(at.captureEvent("click",fe,{attributes:{to:je}}),Ne.hash)if(Be)window.open(te,"_blank");else{var se;I(te),jt==null||(se=jt.querySelector(`[id="${Ne.hash.slice(1)}"]`))===null||se===void 0||se.scrollIntoView()}else Be?window.open(te,"_blank"):I(te)}}),to({onLoading:()=>{},onLoaded:()=>{var _t;(_t=jt.querySelector(".md-nav__title"))===null||_t===void 0||_t.removeAttribute("for")}}),to({onLoading:()=>{Array.from(jt.querySelectorAll(".md-sidebar")).forEach(te=>{te.style.setProperty("opacity","0")})},onLoaded:()=>{}})]),[F,I,at]);return(0,i.useEffect)(()=>{if(!Vt)return()=>{};let jt=!0;return ie(Vt,Yt).then(async _t=>{if(!(_t!=null&&_t.innerHTML)||!jt)return;window.scroll({top:0});const te=await Ee(_t);ce(te)}),()=>{jt=!1}},[Vt,Yt,ie,Ee]),It};var Dn=t(41883),Qo=t(72020),Mn=t(99730);const eo=()=>{const p=(0,Qo.YR)(),{shadowRoot:I}=(0,m.V)(),F=I==null?void 0:I.querySelector('[data-md-component="content"]'),$=I==null?void 0:I.querySelector('div[data-md-component="sidebar"][data-md-type="navigation"], div[data-md-component="navigation"]');let Q=$==null?void 0:$.querySelector('[data-techdocs-addons-location="primary sidebar"]');Q||(Q=document.createElement("div"),Q.setAttribute("data-techdocs-addons-location","primary sidebar"),$==null||$.prepend(Q));const X=I==null?void 0:I.querySelector('div[data-md-component="sidebar"][data-md-type="toc"], div[data-md-component="toc"]');let at=X==null?void 0:X.querySelector('[data-techdocs-addons-location="secondary sidebar"]');return at||(at=document.createElement("div"),at.setAttribute("data-techdocs-addons-location","secondary sidebar"),X==null||X.prepend(at)),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Dn.A,{container:Q,children:p.renderComponentsByLocation(Mn.e.PrimarySidebar)}),(0,o.jsx)(Dn.A,{container:F,children:p.renderComponentsByLocation(Mn.e.Content)}),(0,o.jsx)(Dn.A,{container:at,children:p.renderComponentsByLocation(Mn.e.SecondarySidebar)})]})},no=(0,O.A)({search:{width:"100%","@media (min-width: 76.1875em)":{width:"calc(100% - 34.4rem)",margin:"0 auto"},"@media print":{display:"none"}}}),Rt=Ve(p=>{var I;const{withSearch:F=!0,onReady:$}=p,Q=no(),{entityMetadata:{value:X,loading:at},entityRef:Ct,setShadowRoot:Ut}=(0,m.V)(),Kt=Yo(Ct),Yt=window.location.pathname,Vt=window.location.hash,It=u(Kt),[ce]=w([`[id="${Vt.slice(1)}"]`]);(0,i.useEffect)(()=>{if(!It)if(Vt)ce&&ce.scrollIntoView();else{var Zt,Gt;(Gt=document)===null||Gt===void 0||(Zt=Gt.querySelector("header"))===null||Zt===void 0||Zt.scrollIntoView()}},[Yt,Vt,ce,It]);const ye=(0,i.useCallback)(Zt=>{Ut(Zt),$ instanceof Function&&$()},[Ut,$]);return at===!1&&!X?(0,o.jsx)(R.M,{status:"404",statusMessage:"PAGE NOT FOUND"}):Kt?(0,o.jsx)(x.U,{children:(0,o.jsxs)(d.A,{container:!0,children:[(0,o.jsx)(d.A,{xs:12,item:!0,children:(0,o.jsx)(De,{})}),F&&(0,o.jsx)(d.A,{className:Q.search,xs:"auto",item:!0,children:(0,o.jsx)(le,{entityId:Ct,entityTitle:X==null||(I=X.metadata)===null||I===void 0?void 0:I.title})}),(0,o.jsx)(d.A,{xs:12,item:!0,children:(0,o.jsx)(b,{element:Kt,onAppend:ye,children:(0,o.jsx)(eo,{})})})]})}):(0,o.jsx)(x.U,{children:(0,o.jsx)(d.A,{container:!0,children:(0,o.jsx)(d.A,{xs:12,item:!0,children:(0,o.jsx)(De,{})})})})}),de=null},45061:function(Y,T,t){"use strict";t.d(T,{T:function(){return J}});var o=t(31085),i=t(14041),d=t(93285),O=t(42899),m=t(4387),g=t(13660),h=t(72020),c=t(86892),C=t(99730),A=t(67871),P=t(8859),u=t(34428),b=t(51372),v=t(58837),D=t(268),w=t(72501),y=t(72072);const B=(0,v.A)(q=>({root:{textAlign:"left"},label:{color:q.page.fontColor,fontWeight:q.typography.fontWeightBold,letterSpacing:0,fontSize:q.typography.fontSize,marginBottom:q.spacing(1)/2,lineHeight:1},value:{color:(0,D.X4)(q.page.fontColor,.8),fontSize:q.typography.fontSize,lineHeight:1}}),{name:"BackstageHeaderLabel"}),R=({value:q,className:mt,typographyRootComponent:it})=>(0,o.jsx)(w.A,{component:it!=null?it:typeof q=="string"?"p":"span",className:mt,children:q});function x(q){const{label:mt,value:it,url:bt,contentTypograpyRootComponent:ct}=q,gt=B(),lt=(0,o.jsx)(R,{className:gt.value,value:it||"<Unknown>",typographyRootComponent:ct});return(0,o.jsx)(O.A,{item:!0,children:(0,o.jsxs)(w.A,{component:"span",className:gt.root,children:[(0,o.jsx)(w.A,{className:gt.label,children:mt}),bt?(0,o.jsx)(y.N_,{to:bt,children:lt}):lt]})})}var z=t(69814),V=t(72427),tt=t(65461),K=t(9222),W=t(45250),_=t(82779);const H=(0,o.jsx)(m.A,{animation:"wave",variant:"text",height:40}),J=q=>{const{children:mt}=q,it=(0,h.YR)(),bt=(0,V.gf)(tt.U),{title:ct,setTitle:gt,subtitle:lt,setSubtitle:rt,entityRef:vt,metadata:{value:yt,loading:Pt},entityMetadata:{value:pt,loading:st}}=(0,c.V)();(0,i.useEffect)(()=>{yt&&(gt(yt.site_name),rt(()=>{let{site_description:Dt}=yt;return(!Dt||Dt==="None")&&(Dt=""),Dt}))},[yt,gt,rt]);const ht=bt.getOptional("app.title")||"Backstage",ft=[ct,lt,ht].filter(Boolean).join(" | "),{locationMetadata:wt,spec:At}=pt||{},N=At==null?void 0:At.lifecycle,G=pt?(0,A.t)(pt,b.vv):[],Et=(0,K.S)(_.rQ)(),Ot=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(x,{label:(0,W.capitalize)((pt==null?void 0:pt.kind)||"entity"),value:(0,o.jsx)(P.z,{color:"inherit",entityRef:vt,title:pt==null?void 0:pt.metadata.title,defaultKind:"Component"})}),G.length>0&&(0,o.jsx)(x,{label:"Owner",value:(0,o.jsx)(u.i,{color:"inherit",entityRefs:G,defaultKind:"group"})}),N?(0,o.jsx)(x,{label:"Lifecycle",value:String(N)}):null,wt&&wt.type!=="dir"&&wt.type!=="file"?(0,o.jsx)(x,{label:"",value:(0,o.jsxs)(O.A,{container:!0,direction:"column",alignItems:"center",children:[(0,o.jsx)(O.A,{style:{padding:0},item:!0,children:(0,o.jsx)(g.A,{style:{marginTop:"-25px"}})}),(0,o.jsx)(O.A,{style:{padding:0},item:!0,children:"Source"})]}),url:wt.target}):null]});return!st&&pt===void 0||!Pt&&yt===void 0?null:(0,o.jsxs)(z.Y,{type:"Documentation",typeLink:Et,title:ct||H,subtitle:lt===""?void 0:lt||H,children:[(0,o.jsx)(d.A,{titleTemplate:"%s",children:(0,o.jsx)("title",{children:ft})}),Ot,mt,it.renderComponentsByLocation(C.e.Header)]})}},82779:function(Y,T,t){"use strict";t.d(T,{Oc:function(){return d},Ri:function(){return O},rQ:function(){return i}});var o=t(34569);const i=(0,o.H)({id:"techdocs:index-page"}),d=(0,o.H)({id:"techdocs:reader-page",params:["namespace","kind","name"]}),O=(0,o.H)({id:"techdocs:catalog-reader-view"})},27698:function(Y,T,t){"use strict";t.r(T),t.d(T,{TechDocsSearchResultListItem:function(){return A}});var o=t(31085),i=t(14041),d=t(46423),O=t(5951),m=t(58837),g=t(72501),h=t(72072),c=t(70734);const C=(0,m.A)({flexContainer:{flexWrap:"wrap"},itemText:{width:"100%",marginBottom:"1rem"}}),A=P=>{const{result:u,highlight:b,lineClamp:v=5,asListItem:D=!0,asLink:w=!0,title:y,icon:B}=P,R=C(),x=({children:tt})=>w?(0,o.jsx)(h.N_,{noTrack:!0,to:u.location,children:tt}):(0,o.jsx)(o.Fragment,{children:tt}),z=()=>{const tt=b!=null&&b.fields.title?(0,o.jsx)(c.e,{text:b.fields.title,preTag:b.preTag,postTag:b.postTag}):u.title,K=b!=null&&b.fields.entityTitle?(0,o.jsx)(c.e,{text:b.fields.entityTitle,preTag:b.preTag,postTag:b.postTag}):u.entityTitle,W=b!=null&&b.fields.name?(0,o.jsx)(c.e,{text:b.fields.name,preTag:b.preTag,postTag:b.postTag}):u.name;return u?(0,o.jsx)(O.A,{className:R.itemText,primaryTypographyProps:{variant:"h6"},primary:(0,o.jsx)(x,{children:y||(0,o.jsxs)(o.Fragment,{children:[tt," | ",K!=null?K:W," docs"]})}),secondary:(0,o.jsx)(g.A,{component:"span",style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:v,overflow:"hidden"},color:"textSecondary",variant:"body2",children:b!=null&&b.fields.text?(0,o.jsx)(c.e,{text:b.fields.text,preTag:b.preTag,postTag:b.postTag}):u.text})}):null},V=({children:tt})=>D?(0,o.jsxs)(o.Fragment,{children:[B&&(0,o.jsx)(d.A,{children:typeof B=="function"?B(u):B}),(0,o.jsx)("div",{className:R.flexContainer,children:tt})]}):(0,o.jsx)(o.Fragment,{children:tt});return(0,o.jsx)(V,{children:(0,o.jsx)(z,{})})}},86973:function(){}},function(Y){var T=function(o){return Y(Y.s=o)};Y.O(0,[1751,235,1888,1678,6587,2754,9669,1975,5042,7400,4121],function(){return T(85318)});var t=Y.O()}]);})();
|
|
496
496
|
|
|
497
|
-
//# sourceMappingURL=main.
|
|
497
|
+
//# sourceMappingURL=main.04529c71.js.map
|