@backstage/plugin-config-schema 0.1.71-next.0 → 0.1.71
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 +7 -0
- package/dist/api/StaticSchemaLoader.esm.js.map +1 -1
- package/dist/api/types.esm.js.map +1 -1
- package/dist/components/ConfigSchemaPage/ConfigSchemaPage.esm.js.map +1 -1
- package/dist/components/SchemaBrowser/SchemaBrowser.esm.js.map +1 -1
- package/dist/components/SchemaView/SchemaView.esm.js.map +1 -1
- package/dist/components/SchemaViewer/SchemaViewer.esm.js.map +1 -1
- package/dist/components/ScrollTargetsContext/ScrollTargetsContext.esm.js.map +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/routes.esm.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticSchemaLoader.esm.js","sources":["../../src/api/StaticSchemaLoader.ts"],"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 ObservableImpl from 'zen-observable';\nimport { ResponseError } from '@backstage/errors';\nimport { Schema } from 'jsonschema';\nimport { ConfigSchemaApi, ConfigSchemaResult } from './types';\nimport { Observable } from '@backstage/types';\n\nconst DEFAULT_URL = 'config-schema.json';\n\n/**\n * A ConfigSchemaApi implementation that loads the configuration from a URL.\n *\n * @public\n */\nexport class StaticSchemaLoader implements ConfigSchemaApi {\n private readonly url: string;\n\n constructor(options: { url?: string } = {}) {\n this.url = options?.url ?? DEFAULT_URL;\n }\n\n schema$(): Observable<ConfigSchemaResult> {\n return new ObservableImpl(subscriber => {\n this.fetchSchema().then(\n schema => subscriber.next({ schema }),\n error => subscriber.error(error),\n );\n });\n }\n\n private async fetchSchema(): Promise<undefined | Schema> {\n const res = await fetch(this.url);\n\n if (!res.ok) {\n if (res.status === 404) {\n return undefined;\n }\n\n throw await ResponseError.fromResponse(res);\n }\n\n return await res.json();\n }\n}\n"],"names":[],"mappings":";;;AAsBA,MAAM,
|
|
1
|
+
{"version":3,"file":"StaticSchemaLoader.esm.js","sources":["../../src/api/StaticSchemaLoader.ts"],"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 ObservableImpl from 'zen-observable';\nimport { ResponseError } from '@backstage/errors';\nimport { Schema } from 'jsonschema';\nimport { ConfigSchemaApi, ConfigSchemaResult } from './types';\nimport { Observable } from '@backstage/types';\n\nconst DEFAULT_URL = 'config-schema.json';\n\n/**\n * A ConfigSchemaApi implementation that loads the configuration from a URL.\n *\n * @public\n */\nexport class StaticSchemaLoader implements ConfigSchemaApi {\n private readonly url: string;\n\n constructor(options: { url?: string } = {}) {\n this.url = options?.url ?? DEFAULT_URL;\n }\n\n schema$(): Observable<ConfigSchemaResult> {\n return new ObservableImpl(subscriber => {\n this.fetchSchema().then(\n schema => subscriber.next({ schema }),\n error => subscriber.error(error),\n );\n });\n }\n\n private async fetchSchema(): Promise<undefined | Schema> {\n const res = await fetch(this.url);\n\n if (!res.ok) {\n if (res.status === 404) {\n return undefined;\n }\n\n throw await ResponseError.fromResponse(res);\n }\n\n return await res.json();\n }\n}\n"],"names":[],"mappings":";;;AAsBA,MAAM,WAAA,GAAc,oBAAA;AAOb,MAAM,kBAAA,CAA8C;AAAA,EACxC,GAAA;AAAA,EAEjB,WAAA,CAAY,OAAA,GAA4B,EAAC,EAAG;AAC1C,IAAA,IAAA,CAAK,GAAA,GAAM,SAAS,GAAA,IAAO,WAAA;AAAA,EAC7B;AAAA,EAEA,OAAA,GAA0C;AACxC,IAAA,OAAO,IAAI,eAAe,CAAA,UAAA,KAAc;AACtC,MAAA,IAAA,CAAK,aAAY,CAAE,IAAA;AAAA,QACjB,CAAA,MAAA,KAAU,UAAA,CAAW,IAAA,CAAK,EAAE,QAAQ,CAAA;AAAA,QACpC,CAAA,KAAA,KAAS,UAAA,CAAW,KAAA,CAAM,KAAK;AAAA,OACjC;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AAAA,EAEA,MAAc,WAAA,GAA2C;AACvD,IAAA,MAAM,GAAA,GAAM,MAAM,KAAA,CAAM,IAAA,CAAK,GAAG,CAAA;AAEhC,IAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,MAAA,IAAI,GAAA,CAAI,WAAW,GAAA,EAAK;AACtB,QAAA,OAAO,MAAA;AAAA,MACT;AAEA,MAAA,MAAM,MAAM,aAAA,CAAc,YAAA,CAAa,GAAG,CAAA;AAAA,IAC5C;AAEA,IAAA,OAAO,MAAM,IAAI,IAAA,EAAK;AAAA,EACxB;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.esm.js","sources":["../../src/api/types.ts"],"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 { Schema } from 'jsonschema';\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\n\n/** @public */\nexport interface ConfigSchemaResult {\n schema?: Schema;\n}\n\n/** @public */\nexport interface ConfigSchemaApi {\n schema$(): Observable<ConfigSchemaResult>;\n}\n\n/** @public */\nexport const configSchemaApiRef = createApiRef<ConfigSchemaApi>({\n id: 'plugin.config-schema',\n});\n"],"names":[],"mappings":";;AA+BO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"types.esm.js","sources":["../../src/api/types.ts"],"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 { Schema } from 'jsonschema';\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\n\n/** @public */\nexport interface ConfigSchemaResult {\n schema?: Schema;\n}\n\n/** @public */\nexport interface ConfigSchemaApi {\n schema$(): Observable<ConfigSchemaResult>;\n}\n\n/** @public */\nexport const configSchemaApiRef = createApiRef<ConfigSchemaApi>({\n id: 'plugin.config-schema',\n});\n"],"names":[],"mappings":";;AA+BO,MAAM,qBAAqB,YAAA,CAA8B;AAAA,EAC9D,EAAA,EAAI;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigSchemaPage.esm.js","sources":["../../../src/components/ConfigSchemaPage/ConfigSchemaPage.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 */\nimport { useMemo } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\nimport { configSchemaApiRef } from '../../api';\nimport { SchemaViewer } from '../SchemaViewer';\nimport Typography from '@material-ui/core/Typography';\n\nimport { Header, Page, Content, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const ConfigSchemaPage = () => {\n const configSchemaApi = useApi(configSchemaApiRef);\n const schemaResult = useObservable(\n useMemo(() => configSchemaApi.schema$(), [configSchemaApi]),\n );\n\n let content;\n if (schemaResult) {\n if (schemaResult.schema) {\n content = <SchemaViewer schema={schemaResult.schema} />;\n } else {\n content = (\n <Typography variant=\"h4\">No configuration schema available</Typography>\n );\n }\n } else {\n content = <Progress />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Configuration Reference\" />\n <Content stretch>{content}</Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAwBO,MAAM,mBAAmB,MAAM;AACpC,
|
|
1
|
+
{"version":3,"file":"ConfigSchemaPage.esm.js","sources":["../../../src/components/ConfigSchemaPage/ConfigSchemaPage.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 */\nimport { useMemo } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\nimport { configSchemaApiRef } from '../../api';\nimport { SchemaViewer } from '../SchemaViewer';\nimport Typography from '@material-ui/core/Typography';\n\nimport { Header, Page, Content, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const ConfigSchemaPage = () => {\n const configSchemaApi = useApi(configSchemaApiRef);\n const schemaResult = useObservable(\n useMemo(() => configSchemaApi.schema$(), [configSchemaApi]),\n );\n\n let content;\n if (schemaResult) {\n if (schemaResult.schema) {\n content = <SchemaViewer schema={schemaResult.schema} />;\n } else {\n content = (\n <Typography variant=\"h4\">No configuration schema available</Typography>\n );\n }\n } else {\n content = <Progress />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Configuration Reference\" />\n <Content stretch>{content}</Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAwBO,MAAM,mBAAmB,MAAM;AACpC,EAAA,MAAM,eAAA,GAAkB,OAAO,kBAAkB,CAAA;AACjD,EAAA,MAAM,YAAA,GAAe,aAAA;AAAA,IACnB,QAAQ,MAAM,eAAA,CAAgB,SAAQ,EAAG,CAAC,eAAe,CAAC;AAAA,GAC5D;AAEA,EAAA,IAAI,OAAA;AACJ,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,IAAI,aAAa,MAAA,EAAQ;AACvB,MAAA,OAAA,mBAAU,GAAA,CAAC,YAAA,EAAA,EAAa,MAAA,EAAQ,YAAA,CAAa,MAAA,EAAQ,CAAA;AAAA,IACvD,CAAA,MAAO;AACL,MAAA,OAAA,mBACE,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAK,QAAA,EAAA,mCAAA,EAAiC,CAAA;AAAA,IAE9D;AAAA,EACF,CAAA,MAAO;AACL,IAAA,OAAA,uBAAW,QAAA,EAAA,EAAS,CAAA;AAAA,EACtB;AAEA,EAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,MAAA,EACZ,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,OAAM,yBAAA,EAA0B,CAAA;AAAA,oBACxC,GAAA,CAAC,OAAA,EAAA,EAAQ,OAAA,EAAO,IAAA,EAAE,QAAA,EAAA,OAAA,EAAQ;AAAA,GAAA,EAC5B,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaBrowser.esm.js","sources":["../../../src/components/SchemaBrowser/SchemaBrowser.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 { alpha } from '@material-ui/core/styles';\nimport { createStyles, withStyles } from '@material-ui/core/styles';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport TreeItem, { TreeItemProps } from '@material-ui/lab/TreeItem';\nimport TreeView from '@material-ui/lab/TreeView';\nimport { Schema } from 'jsonschema';\nimport { ReactNode, useMemo, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext';\n\nconst StyledTreeItem = withStyles(theme =>\n createStyles({\n label: {\n userSelect: 'none',\n },\n group: {\n marginLeft: 7,\n paddingLeft: theme.spacing(1),\n borderLeft: `1px solid ${alpha(theme.palette.text.primary, 0.15)}`,\n },\n }),\n)((props: TreeItemProps) => <TreeItem {...props} />);\n\nexport function createSchemaBrowserItems(\n expanded: string[],\n schema: Schema,\n path: string = '',\n depth: number = 0,\n): ReactNode {\n let matchArr;\n if (schema.anyOf) {\n matchArr = schema.anyOf;\n } else if (schema.oneOf) {\n matchArr = schema.oneOf;\n } else if (schema.allOf) {\n matchArr = schema.allOf;\n }\n if (matchArr) {\n return matchArr.map((childSchema, index) => {\n const childPath = `${path}/${index + 1}`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem\n key={childPath}\n nodeId={childPath}\n label={`<Option ${index + 1}>`}\n >\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n });\n }\n\n switch (schema.type) {\n case 'array': {\n const childPath = `${path}[]`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem nodeId={childPath} label=\"[]\">\n {schema.items &&\n createSchemaBrowserItems(\n expanded,\n schema.items as Schema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n }\n case 'object':\n case undefined: {\n const children = [];\n\n if (schema.properties) {\n children.push(\n ...Object.entries(schema.properties).map(([name, childSchema]) => {\n const childPath = path ? `${path}.${name}` : name;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem key={childPath} nodeId={childPath} label={name}>\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n }),\n );\n }\n\n if (schema.patternProperties) {\n children.push(\n ...Object.entries(schema.patternProperties).map(\n ([name, childSchema]) => {\n const childPath = `${path}.<${name}>`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem\n key={childPath}\n nodeId={childPath}\n label={`<${name}>`}\n >\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n },\n ),\n );\n }\n\n if (schema.additionalProperties && schema.additionalProperties !== true) {\n const childPath = `${path}.*`;\n if (depth > 0) expanded.push(childPath);\n children.push(\n <StyledTreeItem key={childPath} nodeId={childPath} label=\"*\">\n {createSchemaBrowserItems(\n expanded,\n schema.additionalProperties,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>,\n );\n }\n\n return <>{children}</>;\n }\n\n default:\n return null;\n }\n}\n\nexport function SchemaBrowser({ schema }: { schema: Schema }) {\n const scroll = useScrollTargets();\n const expandedRef = useRef<string[]>([]);\n const data = useMemo(() => {\n const expanded = new Array<string>();\n\n const items = createSchemaBrowserItems(expanded, schema);\n\n return { items, expanded };\n }, [schema]);\n\n if (!scroll) {\n throw new Error('No scroll handler available');\n }\n\n const handleToggle = (_event: unknown, expanded: string[]) => {\n expandedRef.current = expanded;\n };\n\n const handleSelect = (_event: unknown, nodeId: string) => {\n if (expandedRef.current.includes(nodeId)) {\n scroll.scrollTo(nodeId);\n }\n };\n\n return (\n <TreeView\n defaultExpanded={data.expanded}\n defaultCollapseIcon={<ExpandMoreIcon />}\n defaultExpandIcon={<ChevronRightIcon />}\n onNodeToggle={handleToggle}\n onNodeSelect={handleSelect}\n >\n {data.items}\n </TreeView>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AA0BA,MAAM,cAAiB,GAAA,UAAA;AAAA,EAAW,WAChC,YAAa,CAAA;AAAA,IACX,KAAO,EAAA;AAAA,MACL,UAAY,EAAA;AAAA,KACd;AAAA,IACA,KAAO,EAAA;AAAA,MACL,UAAY,EAAA,CAAA;AAAA,MACZ,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC5B,UAAA,EAAY,aAAa,KAAM,CAAA,KAAA,CAAM,QAAQ,IAAK,CAAA,OAAA,EAAS,IAAI,CAAC,CAAA;AAAA;AAClE,GACD;AACH,CAAA,CAAE,CAAC,KAAyB,qBAAA,GAAA,CAAC,QAAU,EAAA,EAAA,GAAG,OAAO,CAAE,CAAA;AAE5C,SAAS,yBACd,QACA,EAAA,MAAA,EACA,IAAe,GAAA,EAAA,EACf,QAAgB,CACL,EAAA;AACX,EAAI,IAAA,QAAA;AACJ,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IAAA,QAAA,GAAW,MAAO,CAAA,KAAA;AAAA,GACpB,MAAA,IAAW,OAAO,KAAO,EAAA;AACvB,IAAA,QAAA,GAAW,MAAO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AAA;AAAA,GACxB;AAEA,EAAM,MAAA,YAAA,GAAe,CAAC,MAAA,EAAiB,MAAmB,KAAA;AACxD,IAAA,IAAI,WAAY,CAAA,OAAA,CAAQ,QAAS,CAAA,MAAM,CAAG,EAAA;AACxC,MAAA,MAAA,CAAO,SAAS,MAAM,CAAA;AAAA;AACxB,GACF;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,iBAAiB,IAAK,CAAA,QAAA;AAAA,MACtB,mBAAA,sBAAsB,cAAe,EAAA,EAAA,CAAA;AAAA,MACrC,iBAAA,sBAAoB,gBAAiB,EAAA,EAAA,CAAA;AAAA,MACrC,YAAc,EAAA,YAAA;AAAA,MACd,YAAc,EAAA,YAAA;AAAA,MAEb,QAAK,EAAA,IAAA,CAAA;AAAA;AAAA,GACR;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"SchemaBrowser.esm.js","sources":["../../../src/components/SchemaBrowser/SchemaBrowser.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 { alpha } from '@material-ui/core/styles';\nimport { createStyles, withStyles } from '@material-ui/core/styles';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport TreeItem, { TreeItemProps } from '@material-ui/lab/TreeItem';\nimport TreeView from '@material-ui/lab/TreeView';\nimport { Schema } from 'jsonschema';\nimport { ReactNode, useMemo, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext';\n\nconst StyledTreeItem = withStyles(theme =>\n createStyles({\n label: {\n userSelect: 'none',\n },\n group: {\n marginLeft: 7,\n paddingLeft: theme.spacing(1),\n borderLeft: `1px solid ${alpha(theme.palette.text.primary, 0.15)}`,\n },\n }),\n)((props: TreeItemProps) => <TreeItem {...props} />);\n\nexport function createSchemaBrowserItems(\n expanded: string[],\n schema: Schema,\n path: string = '',\n depth: number = 0,\n): ReactNode {\n let matchArr;\n if (schema.anyOf) {\n matchArr = schema.anyOf;\n } else if (schema.oneOf) {\n matchArr = schema.oneOf;\n } else if (schema.allOf) {\n matchArr = schema.allOf;\n }\n if (matchArr) {\n return matchArr.map((childSchema, index) => {\n const childPath = `${path}/${index + 1}`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem\n key={childPath}\n nodeId={childPath}\n label={`<Option ${index + 1}>`}\n >\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n });\n }\n\n switch (schema.type) {\n case 'array': {\n const childPath = `${path}[]`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem nodeId={childPath} label=\"[]\">\n {schema.items &&\n createSchemaBrowserItems(\n expanded,\n schema.items as Schema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n }\n case 'object':\n case undefined: {\n const children = [];\n\n if (schema.properties) {\n children.push(\n ...Object.entries(schema.properties).map(([name, childSchema]) => {\n const childPath = path ? `${path}.${name}` : name;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem key={childPath} nodeId={childPath} label={name}>\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n }),\n );\n }\n\n if (schema.patternProperties) {\n children.push(\n ...Object.entries(schema.patternProperties).map(\n ([name, childSchema]) => {\n const childPath = `${path}.<${name}>`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem\n key={childPath}\n nodeId={childPath}\n label={`<${name}>`}\n >\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n },\n ),\n );\n }\n\n if (schema.additionalProperties && schema.additionalProperties !== true) {\n const childPath = `${path}.*`;\n if (depth > 0) expanded.push(childPath);\n children.push(\n <StyledTreeItem key={childPath} nodeId={childPath} label=\"*\">\n {createSchemaBrowserItems(\n expanded,\n schema.additionalProperties,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>,\n );\n }\n\n return <>{children}</>;\n }\n\n default:\n return null;\n }\n}\n\nexport function SchemaBrowser({ schema }: { schema: Schema }) {\n const scroll = useScrollTargets();\n const expandedRef = useRef<string[]>([]);\n const data = useMemo(() => {\n const expanded = new Array<string>();\n\n const items = createSchemaBrowserItems(expanded, schema);\n\n return { items, expanded };\n }, [schema]);\n\n if (!scroll) {\n throw new Error('No scroll handler available');\n }\n\n const handleToggle = (_event: unknown, expanded: string[]) => {\n expandedRef.current = expanded;\n };\n\n const handleSelect = (_event: unknown, nodeId: string) => {\n if (expandedRef.current.includes(nodeId)) {\n scroll.scrollTo(nodeId);\n }\n };\n\n return (\n <TreeView\n defaultExpanded={data.expanded}\n defaultCollapseIcon={<ExpandMoreIcon />}\n defaultExpandIcon={<ChevronRightIcon />}\n onNodeToggle={handleToggle}\n onNodeSelect={handleSelect}\n >\n {data.items}\n </TreeView>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AA0BA,MAAM,cAAA,GAAiB,UAAA;AAAA,EAAW,WAChC,YAAA,CAAa;AAAA,IACX,KAAA,EAAO;AAAA,MACL,UAAA,EAAY;AAAA,KACd;AAAA,IACA,KAAA,EAAO;AAAA,MACL,UAAA,EAAY,CAAA;AAAA,MACZ,WAAA,EAAa,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC5B,UAAA,EAAY,aAAa,KAAA,CAAM,KAAA,CAAM,QAAQ,IAAA,CAAK,OAAA,EAAS,IAAI,CAAC,CAAA;AAAA;AAClE,GACD;AACH,CAAA,CA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B,IAAA,MAAM,QAAA,GAAW,IAAI,KAAA,EAAc;AAEnC,IAAA,MAAM,KAAA,GAAQ,wBAAA,CAAyB,QAAA,EAAU,MAAM,CAAA;AAEvD,IAAA,OAAO,EAAE,OAAO,QAAA,EAAS;AAAA,EAC3B,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,MAAM,6BAA6B,CAAA;AAAA,EAC/C;AAEA,EAAA,MAAM,YAAA,GAAe,CAAC,MAAA,EAAiB,QAAA,KAAuB;AAC5D,IAAA,WAAA,CAAY,OAAA,GAAU,QAAA;AAAA,EACxB,CAAA;AAEA,EAAA,MAAM,YAAA,GAAe,CAAC,MAAA,EAAiB,MAAA,KAAmB;AACxD,IAAA,IAAI,WAAA,CAAY,OAAA,CAAQ,QAAA,CAAS,MAAM,CAAA,EAAG;AACxC,MAAA,MAAA,CAAO,SAAS,MAAM,CAAA;AAAA,IACxB;AAAA,EACF,CAAA;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,iBAAiB,IAAA,CAAK,QAAA;AAAA,MACtB,mBAAA,sBAAsB,cAAA,EAAA,EAAe,CAAA;AAAA,MACrC,iBAAA,sBAAoB,gBAAA,EAAA,EAAiB,CAAA;AAAA,MACrC,YAAA,EAAc,YAAA;AAAA,MACd,YAAA,EAAc,YAAA;AAAA,MAEb,QAAA,EAAA,IAAA,CAAK;AAAA;AAAA,GACR;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaView.esm.js","sources":["../../../src/components/SchemaView/SchemaView.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 { JsonValue } from '@backstage/types';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport Divider from '@material-ui/core/Divider';\nimport Paper from '@material-ui/core/Paper';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Schema } from 'jsonschema';\nimport { useEffect, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext';\nimport { SchemaViewProps } from './types';\n\nexport function SchemaView(props: SchemaViewProps) {\n const { schema } = props;\n if (schema.anyOf) {\n return (\n <MatchView\n {...props}\n schema={schema.anyOf}\n label=\"Any of the following\"\n />\n );\n }\n if (schema.oneOf) {\n return (\n <MatchView\n {...props}\n schema={schema.oneOf}\n label=\"One of the following\"\n />\n );\n }\n if (schema.allOf) {\n return (\n <MatchView\n {...props}\n schema={schema.allOf}\n label=\"All of the following\"\n />\n );\n }\n switch (schema.type) {\n case 'array':\n return <ArrayView {...props} />;\n case 'object':\n case undefined:\n return <ObjectView {...props} />;\n default:\n return <ScalarView {...props} />;\n }\n}\n\nfunction ArrayView({ path, depth, schema }: SchemaViewProps) {\n const itemDepth = depth + 1;\n const itemPath = path ? `${path}[]` : '[]';\n const itemSchema = schema.items;\n\n return (\n <>\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n <Typography variant=\"overline\">Items</Typography>\n <ChildView\n lastChild\n path={itemPath}\n depth={itemDepth}\n schema={itemSchema as Schema | undefined}\n />\n {schema.additionalItems && schema.additionalItems !== true && (\n <>\n <Typography variant=\"overline\">Additional Items</Typography>\n <ChildView\n path={itemPath}\n depth={itemDepth}\n schema={schema.additionalItems}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n\nfunction isRequired(name: string, required?: boolean | string[]) {\n if (required === true) {\n return true;\n }\n if (Array.isArray(required)) {\n return required.includes(name);\n }\n return false;\n}\n\nfunction ObjectView({ path, depth, schema }: SchemaViewProps) {\n const properties = Object.entries(schema.properties ?? {});\n const patternProperties = Object.entries(schema.patternProperties ?? {});\n\n return (\n <>\n {depth > 0 && (\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n )}\n {properties.length > 0 && (\n <>\n {depth > 0 && <Typography variant=\"overline\">Properties</Typography>}\n {properties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.${name}` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === properties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {patternProperties.length > 0 && (\n <>\n {depth > 0 && (\n <Typography variant=\"overline\">Pattern Properties</Typography>\n )}\n {patternProperties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.<${name}>` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === patternProperties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {schema.additionalProperties && schema.additionalProperties !== true && (\n <>\n <Typography variant=\"overline\">Additional Properties</Typography>\n <ChildView\n path={`${path}.*`}\n depth={depth + 1}\n schema={schema.additionalProperties}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n\ninterface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction titleVariant(depth: number) {\n if (depth <= 1) {\n return 'h2';\n } else if (depth === 2) {\n return 'h3';\n } else if (depth === 3) {\n return 'h4';\n } else if (depth === 4) {\n return 'h5';\n }\n return 'h6';\n}\n\nconst useChildViewStyles = makeStyles(theme => ({\n title: {\n marginBottom: 0,\n },\n chip: {\n marginLeft: theme.spacing(1),\n marginRight: 0,\n marginBottom: 0,\n },\n}));\n\nfunction ChildView({\n path,\n depth,\n schema,\n required,\n lastChild,\n}: {\n path: string;\n depth: number;\n schema?: Schema;\n required?: boolean;\n lastChild?: boolean;\n}) {\n const classes = useChildViewStyles();\n const titleRef = useRef<HTMLElement>(null);\n const scroll = useScrollTargets();\n\n useEffect(() => {\n return scroll?.setScrollListener(path, () => {\n titleRef.current?.scrollIntoView({ behavior: 'smooth' });\n });\n }, [scroll, path]);\n\n const chips = new Array<JSX.Element>();\n const chipProps = { size: 'small' as const, classes: { root: classes.chip } };\n\n if (required) {\n chips.push(\n <Chip label=\"required\" color=\"default\" key=\"required\" {...chipProps} />,\n );\n }\n\n const visibility = (schema as { visibility?: string })?.visibility;\n if (visibility === 'frontend') {\n chips.push(\n <Chip label=\"frontend\" color=\"primary\" key=\"visibility\" {...chipProps} />,\n );\n } else if (visibility === 'secret') {\n chips.push(\n <Chip label=\"secret\" color=\"secondary\" key=\"visibility\" {...chipProps} />,\n );\n }\n\n return (\n <Box paddingBottom={lastChild ? 4 : 8} display=\"flex\" flexDirection=\"row\">\n <Divider orientation=\"vertical\" flexItem />\n <Box paddingLeft={2} flex={1}>\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n marginBottom={2}\n alignItems=\"center\"\n >\n <Typography\n ref={titleRef}\n variant={titleVariant(depth)}\n classes={{ root: classes.title }}\n >\n {path}\n </Typography>\n {chips.length > 0 && <Box marginLeft={1} />}\n {chips}\n </Box>\n {schema && (\n <SchemaView path={path} depth={depth} schema={schema as Schema} />\n )}\n </Box>\n </Box>\n );\n}\n\nfunction MatchView({\n path,\n depth,\n schema,\n label,\n}: {\n path: string;\n depth: number;\n schema: Schema[];\n label: string;\n}) {\n return (\n <>\n <Typography variant=\"overline\">{label}</Typography>\n {schema.map((optionSchema, index) => (\n <ChildView\n key={index}\n path={`${path}/${index + 1}`}\n depth={depth + 1}\n schema={optionSchema}\n lastChild={index === schema.length - 1}\n />\n ))}\n </>\n );\n}\n\nfunction ScalarView({ schema }: SchemaViewProps) {\n return (\n <>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </>\n );\n}\n\ninterface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction MetadataViewRow({ label, text, data }: MetadataViewRowProps) {\n if (text === undefined && data === undefined) {\n return null;\n }\n return (\n <TableRow>\n <TableCell style={{ width: 160 }}>\n <Typography variant=\"body1\" noWrap style={{ fontWeight: 900 }}>\n {label}\n </Typography>\n </TableCell>\n <TableCell>\n <Typography variant=\"body1\">\n {data ? JSON.stringify(data) : text}\n </Typography>\n </TableCell>\n </TableRow>\n );\n}\n\nfunction MetadataView({ schema }: { schema: Schema }) {\n return (\n <Paper variant=\"outlined\" square style={{ width: '100%' }}>\n <Table size=\"small\">\n <TableBody>\n <MetadataViewRow label=\"Type\" data={schema.type} />\n <MetadataViewRow label=\"Allowed values\" data={schema.enum} />\n {schema.additionalProperties === true && (\n <MetadataViewRow label=\"Additional Properties\" text=\"true\" />\n )}\n {schema.additionalItems === true && (\n <MetadataViewRow label=\"Additional Items\" text=\"true\" />\n )}\n <MetadataViewRow label=\"Format\" text={schema.format} />\n <MetadataViewRow\n label=\"Pattern\"\n text={schema.pattern && String(schema.pattern)}\n />\n <MetadataViewRow label=\"Minimum\" data={schema.minimum} />\n <MetadataViewRow label=\"Maximum\" data={schema.maximum} />\n <MetadataViewRow\n label=\"Exclusive minimum\"\n data={schema.exclusiveMinimum}\n />\n <MetadataViewRow\n label=\"Exclusive maximum\"\n data={schema.exclusiveMaximum}\n />\n <MetadataViewRow label=\"Multiple of\" data={schema.multipleOf} />\n <MetadataViewRow\n label=\"Maximum number of items\"\n data={schema.maxItems}\n />\n <MetadataViewRow\n label=\"Minimum number of items\"\n data={schema.minItems}\n />\n <MetadataViewRow\n label=\"Maximum number of properties\"\n data={schema.maxProperties}\n />\n <MetadataViewRow\n label=\"Minimum number of properties\"\n data={schema.minProperties}\n />\n <MetadataViewRow label=\"Maximum Length\" data={schema.maxLength} />\n <MetadataViewRow label=\"Minimum Length\" data={schema.minLength} />\n <MetadataViewRow\n label=\"Items must be unique\"\n data={schema.uniqueItems}\n />\n </TableBody>\n </Table>\n </Paper>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAgCO,SAAS,WAAW,KAAwB,EAAA;AACjD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IACE,uBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAO,CAAA,KAAA;AAAA,QACf,KAAM,EAAA;AAAA;AAAA,KACR;AAAA;AAGJ,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IACE,uBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAO,CAAA,KAAA;AAAA,QACf,KAAM,EAAA;AAAA;AAAA,KACR;AAAA;AAGJ,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IACE,uBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAO,CAAA,KAAA;AAAA,QACf,KAAM,EAAA;AAAA;AAAA,KACR;AAAA;AAGJ,EAAA,QAAQ,OAAO,IAAM;AAAA,IACnB,KAAK,OAAA;AACH,MAAO,uBAAA,GAAA,CAAC,SAAW,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA;AAAA,IAC/B,KAAK,QAAA;AAAA,IACL,KAAK,KAAA,CAAA;AACH,MAAO,uBAAA,GAAA,CAAC,UAAY,EAAA,EAAA,GA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;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,sBAAA;AAAA,QACN,MAAM,MAAO,CAAA;AAAA;AAAA;AACf,GAAA,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"SchemaView.esm.js","sources":["../../../src/components/SchemaView/SchemaView.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 { JsonValue } from '@backstage/types';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport Divider from '@material-ui/core/Divider';\nimport Paper from '@material-ui/core/Paper';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Schema } from 'jsonschema';\nimport { useEffect, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext';\nimport { SchemaViewProps } from './types';\n\nexport function SchemaView(props: SchemaViewProps) {\n const { schema } = props;\n if (schema.anyOf) {\n return (\n <MatchView\n {...props}\n schema={schema.anyOf}\n label=\"Any of the following\"\n />\n );\n }\n if (schema.oneOf) {\n return (\n <MatchView\n {...props}\n schema={schema.oneOf}\n label=\"One of the following\"\n />\n );\n }\n if (schema.allOf) {\n return (\n <MatchView\n {...props}\n schema={schema.allOf}\n label=\"All of the following\"\n />\n );\n }\n switch (schema.type) {\n case 'array':\n return <ArrayView {...props} />;\n case 'object':\n case undefined:\n return <ObjectView {...props} />;\n default:\n return <ScalarView {...props} />;\n }\n}\n\nfunction ArrayView({ path, depth, schema }: SchemaViewProps) {\n const itemDepth = depth + 1;\n const itemPath = path ? `${path}[]` : '[]';\n const itemSchema = schema.items;\n\n return (\n <>\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n <Typography variant=\"overline\">Items</Typography>\n <ChildView\n lastChild\n path={itemPath}\n depth={itemDepth}\n schema={itemSchema as Schema | undefined}\n />\n {schema.additionalItems && schema.additionalItems !== true && (\n <>\n <Typography variant=\"overline\">Additional Items</Typography>\n <ChildView\n path={itemPath}\n depth={itemDepth}\n schema={schema.additionalItems}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n\nfunction isRequired(name: string, required?: boolean | string[]) {\n if (required === true) {\n return true;\n }\n if (Array.isArray(required)) {\n return required.includes(name);\n }\n return false;\n}\n\nfunction ObjectView({ path, depth, schema }: SchemaViewProps) {\n const properties = Object.entries(schema.properties ?? {});\n const patternProperties = Object.entries(schema.patternProperties ?? {});\n\n return (\n <>\n {depth > 0 && (\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n )}\n {properties.length > 0 && (\n <>\n {depth > 0 && <Typography variant=\"overline\">Properties</Typography>}\n {properties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.${name}` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === properties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {patternProperties.length > 0 && (\n <>\n {depth > 0 && (\n <Typography variant=\"overline\">Pattern Properties</Typography>\n )}\n {patternProperties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.<${name}>` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === patternProperties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {schema.additionalProperties && schema.additionalProperties !== true && (\n <>\n <Typography variant=\"overline\">Additional Properties</Typography>\n <ChildView\n path={`${path}.*`}\n depth={depth + 1}\n schema={schema.additionalProperties}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n\ninterface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction titleVariant(depth: number) {\n if (depth <= 1) {\n return 'h2';\n } else if (depth === 2) {\n return 'h3';\n } else if (depth === 3) {\n return 'h4';\n } else if (depth === 4) {\n return 'h5';\n }\n return 'h6';\n}\n\nconst useChildViewStyles = makeStyles(theme => ({\n title: {\n marginBottom: 0,\n },\n chip: {\n marginLeft: theme.spacing(1),\n marginRight: 0,\n marginBottom: 0,\n },\n}));\n\nfunction ChildView({\n path,\n depth,\n schema,\n required,\n lastChild,\n}: {\n path: string;\n depth: number;\n schema?: Schema;\n required?: boolean;\n lastChild?: boolean;\n}) {\n const classes = useChildViewStyles();\n const titleRef = useRef<HTMLElement>(null);\n const scroll = useScrollTargets();\n\n useEffect(() => {\n return scroll?.setScrollListener(path, () => {\n titleRef.current?.scrollIntoView({ behavior: 'smooth' });\n });\n }, [scroll, path]);\n\n const chips = new Array<JSX.Element>();\n const chipProps = { size: 'small' as const, classes: { root: classes.chip } };\n\n if (required) {\n chips.push(\n <Chip label=\"required\" color=\"default\" key=\"required\" {...chipProps} />,\n );\n }\n\n const visibility = (schema as { visibility?: string })?.visibility;\n if (visibility === 'frontend') {\n chips.push(\n <Chip label=\"frontend\" color=\"primary\" key=\"visibility\" {...chipProps} />,\n );\n } else if (visibility === 'secret') {\n chips.push(\n <Chip label=\"secret\" color=\"secondary\" key=\"visibility\" {...chipProps} />,\n );\n }\n\n return (\n <Box paddingBottom={lastChild ? 4 : 8} display=\"flex\" flexDirection=\"row\">\n <Divider orientation=\"vertical\" flexItem />\n <Box paddingLeft={2} flex={1}>\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n marginBottom={2}\n alignItems=\"center\"\n >\n <Typography\n ref={titleRef}\n variant={titleVariant(depth)}\n classes={{ root: classes.title }}\n >\n {path}\n </Typography>\n {chips.length > 0 && <Box marginLeft={1} />}\n {chips}\n </Box>\n {schema && (\n <SchemaView path={path} depth={depth} schema={schema as Schema} />\n )}\n </Box>\n </Box>\n );\n}\n\nfunction MatchView({\n path,\n depth,\n schema,\n label,\n}: {\n path: string;\n depth: number;\n schema: Schema[];\n label: string;\n}) {\n return (\n <>\n <Typography variant=\"overline\">{label}</Typography>\n {schema.map((optionSchema, index) => (\n <ChildView\n key={index}\n path={`${path}/${index + 1}`}\n depth={depth + 1}\n schema={optionSchema}\n lastChild={index === schema.length - 1}\n />\n ))}\n </>\n );\n}\n\nfunction ScalarView({ schema }: SchemaViewProps) {\n return (\n <>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </>\n );\n}\n\ninterface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction MetadataViewRow({ label, text, data }: MetadataViewRowProps) {\n if (text === undefined && data === undefined) {\n return null;\n }\n return (\n <TableRow>\n <TableCell style={{ width: 160 }}>\n <Typography variant=\"body1\" noWrap style={{ fontWeight: 900 }}>\n {label}\n </Typography>\n </TableCell>\n <TableCell>\n <Typography variant=\"body1\">\n {data ? JSON.stringify(data) : text}\n </Typography>\n </TableCell>\n </TableRow>\n );\n}\n\nfunction MetadataView({ schema }: { schema: Schema }) {\n return (\n <Paper variant=\"outlined\" square style={{ width: '100%' }}>\n <Table size=\"small\">\n <TableBody>\n <MetadataViewRow label=\"Type\" data={schema.type} />\n <MetadataViewRow label=\"Allowed values\" data={schema.enum} />\n {schema.additionalProperties === true && (\n <MetadataViewRow label=\"Additional Properties\" text=\"true\" />\n )}\n {schema.additionalItems === true && (\n <MetadataViewRow label=\"Additional Items\" text=\"true\" />\n )}\n <MetadataViewRow label=\"Format\" text={schema.format} />\n <MetadataViewRow\n label=\"Pattern\"\n text={schema.pattern && String(schema.pattern)}\n />\n <MetadataViewRow label=\"Minimum\" data={schema.minimum} />\n <MetadataViewRow label=\"Maximum\" data={schema.maximum} />\n <MetadataViewRow\n label=\"Exclusive minimum\"\n data={schema.exclusiveMinimum}\n />\n <MetadataViewRow\n label=\"Exclusive maximum\"\n data={schema.exclusiveMaximum}\n />\n <MetadataViewRow label=\"Multiple of\" data={schema.multipleOf} />\n <MetadataViewRow\n label=\"Maximum number of items\"\n data={schema.maxItems}\n />\n <MetadataViewRow\n label=\"Minimum number of items\"\n data={schema.minItems}\n />\n <MetadataViewRow\n label=\"Maximum number of properties\"\n data={schema.maxProperties}\n />\n <MetadataViewRow\n label=\"Minimum number of properties\"\n data={schema.minProperties}\n />\n <MetadataViewRow label=\"Maximum Length\" data={schema.maxLength} />\n <MetadataViewRow label=\"Minimum Length\" data={schema.minLength} />\n <MetadataViewRow\n label=\"Items must be unique\"\n data={schema.uniqueItems}\n />\n </TableBody>\n </Table>\n </Paper>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAgCO,SAAS,WAAW,KAAA,EAAwB;AACjD,EAAA,MAAM,EAAE,QAAO,GAAI,KAAA;AACnB,EAAA,IAAI,OAAO,KAAA,EAAO;AAChB,IAAA,uBACE,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAA,CAAO,KAAA;AAAA,QACf,KAAA,EAAM;AAAA;AAAA,KACR;AAAA,EAEJ;AACA,EAAA,IAAI,OAAO,KAAA,EAAO;AAChB,IAAA,uBACE,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAA,CAAO,KAAA;AAAA,QACf,KAAA,EAAM;AAAA;AAAA,KACR;AAAA,EAEJ;AACA,EAAA,IAAI,OAAO,KAAA,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AA,MAAA;AAAA,QACC,KAAA,EAAM,8BAAA;AAAA,QACN,MAAM,MAAA,CAAO;AAAA;AAAA,KACf;AAAA,oBACA,GAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAM,8BAAA;AAAA,QACN,MAAM,MAAA,CAAO;AAAA;AAAA,KACf;AAAA,wBACC,eAAA,EAAA,EAAgB,KAAA,EAAM,gBAAA,EAAiB,IAAA,EAAM,OAAO,SAAA,EAAW,CAAA;AAAA,wBAC/D,eAAA,EAAA,EAAgB,KAAA,EAAM,gBAAA,EAAiB,IAAA,EAAM,OAAO,SAAA,EAAW,CAAA;AAAA,oBAChE,GAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAM,sBAAA;AAAA,QACN,MAAM,MAAA,CAAO;AAAA;AAAA;AACf,GAAA,EACF,GACF,CAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaViewer.esm.js","sources":["../../../src/components/SchemaViewer/SchemaViewer.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 Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport { Schema } from 'jsonschema';\nimport { SchemaView } from '../SchemaView';\nimport { SchemaBrowser } from '../SchemaBrowser';\nimport { ScrollTargetsProvider } from '../ScrollTargetsContext/ScrollTargetsContext';\n\nexport interface SchemaViewerProps {\n schema: Schema;\n}\n\nexport const SchemaViewer = ({ schema }: SchemaViewerProps) => {\n return (\n <Box flex=\"1\" position=\"relative\">\n <Box\n clone\n position=\"absolute\"\n display=\"flex\"\n flexDirection=\"row\"\n flexWrap=\"nowrap\"\n maxHeight=\"100%\"\n >\n <Paper elevation={3}>\n <ScrollTargetsProvider>\n <Box padding={1} overflow=\"auto\" width={300}>\n <SchemaBrowser schema={schema} />\n </Box>\n\n <Box flex=\"1\" overflow=\"auto\">\n <SchemaView schema={schema} path=\"\" depth={0} />\n </Box>\n </ScrollTargetsProvider>\n </Paper>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA2BO,MAAM,
|
|
1
|
+
{"version":3,"file":"SchemaViewer.esm.js","sources":["../../../src/components/SchemaViewer/SchemaViewer.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 Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport { Schema } from 'jsonschema';\nimport { SchemaView } from '../SchemaView';\nimport { SchemaBrowser } from '../SchemaBrowser';\nimport { ScrollTargetsProvider } from '../ScrollTargetsContext/ScrollTargetsContext';\n\nexport interface SchemaViewerProps {\n schema: Schema;\n}\n\nexport const SchemaViewer = ({ schema }: SchemaViewerProps) => {\n return (\n <Box flex=\"1\" position=\"relative\">\n <Box\n clone\n position=\"absolute\"\n display=\"flex\"\n flexDirection=\"row\"\n flexWrap=\"nowrap\"\n maxHeight=\"100%\"\n >\n <Paper elevation={3}>\n <ScrollTargetsProvider>\n <Box padding={1} overflow=\"auto\" width={300}>\n <SchemaBrowser schema={schema} />\n </Box>\n\n <Box flex=\"1\" overflow=\"auto\">\n <SchemaView schema={schema} path=\"\" depth={0} />\n </Box>\n </ScrollTargetsProvider>\n </Paper>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA2BO,MAAM,YAAA,GAAe,CAAC,EAAE,MAAA,EAAO,KAAyB;AAC7D,EAAA,uBACE,GAAA,CAAC,GAAA,EAAA,EAAI,IAAA,EAAK,GAAA,EAAI,UAAS,UAAA,EACrB,QAAA,kBAAA,GAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAK,IAAA;AAAA,MACL,QAAA,EAAS,UAAA;AAAA,MACT,OAAA,EAAQ,MAAA;AAAA,MACR,aAAA,EAAc,KAAA;AAAA,MACd,QAAA,EAAS,QAAA;AAAA,MACT,SAAA,EAAU,MAAA;AAAA,MAEV,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAM,SAAA,EAAW,CAAA,EAChB,+BAAC,qBAAA,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,OAAA,EAAS,CAAA,EAAG,QAAA,EAAS,MAAA,EAAO,OAAO,GAAA,EACtC,QAAA,kBAAA,GAAA,CAAC,aAAA,EAAA,EAAc,MAAA,EAAgB,CAAA,EACjC,CAAA;AAAA,wBAEA,GAAA,CAAC,GAAA,EAAA,EAAI,IAAA,EAAK,GAAA,EAAI,QAAA,EAAS,MAAA,EACrB,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,MAAA,EAAgB,IAAA,EAAK,EAAA,EAAG,KAAA,EAAO,GAAG,CAAA,EAChD;AAAA,OAAA,EACF,CAAA,EACF;AAAA;AAAA,GACF,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollTargetsContext.esm.js","sources":["../../../src/components/ScrollTargetsContext/ScrollTargetsContext.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 { createContext, ReactNode, useContext } from 'react';\n\nclass ScrollTargetsForwarder {\n private readonly listeners = new Map<string, () => void>();\n\n setScrollListener(id: string, listener: () => void): () => void {\n this.listeners.set(id, listener);\n\n return () => {\n if (this.listeners.get(id) === listener) {\n this.listeners.delete(id);\n }\n };\n }\n\n scrollTo(id: string) {\n this.listeners.get(id)?.();\n }\n}\n\nconst ScrollTargetsContext = createContext<ScrollTargetsForwarder | undefined>(\n undefined,\n);\n\nexport function ScrollTargetsProvider({ children }: { children: ReactNode }) {\n return (\n <ScrollTargetsContext.Provider\n value={new ScrollTargetsForwarder()}\n children={children}\n />\n );\n}\n\nexport function useScrollTargets() {\n return useContext(ScrollTargetsContext);\n}\n"],"names":[],"mappings":";;;AAkBA,MAAM,
|
|
1
|
+
{"version":3,"file":"ScrollTargetsContext.esm.js","sources":["../../../src/components/ScrollTargetsContext/ScrollTargetsContext.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 { createContext, ReactNode, useContext } from 'react';\n\nclass ScrollTargetsForwarder {\n private readonly listeners = new Map<string, () => void>();\n\n setScrollListener(id: string, listener: () => void): () => void {\n this.listeners.set(id, listener);\n\n return () => {\n if (this.listeners.get(id) === listener) {\n this.listeners.delete(id);\n }\n };\n }\n\n scrollTo(id: string) {\n this.listeners.get(id)?.();\n }\n}\n\nconst ScrollTargetsContext = createContext<ScrollTargetsForwarder | undefined>(\n undefined,\n);\n\nexport function ScrollTargetsProvider({ children }: { children: ReactNode }) {\n return (\n <ScrollTargetsContext.Provider\n value={new ScrollTargetsForwarder()}\n children={children}\n />\n );\n}\n\nexport function useScrollTargets() {\n return useContext(ScrollTargetsContext);\n}\n"],"names":[],"mappings":";;;AAkBA,MAAM,sBAAA,CAAuB;AAAA,EACV,SAAA,uBAAgB,GAAA,EAAwB;AAAA,EAEzD,iBAAA,CAAkB,IAAY,QAAA,EAAkC;AAC9D,IAAA,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,EAAA,EAAI,QAAQ,CAAA;AAE/B,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,EAAE,MAAM,QAAA,EAAU;AACvC,QAAA,IAAA,CAAK,SAAA,CAAU,OAAO,EAAE,CAAA;AAAA,MAC1B;AAAA,IACF,CAAA;AAAA,EACF;AAAA,EAEA,SAAS,EAAA,EAAY;AACnB,IAAA,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,EAAE,CAAA,IAAI;AAAA,EAC3B;AACF;AAEA,MAAM,oBAAA,GAAuB,aAAA;AAAA,EAC3B;AACF,CAAA;AAEO,SAAS,qBAAA,CAAsB,EAAE,QAAA,EAAS,EAA4B;AAC3E,EAAA,uBACE,GAAA;AAAA,IAAC,oBAAA,CAAqB,QAAA;AAAA,IAArB;AAAA,MACC,KAAA,EAAO,IAAI,sBAAA,EAAuB;AAAA,MAClC;AAAA;AAAA,GACF;AAEJ;AAEO,SAAS,gBAAA,GAAmB;AACjC,EAAA,OAAO,WAAW,oBAAoB,CAAA;AACxC;;;;"}
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 */\nimport { rootRouteRef } from './routes';\n\nimport {\n createPlugin,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\n/** @public */\nexport const configSchemaPlugin = createPlugin({\n id: 'config-schema',\n routes: {\n root: rootRouteRef,\n },\n});\n\n/** @public */\nexport const ConfigSchemaPage = configSchemaPlugin.provide(\n createRoutableExtension({\n name: 'ConfigSchemaPage',\n component: () =>\n import('./components/ConfigSchemaPage').then(m => m.ConfigSchemaPage),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;AAuBO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 */\nimport { rootRouteRef } from './routes';\n\nimport {\n createPlugin,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\n/** @public */\nexport const configSchemaPlugin = createPlugin({\n id: 'config-schema',\n routes: {\n root: rootRouteRef,\n },\n});\n\n/** @public */\nexport const ConfigSchemaPage = configSchemaPlugin.provide(\n createRoutableExtension({\n name: 'ConfigSchemaPage',\n component: () =>\n import('./components/ConfigSchemaPage').then(m => m.ConfigSchemaPage),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;AAuBO,MAAM,qBAAqB,YAAA,CAAa;AAAA,EAC7C,EAAA,EAAI,eAAA;AAAA,EACJ,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA;AAEV,CAAC;AAGM,MAAM,mBAAmB,kBAAA,CAAmB,OAAA;AAAA,EACjD,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,kBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,4CAA+B,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,gBAAgB,CAAA;AAAA,IACtE,UAAA,EAAY;AAAA,GACb;AACH;;;;"}
|
package/dist/routes.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"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 */\nimport { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'config-schema',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"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 */\nimport { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'config-schema',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,cAAA,CAAe;AAAA,EACzC,EAAA,EAAI;AACN,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-config-schema",
|
|
3
|
-
"version": "0.1.71
|
|
3
|
+
"version": "0.1.71",
|
|
4
4
|
"description": "A Backstage plugin that lets you browse the configuration schema of your app",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"test": "backstage-cli package test"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@backstage/core-components": "0.17.5
|
|
41
|
-
"@backstage/core-plugin-api": "1.10.9",
|
|
42
|
-
"@backstage/errors": "1.2.7",
|
|
43
|
-
"@backstage/types": "1.2.1",
|
|
40
|
+
"@backstage/core-components": "^0.17.5",
|
|
41
|
+
"@backstage/core-plugin-api": "^1.10.9",
|
|
42
|
+
"@backstage/errors": "^1.2.7",
|
|
43
|
+
"@backstage/types": "^1.2.1",
|
|
44
44
|
"@material-ui/core": "^4.12.2",
|
|
45
45
|
"@material-ui/icons": "^4.9.1",
|
|
46
46
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"zen-observable": "^0.10.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@backstage/cli": "0.
|
|
53
|
-
"@backstage/dev-utils": "1.1.13
|
|
52
|
+
"@backstage/cli": "^0.34.0",
|
|
53
|
+
"@backstage/dev-utils": "^1.1.13",
|
|
54
54
|
"@testing-library/dom": "^10.0.0",
|
|
55
55
|
"@testing-library/jest-dom": "^6.0.0",
|
|
56
56
|
"@testing-library/react": "^16.0.0",
|