@backstage/plugin-config-schema 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @backstage/plugin-config-schema
2
2
 
3
+ ## 0.1.15
4
+
5
+ ### Patch Changes
6
+
7
+ - cd450844f6: Moved React dependencies to `peerDependencies` and allow both React v16 and v17 to be used.
8
+ - dcd1a0c3f4: Minor improvement to the API reports, by not unpacking arguments directly
9
+ - Updated dependencies
10
+ - @backstage/core-components@0.8.0
11
+ - @backstage/core-plugin-api@0.3.0
12
+
3
13
  ## 0.1.14
4
14
 
5
15
  ### Patch Changes
@@ -12,7 +12,7 @@ import { useApi } from '@backstage/core-plugin-api';
12
12
 
13
13
  class ScrollTargetsForwarder {
14
14
  constructor() {
15
- this.listeners = new Map();
15
+ this.listeners = /* @__PURE__ */ new Map();
16
16
  }
17
17
  setScrollListener(id, listener) {
18
18
  this.listeners.set(id, listener);
@@ -28,7 +28,7 @@ class ScrollTargetsForwarder {
28
28
  }
29
29
  }
30
30
  const ScrollTargetsContext = createContext(void 0);
31
- function ScrollTargetsProvider({children}) {
31
+ function ScrollTargetsProvider({ children }) {
32
32
  return /* @__PURE__ */ React.createElement(ScrollTargetsContext.Provider, {
33
33
  value: new ScrollTargetsForwarder(),
34
34
  children
@@ -73,11 +73,11 @@ function ChildView({
73
73
  useEffect(() => {
74
74
  return scroll == null ? void 0 : scroll.setScrollListener(path, () => {
75
75
  var _a;
76
- (_a = titleRef.current) == null ? void 0 : _a.scrollIntoView({behavior: "smooth"});
76
+ (_a = titleRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
77
77
  });
78
78
  }, [scroll, path]);
79
79
  const chips = new Array();
80
- const chipProps = {size: "small", classes: {root: classes.chip}};
80
+ const chipProps = { size: "small", classes: { root: classes.chip } };
81
81
  if (required) {
82
82
  chips.push(/* @__PURE__ */ React.createElement(Chip, {
83
83
  label: "required",
@@ -120,7 +120,7 @@ function ChildView({
120
120
  }, /* @__PURE__ */ React.createElement(Typography, {
121
121
  ref: titleRef,
122
122
  variant: titleVariant(depth),
123
- classes: {root: classes.title}
123
+ classes: { root: classes.title }
124
124
  }, path), chips.length > 0 && /* @__PURE__ */ React.createElement(Box, {
125
125
  marginLeft: 1
126
126
  }), chips), schema && /* @__PURE__ */ React.createElement(SchemaView, {
@@ -130,25 +130,25 @@ function ChildView({
130
130
  })));
131
131
  }
132
132
 
133
- function MetadataViewRow({label, text, data}) {
133
+ function MetadataViewRow({ label, text, data }) {
134
134
  if (text === void 0 && data === void 0) {
135
135
  return null;
136
136
  }
137
137
  return /* @__PURE__ */ React.createElement(TableRow, null, /* @__PURE__ */ React.createElement(TableCell, {
138
- style: {width: 160}
138
+ style: { width: 160 }
139
139
  }, /* @__PURE__ */ React.createElement(Typography, {
140
140
  variant: "body1",
141
141
  noWrap: true,
142
- style: {fontWeight: 900}
142
+ style: { fontWeight: 900 }
143
143
  }, label)), /* @__PURE__ */ React.createElement(TableCell, null, /* @__PURE__ */ React.createElement(Typography, {
144
144
  variant: "body1"
145
145
  }, data ? JSON.stringify(data) : text)));
146
146
  }
147
- function MetadataView({schema}) {
147
+ function MetadataView({ schema }) {
148
148
  return /* @__PURE__ */ React.createElement(Paper, {
149
149
  variant: "outlined",
150
150
  square: true,
151
- style: {width: "100%"}
151
+ style: { width: "100%" }
152
152
  }, /* @__PURE__ */ React.createElement(Table, {
153
153
  size: "small"
154
154
  }, /* @__PURE__ */ React.createElement(TableBody, null, /* @__PURE__ */ React.createElement(MetadataViewRow, {
@@ -208,7 +208,7 @@ function MetadataView({schema}) {
208
208
  }))));
209
209
  }
210
210
 
211
- function ArrayView({path, depth, schema}) {
211
+ function ArrayView({ path, depth, schema }) {
212
212
  const itemDepth = depth + 1;
213
213
  const itemPath = path ? `${path}[]` : "[]";
214
214
  const itemSchema = schema.items;
@@ -263,7 +263,7 @@ function isRequired(name, required) {
263
263
  }
264
264
  return false;
265
265
  }
266
- function ObjectView({path, depth, schema}) {
266
+ function ObjectView({ path, depth, schema }) {
267
267
  var _a, _b;
268
268
  const properties = Object.entries((_a = schema.properties) != null ? _a : {});
269
269
  const patternProperties = Object.entries((_b = schema.patternProperties) != null ? _b : {});
@@ -303,7 +303,7 @@ function ObjectView({path, depth, schema}) {
303
303
  })));
304
304
  }
305
305
 
306
- function ScalarView({schema}) {
306
+ function ScalarView({ schema }) {
307
307
  return /* @__PURE__ */ React.createElement(React.Fragment, null, schema.description && /* @__PURE__ */ React.createElement(Box, {
308
308
  marginBottom: 4
309
309
  }, /* @__PURE__ */ React.createElement(Typography, {
@@ -314,7 +314,7 @@ function ScalarView({schema}) {
314
314
  }
315
315
 
316
316
  function SchemaView(props) {
317
- const {schema} = props;
317
+ const { schema } = props;
318
318
  if (schema.anyOf) {
319
319
  return /* @__PURE__ */ React.createElement(MatchView, {
320
320
  ...props,
@@ -439,13 +439,13 @@ function createSchemaBrowserItems(expanded, schema, path = "", depth = 0) {
439
439
  return null;
440
440
  }
441
441
  }
442
- function SchemaBrowser({schema}) {
442
+ function SchemaBrowser({ schema }) {
443
443
  const scroll = useScrollTargets();
444
444
  const expandedRef = useRef([]);
445
445
  const data = useMemo(() => {
446
446
  const expanded = new Array();
447
447
  const items = createSchemaBrowserItems(expanded, schema);
448
- return {items, expanded};
448
+ return { items, expanded };
449
449
  }, [schema]);
450
450
  if (!scroll) {
451
451
  throw new Error("No scroll handler available");
@@ -467,7 +467,7 @@ function SchemaBrowser({schema}) {
467
467
  }, data.items);
468
468
  }
469
469
 
470
- const SchemaViewer = ({schema}) => {
470
+ const SchemaViewer = ({ schema }) => {
471
471
  return /* @__PURE__ */ React.createElement(Box, {
472
472
  flex: "1",
473
473
  position: "relative"
@@ -523,4 +523,4 @@ const ConfigSchemaPage = () => {
523
523
  };
524
524
 
525
525
  export { ConfigSchemaPage };
526
- //# sourceMappingURL=index-0b20185c.esm.js.map
526
+ //# sourceMappingURL=index-b7756977.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-0b20185c.esm.js","sources":["../../src/components/ScrollTargetsContext/ScrollTargetsContext.tsx","../../src/components/SchemaView/ChildView.tsx","../../src/components/SchemaView/MetadataView.tsx","../../src/components/SchemaView/ArrayView.tsx","../../src/components/SchemaView/MatchView.tsx","../../src/components/SchemaView/ObjectView.tsx","../../src/components/SchemaView/ScalarView.tsx","../../src/components/SchemaView/SchemaView.tsx","../../src/components/SchemaBrowser/SchemaBrowser.tsx","../../src/components/SchemaViewer/SchemaViewer.tsx","../../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 */\n\nimport React, { 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","/*\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, Chip, Divider, makeStyles, Typography } from '@material-ui/core';\nimport { Schema } from 'jsonschema';\nimport React, { useEffect, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext';\nimport { SchemaView } from './SchemaView';\n\nexport interface 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\nexport function 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","/*\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 {\n Paper,\n Table,\n TableBody,\n TableCell,\n TableRow,\n Typography,\n} from '@material-ui/core';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\n\nexport interface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nexport function 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\nexport function 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","/*\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, Typography } from '@material-ui/core';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\nimport { ChildView } from './ChildView';\nimport { MetadataView } from './MetadataView';\nimport { SchemaViewProps } from './types';\n\nexport function 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","/*\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 { Typography } from '@material-ui/core';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\nimport { ChildView } from './ChildView';\n\nexport function 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","/*\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, Typography } from '@material-ui/core';\nimport React from 'react';\nimport { ChildView } from './ChildView';\nimport { MetadataView } from './MetadataView';\nimport { SchemaViewProps } from './types';\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\nexport function 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","/*\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, Typography } from '@material-ui/core';\nimport React from 'react';\nimport { MetadataView } from './MetadataView';\nimport { SchemaViewProps } from './types';\n\nexport function 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","/*\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 { ArrayView } from './ArrayView';\nimport { MatchView } from './MatchView';\nimport { ObjectView } from './ObjectView';\nimport { ScalarView } from './ScalarView';\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","/*\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 { createStyles, fade, withStyles } from '@material-ui/core';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { TreeItem, TreeItemProps, TreeView } from '@material-ui/lab';\nimport { Schema } from 'jsonschema';\nimport React, { 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 ${fade(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","/*\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, Paper } from '@material-ui/core';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\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","/*\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 React, { useMemo } from 'react';\nimport { useObservable } from 'react-use';\nimport { configSchemaApiRef } from '../../api';\nimport { SchemaViewer } from '../SchemaViewer';\nimport { Typography } from '@material-ui/core';\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":";;;;;;;;;;;;AAkBA,6BAA6B;AAAA,EAA7B,cAlBA;AAmBmB,qBAAY,IAAI;AAAA;AAAA,EAEjC,kBAAkB,IAAY,UAAkC;AAC9D,SAAK,UAAU,IAAI,IAAI;AAEvB,WAAO,MAAM;AACX,UAAI,KAAK,UAAU,IAAI,QAAQ,UAAU;AACvC,aAAK,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA,EAK5B,SAAS,IAAY;AA/BvB;AAgCI,eAAK,UAAU,IAAI,QAAnB;AAAA;AAAA;AAIJ,MAAM,uBAAuB,cAC3B;+BAGoC,CAAE,WAAqC;AAC3E,6CACG,qBAAqB,UAAtB;AAAA,IACE,OAAO,IAAI;AAAA,IACX;AAAA;AAAA;4BAK6B;AACjC,SAAO,WAAW;AAAA;;ACrBpB,sBAAsB,OAAe;AACnC,MAAI,SAAS,GAAG;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,KAAK;AAAA,IACtB,yDAAsB,gBAAD;AAAA,IACrB,uDAAoB,kBAAD;AAAA,IACnB,cAAc;AAAA,IACd,cAAc;AAAA,KAEb,KAAK;AAAA;;MCrKC,eAAe,CAAC,CAAE,YAAgC;AAC7D,6CACG,KAAD;AAAA,IAAK,MAAK;AAAA,IAAI,UAAS;AAAA,yCACpB,KAAD;AAAA,IACE,OAAK;AAAA,IACL,UAAS;AAAA,IACT,SAAQ;AAAA,IACR,eAAc;AAAA,IACd,UAAS;AAAA,IACT,WAAU;AAAA,yCAET,OAAD;AAAA,IAAO,WAAW;AAAA,yCACf,uBAAD,0CACG,KAAD;AAAA,IAAK,SAAS;AAAA,IAAG,UAAS;AAAA,IAAO,OAAO;AAAA,yCACrC,eAAD;AAAA,IAAe;AAAA,2CAGhB,KAAD;AAAA,IAAK,MAAK;AAAA,IAAI,UAAS;AAAA,yCACpB,YAAD;AAAA,IAAY;AAAA,IAAgB,MAAK;AAAA,IAAG,OAAO;AAAA;AAAA;;MCrB5C,mBAAmB,MAAM;AACpC,QAAM,kBAAkB,OAAO;AAC/B,QAAM,eAAe,cACnB,QAAQ,MAAM,gBAAgB,WAAW,CAAC;AAG5C,MAAI;AACJ,MAAI,cAAc;AAChB,QAAI,aAAa,QAAQ;AACvB,oDAAW,cAAD;AAAA,QAAc,QAAQ,aAAa;AAAA;AAAA,WACxC;AACL,oDACG,YAAD;AAAA,QAAY,SAAQ;AAAA,SAAK;AAAA;AAAA,SAGxB;AACL,kDAAW,UAAD;AAAA;AAGZ,6CACG,MAAD;AAAA,IAAM,SAAQ;AAAA,yCACX,QAAD;AAAA,IAAQ,OAAM;AAAA,0CACb,SAAD;AAAA,IAAS,SAAO;AAAA,KAAE;AAAA;;;;"}
1
+ {"version":3,"file":"index-b7756977.esm.js","sources":["../../src/components/ScrollTargetsContext/ScrollTargetsContext.tsx","../../src/components/SchemaView/ChildView.tsx","../../src/components/SchemaView/MetadataView.tsx","../../src/components/SchemaView/ArrayView.tsx","../../src/components/SchemaView/MatchView.tsx","../../src/components/SchemaView/ObjectView.tsx","../../src/components/SchemaView/ScalarView.tsx","../../src/components/SchemaView/SchemaView.tsx","../../src/components/SchemaBrowser/SchemaBrowser.tsx","../../src/components/SchemaViewer/SchemaViewer.tsx","../../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 */\n\nimport React, { 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","/*\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, Chip, Divider, makeStyles, Typography } from '@material-ui/core';\nimport { Schema } from 'jsonschema';\nimport React, { useEffect, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext';\nimport { SchemaView } from './SchemaView';\n\nexport interface 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\nexport function 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","/*\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 {\n Paper,\n Table,\n TableBody,\n TableCell,\n TableRow,\n Typography,\n} from '@material-ui/core';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\n\nexport interface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nexport function 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\nexport function 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","/*\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, Typography } from '@material-ui/core';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\nimport { ChildView } from './ChildView';\nimport { MetadataView } from './MetadataView';\nimport { SchemaViewProps } from './types';\n\nexport function 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","/*\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 { Typography } from '@material-ui/core';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\nimport { ChildView } from './ChildView';\n\nexport function 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","/*\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, Typography } from '@material-ui/core';\nimport React from 'react';\nimport { ChildView } from './ChildView';\nimport { MetadataView } from './MetadataView';\nimport { SchemaViewProps } from './types';\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\nexport function 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","/*\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, Typography } from '@material-ui/core';\nimport React from 'react';\nimport { MetadataView } from './MetadataView';\nimport { SchemaViewProps } from './types';\n\nexport function 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","/*\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 { ArrayView } from './ArrayView';\nimport { MatchView } from './MatchView';\nimport { ObjectView } from './ObjectView';\nimport { ScalarView } from './ScalarView';\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","/*\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 { createStyles, fade, withStyles } from '@material-ui/core';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { TreeItem, TreeItemProps, TreeView } from '@material-ui/lab';\nimport { Schema } from 'jsonschema';\nimport React, { 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 ${fade(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","/*\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, Paper } from '@material-ui/core';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\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","/*\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 React, { useMemo } from 'react';\nimport { useObservable } from 'react-use';\nimport { configSchemaApiRef } from '../../api';\nimport { SchemaViewer } from '../SchemaViewer';\nimport { Typography } from '@material-ui/core';\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":";;;;;;;;;;;;AAkBA,6BAA6B;AAAA,EAA7B,cAlBA;AAmBmB,yCAAgB;AAAA;AAAA,EAEjC,kBAAkB,IAAY,UAAkC;AAC9D,SAAK,UAAU,IAAI,IAAI;AAEvB,WAAO,MAAM;AACX,UAAI,KAAK,UAAU,IAAI,QAAQ,UAAU;AACvC,aAAK,UAAU,OAAO;AAAA;AAAA;AAAA;AAAA,EAK5B,SAAS,IAAY;AA/BvB;AAgCI,eAAK,UAAU,IAAI,QAAnB;AAAA;AAAA;AAIJ,MAAM,uBAAuB,cAC3B;+BAGoC,EAAE,YAAqC;AAC3E,6CACG,qBAAqB,UAAtB;AAAA,IACE,OAAO,IAAI;AAAA,IACX;AAAA;AAAA;4BAK6B;AACjC,SAAO,WAAW;AAAA;;ACrBpB,sBAAsB,OAAe;AACnC,MAAI,SAAS,GAAG;AACd,WAAO;AAAA,aACE,UAAU,GAAG;AACtB,WAAO;AAAA,aACE,UAAU,GAAG;AACtB,WAAO;AAAA,aACE,UAAU,GAAG;AACtB,WAAO;AAAA;AAET,SAAO;AAAA;AAGT,MAAM,qBAAqB,WAAW;AAAU,EAC9C,OAAO;AAAA,IACL,cA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,IAAI,UAAS;AAAA,yCACpB,KAAD;AAAA,IACE,OAAK;AAAA,IACL,UAAS;AAAA,IACT,SAAQ;AAAA,IACR,eAAc;AAAA,IACd,UAAS;AAAA,IACT,WAAU;AAAA,yCAET,OAAD;AAAA,IAAO,WAAW;AAAA,yCACf,uBAAD,0CACG,KAAD;AAAA,IAAK,SAAS;AAAA,IAAG,UAAS;AAAA,IAAO,OAAO;AAAA,yCACrC,eAAD;AAAA,IAAe;AAAA,2CAGhB,KAAD;AAAA,IAAK,MAAK;AAAA,IAAI,UAAS;AAAA,yCACpB,YAAD;AAAA,IAAY;AAAA,IAAgB,MAAK;AAAA,IAAG,OAAO;AAAA;AAAA;;MCrB5C,mBAAmB,MAAM;AACpC,QAAM,kBAAkB,OAAO;AAC/B,QAAM,eAAe,cACnB,QAAQ,MAAM,gBAAgB,WAAW,CAAC;AAG5C,MAAI;AACJ,MAAI,cAAc;AAChB,QAAI,aAAa,QAAQ;AACvB,oDAAW,cAAD;AAAA,QAAc,QAAQ,aAAa;AAAA;AAAA,WACxC;AACL,oDACG,YAAD;AAAA,QAAY,SAAQ;AAAA,SAAK;AAAA;AAAA,SAGxB;AACL,kDAAW,UAAD;AAAA;AAGZ,6CACG,MAAD;AAAA,IAAM,SAAQ;AAAA,yCACX,QAAD;AAAA,IAAQ,OAAM;AAAA,0CACb,SAAD;AAAA,IAAS,SAAO;AAAA,KAAE;AAAA;;;;"}
package/dist/index.d.ts CHANGED
@@ -13,10 +13,12 @@ declare const configSchemaApiRef: _backstage_core_plugin_api.ApiRef<ConfigSchema
13
13
 
14
14
  /**
15
15
  * A ConfigSchemaApi implementation that loads the configuration from a URL.
16
+ *
17
+ * @public
16
18
  */
17
19
  declare class StaticSchemaLoader implements ConfigSchemaApi {
18
20
  private readonly url;
19
- constructor({ url }?: {
21
+ constructor(options?: {
20
22
  url?: string;
21
23
  });
22
24
  schema$(): Observable<ConfigSchemaResult>;
package/dist/index.esm.js CHANGED
@@ -8,12 +8,13 @@ const configSchemaApiRef = createApiRef({
8
8
 
9
9
  const DEFAULT_URL = "config-schema.json";
10
10
  class StaticSchemaLoader {
11
- constructor({url = DEFAULT_URL} = {}) {
12
- this.url = url;
11
+ constructor(options = {}) {
12
+ var _a;
13
+ this.url = (_a = options == null ? void 0 : options.url) != null ? _a : DEFAULT_URL;
13
14
  }
14
15
  schema$() {
15
16
  return new ObservableImpl((subscriber) => {
16
- this.fetchSchema().then((schema) => subscriber.next({schema}), (error) => subscriber.error(error));
17
+ this.fetchSchema().then((schema) => subscriber.next({ schema }), (error) => subscriber.error(error));
17
18
  });
18
19
  }
19
20
  async fetchSchema() {
@@ -40,7 +41,7 @@ const configSchemaPlugin = createPlugin({
40
41
  });
41
42
  const ConfigSchemaPage = configSchemaPlugin.provide(createRoutableExtension({
42
43
  name: "ConfigSchemaPage",
43
- component: () => import('./esm/index-0b20185c.esm.js').then((m) => m.ConfigSchemaPage),
44
+ component: () => import('./esm/index-b7756977.esm.js').then((m) => m.ConfigSchemaPage),
44
45
  mountPoint: rootRouteRef
45
46
  }));
46
47
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/api/types.ts","../src/api/StaticSchemaLoader.ts","../src/routes.ts","../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 */\n\nimport { Schema } from 'jsonschema';\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\n\nexport interface ConfigSchemaResult {\n schema?: Schema;\n}\n\nexport interface ConfigSchemaApi {\n schema$(): Observable<ConfigSchemaResult>;\n}\n\nexport const configSchemaApiRef = createApiRef<ConfigSchemaApi>({\n id: 'plugin.config-schema',\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 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 */\nexport class StaticSchemaLoader implements ConfigSchemaApi {\n private readonly url: string;\n\n constructor({ url = DEFAULT_URL }: { url?: string } = {}) {\n this.url = 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","/*\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","/*\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\nexport const configSchemaPlugin = createPlugin({\n id: 'config-schema',\n routes: {\n root: rootRouteRef,\n },\n});\n\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":";;;;MA4Ba,qBAAqB,aAA8B;AAAA,EAC9D,IAAI;AAAA;;ACPN,MAAM,cAAc;yBAKuC;AAAA,EAGzD,YAAY,CAAE,MAAM,eAAkC,IAAI;AACxD,SAAK,MAAM;AAAA;AAAA,EAGb,UAA0C;AACxC,WAAO,IAAI,eAAe,gBAAc;AACtC,WAAK,cAAc,KACjB,YAAU,WAAW,KAAK,CAAE,UAC5B,WAAS,WAAW,MAAM;AAAA;AAAA;AAAA,QAKlB,cAA2C;AACvD,UAAM,MAAM,MAAM,MAAM,KAAK;AAE7B,QAAI,CAAC,IAAI,IAAI;AACX,UAAI,IAAI,WAAW,KAAK;AACtB,eAAO;AAAA;AAGT,YAAM,MAAM,cAAc,aAAa;AAAA;AAGzC,WAAO,MAAM,IAAI;AAAA;AAAA;;MCrCR,eAAe,eAAe;AAAA,EACzC,IAAI;AAAA;;MCIO,qBAAqB,aAAa;AAAA,EAC7C,IAAI;AAAA,EACJ,QAAQ;AAAA,IACN,MAAM;AAAA;AAAA;MAIG,mBAAmB,mBAAmB,QACjD,wBAAwB;AAAA,EACtB,MAAM;AAAA,EACN,WAAW,MACF,sCAAiC,KAAK,OAAK,EAAE;AAAA,EACtD,YAAY;AAAA;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/api/types.ts","../src/api/StaticSchemaLoader.ts","../src/routes.ts","../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 */\n\nimport { Schema } from 'jsonschema';\nimport { createApiRef } from '@backstage/core-plugin-api';\nimport { Observable } from '@backstage/types';\n\nexport interface ConfigSchemaResult {\n schema?: Schema;\n}\n\nexport interface ConfigSchemaApi {\n schema$(): Observable<ConfigSchemaResult>;\n}\n\nexport const configSchemaApiRef = createApiRef<ConfigSchemaApi>({\n id: 'plugin.config-schema',\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 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","/*\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","/*\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\nexport const configSchemaPlugin = createPlugin({\n id: 'config-schema',\n routes: {\n root: rootRouteRef,\n },\n});\n\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":";;;;MA4Ba,qBAAqB,aAA8B;AAAA,EAC9D,IAAI;AAAA;;ACPN,MAAM,cAAc;yBAOuC;AAAA,EAGzD,YAAY,UAA4B,IAAI;AAhC9C;AAiCI,SAAK,MAAM,yCAAS,QAAT,YAAgB;AAAA;AAAA,EAG7B,UAA0C;AACxC,WAAO,IAAI,eAAe,gBAAc;AACtC,WAAK,cAAc,KACjB,YAAU,WAAW,KAAK,EAAE,WAC5B,WAAS,WAAW,MAAM;AAAA;AAAA;AAAA,QAKlB,cAA2C;AACvD,UAAM,MAAM,MAAM,MAAM,KAAK;AAE7B,QAAI,CAAC,IAAI,IAAI;AACX,UAAI,IAAI,WAAW,KAAK;AACtB,eAAO;AAAA;AAGT,YAAM,MAAM,cAAc,aAAa;AAAA;AAGzC,WAAO,MAAM,IAAI;AAAA;AAAA;;MCvCR,eAAe,eAAe;AAAA,EACzC,IAAI;AAAA;;MCIO,qBAAqB,aAAa;AAAA,EAC7C,IAAI;AAAA,EACJ,QAAQ;AAAA,IACN,MAAM;AAAA;AAAA;MAIG,mBAAmB,mBAAmB,QACjD,wBAAwB;AAAA,EACtB,MAAM;AAAA,EACN,WAAW,MACT,OAAO,+BAAiC,KAAK,OAAK,EAAE;AAAA,EACtD,YAAY;AAAA;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-config-schema",
3
3
  "description": "A Backstage plugin that lets you browse the configuration schema of your app",
4
- "version": "0.1.14",
4
+ "version": "0.1.15",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -22,25 +22,26 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@backstage/config": "^0.1.11",
25
- "@backstage/core-components": "^0.7.5",
26
- "@backstage/core-plugin-api": "^0.2.1",
25
+ "@backstage/core-components": "^0.8.0",
26
+ "@backstage/core-plugin-api": "^0.3.0",
27
27
  "@backstage/errors": "^0.1.5",
28
- "@backstage/theme": "^0.2.13",
28
+ "@backstage/theme": "^0.2.14",
29
29
  "@backstage/types": "^0.1.1",
30
30
  "@material-ui/core": "^4.12.2",
31
31
  "@material-ui/icons": "^4.9.1",
32
32
  "@material-ui/lab": "4.0.0-alpha.57",
33
33
  "jsonschema": "^1.2.6",
34
- "react": "^16.13.1",
35
- "react-dom": "^16.13.1",
36
34
  "react-use": "^17.2.4",
37
35
  "zen-observable": "^0.8.15"
38
36
  },
37
+ "peerDependencies": {
38
+ "react": "^16.13.1 || ^17.0.0"
39
+ },
39
40
  "devDependencies": {
40
- "@backstage/cli": "^0.9.1",
41
- "@backstage/core-app-api": "^0.1.23",
42
- "@backstage/dev-utils": "^0.2.13",
43
- "@backstage/test-utils": "^0.1.23",
41
+ "@backstage/cli": "^0.10.1",
42
+ "@backstage/core-app-api": "^0.2.0",
43
+ "@backstage/dev-utils": "^0.2.14",
44
+ "@backstage/test-utils": "^0.1.24",
44
45
  "@testing-library/jest-dom": "^5.10.1",
45
46
  "@testing-library/react": "^11.2.5",
46
47
  "@testing-library/user-event": "^13.1.8",
@@ -52,5 +53,5 @@
52
53
  "files": [
53
54
  "dist"
54
55
  ],
55
- "gitHead": "85c127e436a24140bb3606f17f034f82aa9c7c0d"
56
+ "gitHead": "562be0b43016294e27af3ad024191bb86b13b1c1"
56
57
  }