@stoplight/elements-core 9.0.10 → 9.0.12
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/components/Docs/Docs.d.ts +1 -14
- package/components/Docs/HttpOperation/Body.d.ts +1 -9
- package/components/Docs/HttpOperation/HttpOperation.d.ts +2 -6
- package/components/Docs/HttpOperation/Request.d.ts +0 -6
- package/components/Docs/HttpOperation/Responses.d.ts +1 -12
- package/index.esm.js +27 -472
- package/index.js +27 -473
- package/index.mjs +27 -472
- package/package.json +1 -1
- package/styled.d.ts +3 -10
- package/components/Docs/HttpOperation/LazySchemaTreePreviewer.d.ts +0 -34
package/index.esm.js
CHANGED
|
@@ -54,7 +54,6 @@ import omitBy from 'lodash/omitBy.js';
|
|
|
54
54
|
import { QueryClient, useQueryClient, QueryClientProvider } from 'react-query';
|
|
55
55
|
import { StaticRouter } from 'react-router-dom/server.js';
|
|
56
56
|
import $RefParser from '@stoplight/json-schema-ref-parser';
|
|
57
|
-
import * as PropTypes from 'prop-types';
|
|
58
57
|
import isEqual from 'lodash/isEqual.js';
|
|
59
58
|
import * as ReactDOM from 'react-dom';
|
|
60
59
|
|
|
@@ -114,8 +113,6 @@ const isResolvedObjectProxy = (someObject) => {
|
|
|
114
113
|
return !!someObject[originalObjectSymbol];
|
|
115
114
|
};
|
|
116
115
|
const getOriginalObject = (resolvedObject) => {
|
|
117
|
-
if (!resolvedObject)
|
|
118
|
-
return resolvedObject;
|
|
119
116
|
const originalObject = resolvedObject[originalObjectSymbol] || resolvedObject;
|
|
120
117
|
if (!originalObject) {
|
|
121
118
|
return resolvedObject;
|
|
@@ -2741,358 +2738,13 @@ const PanelContent = ({ schemes }) => {
|
|
|
2741
2738
|
})));
|
|
2742
2739
|
};
|
|
2743
2740
|
|
|
2744
|
-
const TYPES = ['string', 'integer', 'boolean', 'any', 'number'];
|
|
2745
|
-
function resolvePointer(obj, pointer) {
|
|
2746
|
-
const parts = pointer.replace(/^#\//, '').split('/');
|
|
2747
|
-
return parts.reduce((acc, key) => acc && acc[key], obj);
|
|
2748
|
-
}
|
|
2749
|
-
function detectCircularPath(path) {
|
|
2750
|
-
const ignored = ['properties', 'items'];
|
|
2751
|
-
const parts = path.split('/').filter(part => !ignored.includes(part));
|
|
2752
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
2753
|
-
const current = parts[i];
|
|
2754
|
-
const rest = parts.slice(i + 1);
|
|
2755
|
-
if (rest.includes(current)) {
|
|
2756
|
-
return true;
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
return false;
|
|
2760
|
-
}
|
|
2761
|
-
function dereference(node, root, visited = new WeakSet(), depth = 0, maxDepth = 10) {
|
|
2762
|
-
if (!node || typeof node !== 'object')
|
|
2763
|
-
return node;
|
|
2764
|
-
if (depth > maxDepth)
|
|
2765
|
-
return node;
|
|
2766
|
-
if (node.$ref || node['x-iata-$ref']) {
|
|
2767
|
-
let refPath = node.$ref || node['x-iata-$ref'];
|
|
2768
|
-
if (refPath.includes('#/%24defs')) {
|
|
2769
|
-
refPath = refPath.replace('#/%24defs', '$defs');
|
|
2770
|
-
}
|
|
2771
|
-
else {
|
|
2772
|
-
refPath = refPath.replace('__bundled__', 'definitions');
|
|
2773
|
-
}
|
|
2774
|
-
if (visited.has(node))
|
|
2775
|
-
return { circular: true, $ref: refPath, title: node.title, type: 'any', description: node.description };
|
|
2776
|
-
visited.add(node);
|
|
2777
|
-
const target = resolvePointer(root, refPath);
|
|
2778
|
-
if (!target)
|
|
2779
|
-
return node;
|
|
2780
|
-
const result = Object.assign({}, target);
|
|
2781
|
-
if ('description' in node)
|
|
2782
|
-
result.description = node.description;
|
|
2783
|
-
if ('title' in node)
|
|
2784
|
-
result.title = node.title;
|
|
2785
|
-
return dereference(result, root, visited, depth + 1, maxDepth);
|
|
2786
|
-
}
|
|
2787
|
-
if (Array.isArray(node)) {
|
|
2788
|
-
return node.map(item => dereference(item, root, visited, depth + 1, maxDepth));
|
|
2789
|
-
}
|
|
2790
|
-
const result = {};
|
|
2791
|
-
for (const key in node) {
|
|
2792
|
-
result[key] = dereference(node[key], root, visited, depth + 1, maxDepth);
|
|
2793
|
-
}
|
|
2794
|
-
return result;
|
|
2795
|
-
}
|
|
2796
|
-
const trimSlashes = (str) => {
|
|
2797
|
-
return str.replace(/^\/|\/$/g, '');
|
|
2798
|
-
};
|
|
2799
|
-
function isPropertiesAllHidden(path, hideData) {
|
|
2800
|
-
const current = trimSlashes(path);
|
|
2801
|
-
const parts = current.split('/');
|
|
2802
|
-
for (let i = parts.length; i >= 2; i--) {
|
|
2803
|
-
if (parts[i - 1] === 'properties') {
|
|
2804
|
-
const ancestorPropPath = parts.slice(0, i).join('/');
|
|
2805
|
-
const block = hideData.find(h => trimSlashes(h.path) === ancestorPropPath && ancestorPropPath.endsWith('/properties'));
|
|
2806
|
-
if (block && block.required === undefined) {
|
|
2807
|
-
return true;
|
|
2808
|
-
}
|
|
2809
|
-
}
|
|
2810
|
-
}
|
|
2811
|
-
return false;
|
|
2812
|
-
}
|
|
2813
|
-
function isRequiredOverride(path, hideData) {
|
|
2814
|
-
const entry = hideData.find(h => trimSlashes(h.path) === trimSlashes(path));
|
|
2815
|
-
return entry && typeof entry.required === 'boolean' ? entry.required : undefined;
|
|
2816
|
-
}
|
|
2817
|
-
function isPathHidden(path, hideData, complexData) {
|
|
2818
|
-
const isComplex = checkIfIsComplex(path, complexData);
|
|
2819
|
-
if (isComplex === null) {
|
|
2820
|
-
return false;
|
|
2821
|
-
}
|
|
2822
|
-
else if (isComplex) {
|
|
2823
|
-
const normalizedPath = trimSlashes(path);
|
|
2824
|
-
const direct = hideData.find(h => trimSlashes(h.path) === normalizedPath);
|
|
2825
|
-
if (direct && direct.required === undefined)
|
|
2826
|
-
return true;
|
|
2827
|
-
if (isPropertiesAllHidden(path, hideData))
|
|
2828
|
-
return true;
|
|
2829
|
-
for (const h of hideData) {
|
|
2830
|
-
const hPath = trimSlashes(h.path);
|
|
2831
|
-
if (h.required !== undefined)
|
|
2832
|
-
continue;
|
|
2833
|
-
if (normalizedPath.length > hPath.length &&
|
|
2834
|
-
normalizedPath.startsWith(hPath) &&
|
|
2835
|
-
(hPath.endsWith('/items') || (hPath.match(/\/items\/[^\/]+$/) && normalizedPath.startsWith(hPath + '/')))) {
|
|
2836
|
-
return true;
|
|
2837
|
-
}
|
|
2838
|
-
}
|
|
2839
|
-
return false;
|
|
2840
|
-
}
|
|
2841
|
-
else {
|
|
2842
|
-
return !hideData.some(h => h.path === path || h.path.startsWith(path + '/'));
|
|
2843
|
-
}
|
|
2844
|
-
}
|
|
2845
|
-
const checkIfIsComplex = (path, complexData) => {
|
|
2846
|
-
let isComplex = null;
|
|
2847
|
-
for (const complex of complexData) {
|
|
2848
|
-
if (path.startsWith(complex.location)) {
|
|
2849
|
-
isComplex = complex === null || complex === void 0 ? void 0 : complex.isComplex;
|
|
2850
|
-
break;
|
|
2851
|
-
}
|
|
2852
|
-
}
|
|
2853
|
-
return isComplex;
|
|
2854
|
-
};
|
|
2855
|
-
const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path = '', hideData = [], complexData = [], parentRequired, propertyKey, _subType, }) => {
|
|
2856
|
-
var _a, _b, _c, _d;
|
|
2857
|
-
const [expanded, setExpanded] = useState(false);
|
|
2858
|
-
const [selectedSchemaIndex, setSelectedSchemaIndex] = useState(0);
|
|
2859
|
-
const [showSchemaDropdown, setShowSchemaDropdown] = useState(false);
|
|
2860
|
-
const [isHoveringSelector, setIsHoveringSelector] = useState(false);
|
|
2861
|
-
const isRoot = level === 1 && (title === undefined || path === '');
|
|
2862
|
-
useEffect(() => {
|
|
2863
|
-
setSelectedSchemaIndex(0);
|
|
2864
|
-
}, [schema === null || schema === void 0 ? void 0 : schema.anyOf, schema === null || schema === void 0 ? void 0 : schema.oneOf]);
|
|
2865
|
-
const thisNodeRequiredOverride = isRequiredOverride(path, hideData);
|
|
2866
|
-
const shouldHideAllChildren = (isRoot && hideData.some(h => trimSlashes(h.path) === 'properties' && h.required === undefined)) ||
|
|
2867
|
-
(!isRoot && isPropertiesAllHidden(path, hideData));
|
|
2868
|
-
const shouldHideNode = useMemo(() => {
|
|
2869
|
-
if (isRoot)
|
|
2870
|
-
return false;
|
|
2871
|
-
if (isPathHidden(path, hideData, complexData) && thisNodeRequiredOverride === undefined)
|
|
2872
|
-
return true;
|
|
2873
|
-
return false;
|
|
2874
|
-
}, [path, hideData, isRoot, thisNodeRequiredOverride, complexData]);
|
|
2875
|
-
if (!schema || shouldHideNode) {
|
|
2876
|
-
return null;
|
|
2877
|
-
}
|
|
2878
|
-
const displayTitle = level === 1 && (title === undefined || path === '') ? '' : (_a = title !== null && title !== void 0 ? title : schema === null || schema === void 0 ? void 0 : schema.title) !== null && _a !== void 0 ? _a : 'Node';
|
|
2879
|
-
const handleToggle = () => {
|
|
2880
|
-
const circular = detectCircularPath(path);
|
|
2881
|
-
if (!circular) {
|
|
2882
|
-
setExpanded(prev => !prev);
|
|
2883
|
-
}
|
|
2884
|
-
};
|
|
2885
|
-
const renderChildren = () => {
|
|
2886
|
-
var _a, _b, _c, _d;
|
|
2887
|
-
if (shouldHideAllChildren)
|
|
2888
|
-
return null;
|
|
2889
|
-
if (!expanded && !isRoot)
|
|
2890
|
-
return null;
|
|
2891
|
-
const children = [];
|
|
2892
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'object' && ((schema === null || schema === void 0 ? void 0 : schema.properties) || (schema === null || schema === void 0 ? void 0 : schema.allOf) || (schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf))) {
|
|
2893
|
-
let props = schema === null || schema === void 0 ? void 0 : schema.properties;
|
|
2894
|
-
if (schema === null || schema === void 0 ? void 0 : schema.allOf) {
|
|
2895
|
-
schema === null || schema === void 0 ? void 0 : schema.allOf.forEach((item) => {
|
|
2896
|
-
props = Object.assign(Object.assign({}, props), item.properties);
|
|
2897
|
-
});
|
|
2898
|
-
}
|
|
2899
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
|
|
2900
|
-
const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.anyOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.anyOf[0]);
|
|
2901
|
-
props = Object.assign(Object.assign({}, props), selectedSchema.properties);
|
|
2902
|
-
}
|
|
2903
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
|
|
2904
|
-
const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.oneOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.oneOf[0]);
|
|
2905
|
-
props = Object.assign(Object.assign({}, props), selectedSchema.properties);
|
|
2906
|
-
}
|
|
2907
|
-
for (const [key, child] of Object.entries(props || {})) {
|
|
2908
|
-
const childPath = `${path}/properties/${key}`;
|
|
2909
|
-
const childRequiredOverride = isRequiredOverride(childPath, hideData);
|
|
2910
|
-
const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
|
|
2911
|
-
const resolved = dereference(child, root);
|
|
2912
|
-
if (!shouldHideChild) {
|
|
2913
|
-
children.push(React__default.createElement("li", { key: key },
|
|
2914
|
-
React__default.createElement(LazySchemaTreePreviewer, { schema: resolved, root: root, title: key, level: level + 1, path: childPath, hideData: hideData, complexData: complexData, parentRequired: schema === null || schema === void 0 ? void 0 : schema.required, propertyKey: key, _subType: (_a = resolved === null || resolved === void 0 ? void 0 : resolved.items) === null || _a === void 0 ? void 0 : _a.type })));
|
|
2915
|
-
}
|
|
2916
|
-
}
|
|
2917
|
-
}
|
|
2918
|
-
else if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array' &&
|
|
2919
|
-
(schema === null || schema === void 0 ? void 0 : schema.items) &&
|
|
2920
|
-
Object.keys(schema === null || schema === void 0 ? void 0 : schema.items).length > 0 &&
|
|
2921
|
-
!((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular)) {
|
|
2922
|
-
const resolvedItems = dereference(schema === null || schema === void 0 ? void 0 : schema.items, root);
|
|
2923
|
-
const itemsPath = `${path}/items`;
|
|
2924
|
-
if (resolvedItems && resolvedItems.type === 'object' && resolvedItems.properties) {
|
|
2925
|
-
for (const [key, child] of Object.entries(resolvedItems.properties)) {
|
|
2926
|
-
const childPath = `${itemsPath}/properties/${key}`;
|
|
2927
|
-
const childRequiredOverride = isRequiredOverride(childPath, hideData);
|
|
2928
|
-
const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
|
|
2929
|
-
const resolved = dereference(child, root);
|
|
2930
|
-
if (!shouldHideChild) {
|
|
2931
|
-
children.push(React__default.createElement("li", { key: key },
|
|
2932
|
-
React__default.createElement(LazySchemaTreePreviewer, { schema: resolved, root: root, title: key, level: level + 2, path: childPath, hideData: hideData, complexData: complexData, parentRequired: resolvedItems.required, propertyKey: key, _subType: (_c = resolvedItems === null || resolvedItems === void 0 ? void 0 : resolvedItems.items) === null || _c === void 0 ? void 0 : _c.type })));
|
|
2933
|
-
}
|
|
2934
|
-
}
|
|
2935
|
-
}
|
|
2936
|
-
else if (resolvedItems && resolvedItems.type === 'array' && resolvedItems.items.length > 0) {
|
|
2937
|
-
const childPath = `${path}/items`;
|
|
2938
|
-
const childRequiredOverride = isRequiredOverride(childPath, hideData);
|
|
2939
|
-
const shouldHideChild = isPathHidden(childPath, hideData, complexData) && childRequiredOverride === undefined;
|
|
2940
|
-
if (!shouldHideChild) {
|
|
2941
|
-
children.push(React__default.createElement("li", { key: "items" },
|
|
2942
|
-
React__default.createElement(LazySchemaTreePreviewer, { schema: resolvedItems, root: root, title: "items", level: level + 1, path: childPath, hideData: hideData, complexData: complexData, parentRequired: schema === null || schema === void 0 ? void 0 : schema.required, propertyKey: "items", _subType: (_d = resolvedItems === null || resolvedItems === void 0 ? void 0 : resolvedItems.items) === null || _d === void 0 ? void 0 : _d.type })));
|
|
2943
|
-
}
|
|
2944
|
-
}
|
|
2945
|
-
}
|
|
2946
|
-
return children.length > 0 ? React__default.createElement("ul", { className: "ml-6 border-l border-gray-200 pl-2" }, children) : null;
|
|
2947
|
-
};
|
|
2948
|
-
const combinedSchemaSelector = () => {
|
|
2949
|
-
var _a;
|
|
2950
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
2951
|
-
React__default.createElement(Box, { pos: "fixed", top: 0, left: 0, right: 0, bottom: 0, bg: "transparent", style: { zIndex: 999 }, onClick: () => setShowSchemaDropdown(false) }),
|
|
2952
|
-
React__default.createElement(Box, { pos: "absolute", bg: "canvas", rounded: true, boxShadow: "md", style: {
|
|
2953
|
-
zIndex: 1000,
|
|
2954
|
-
top: '100%',
|
|
2955
|
-
left: 0,
|
|
2956
|
-
minWidth: '150px',
|
|
2957
|
-
maxWidth: '200px',
|
|
2958
|
-
marginTop: '2px',
|
|
2959
|
-
border: '1px solid rgba(0, 0, 0, 0.1)',
|
|
2960
|
-
}, fontSize: "sm", onClick: (e) => e.stopPropagation() }, (_a = ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf))) === null || _a === void 0 ? void 0 : _a.map((schemaOption, index) => (React__default.createElement(Box, { key: index, px: 3, py: 2, cursor: "pointer", bg: selectedSchemaIndex === index ? 'primary-tint' : 'canvas', fontSize: "xs", display: "flex", alignItems: "center", style: {
|
|
2961
|
-
borderBottom: index < ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)).length - 1 ? '1px solid rgba(0, 0, 0, 0.1)' : 'none',
|
|
2962
|
-
gap: '8px',
|
|
2963
|
-
}, onMouseEnter: (e) => {
|
|
2964
|
-
if (selectedSchemaIndex !== index) {
|
|
2965
|
-
e.currentTarget.style.backgroundColor = 'var(--sl-color-canvas-tint)';
|
|
2966
|
-
}
|
|
2967
|
-
}, onMouseLeave: (e) => {
|
|
2968
|
-
if (selectedSchemaIndex !== index) {
|
|
2969
|
-
e.currentTarget.style.backgroundColor = 'var(--sl-color-canvas)';
|
|
2970
|
-
}
|
|
2971
|
-
}, onClick: () => {
|
|
2972
|
-
setSelectedSchemaIndex(index);
|
|
2973
|
-
setShowSchemaDropdown(false);
|
|
2974
|
-
} },
|
|
2975
|
-
React__default.createElement(Box, { flex: 1, color: "body" }, schemaOption.type || 'object'),
|
|
2976
|
-
selectedSchemaIndex === index && (React__default.createElement(Box, { color: "primary", fontSize: "xs" }, "\u2713"))))))));
|
|
2977
|
-
};
|
|
2978
|
-
const renderMinEnums = (schema) => {
|
|
2979
|
-
if (!schema || typeof schema !== 'object')
|
|
2980
|
-
return null;
|
|
2981
|
-
const boxStyle = {
|
|
2982
|
-
background: 'rgba(245, 247, 250, 0.5)',
|
|
2983
|
-
border: '1px solid #a0aec0',
|
|
2984
|
-
borderRadius: '4px',
|
|
2985
|
-
padding: '0px 2px',
|
|
2986
|
-
display: 'inline-block',
|
|
2987
|
-
overflowWrap: 'break-word',
|
|
2988
|
-
textAlign: 'left',
|
|
2989
|
-
maxWidth: 'fit-content',
|
|
2990
|
-
maxHeight: 'fit-content',
|
|
2991
|
-
};
|
|
2992
|
-
if ('minItems' in schema) {
|
|
2993
|
-
const schemaWithMinItems = schema;
|
|
2994
|
-
if (typeof schemaWithMinItems.minItems === 'number') {
|
|
2995
|
-
return (React__default.createElement(Box, { className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: boxStyle }, `>=${schemaWithMinItems.minItems} items`));
|
|
2996
|
-
}
|
|
2997
|
-
}
|
|
2998
|
-
if ('enum' in schema && Array.isArray(schema.enum)) {
|
|
2999
|
-
return (React__default.createElement("div", null,
|
|
3000
|
-
"Allowed values:",
|
|
3001
|
-
' ',
|
|
3002
|
-
schema.enum.map((val, idx) => (React__default.createElement(Box, { key: idx, className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: boxStyle }, val)))));
|
|
3003
|
-
}
|
|
3004
|
-
return null;
|
|
3005
|
-
};
|
|
3006
|
-
const isRequired = parentRequired && propertyKey && parentRequired.includes(propertyKey);
|
|
3007
|
-
let showRequiredLabel = false;
|
|
3008
|
-
const hideDataEntry = hideData.find(hideEntry => trimSlashes(hideEntry.path) === trimSlashes(path));
|
|
3009
|
-
if ((hideDataEntry === null || hideDataEntry === void 0 ? void 0 : hideDataEntry.required) === true || ((hideDataEntry === null || hideDataEntry === void 0 ? void 0 : hideDataEntry.required) === undefined && isRequired)) {
|
|
3010
|
-
showRequiredLabel = true;
|
|
3011
|
-
}
|
|
3012
|
-
if (schema === null || schema === void 0 ? void 0 : schema.$ref) {
|
|
3013
|
-
schema = dereference(schema, root);
|
|
3014
|
-
}
|
|
3015
|
-
return (React__default.createElement("div", { className: "mb-1" },
|
|
3016
|
-
React__default.createElement(Flex, { maxW: "full", pl: 3, py: 2, "data-test": "schema-row", pos: "relative" },
|
|
3017
|
-
React__default.createElement(VStack, { spacing: 1, maxW: "full", className: "w-full" },
|
|
3018
|
-
React__default.createElement(Flex, { onClick: !isRoot ? handleToggle : undefined, className: `w-full ${isRoot ? '' : 'cursor-pointer'}` },
|
|
3019
|
-
!isRoot ? (React__default.createElement(Box, { mr: 2, className: "sl-font-mono sl-font-semibold sl-mr-2" },
|
|
3020
|
-
!TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
|
|
3021
|
-
!detectCircularPath(path) &&
|
|
3022
|
-
!((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular) &&
|
|
3023
|
-
!(schema === null || schema === void 0 ? void 0 : schema.circular) ? (React__default.createElement("i", { role: "img", "aria-hidden": "true", className: `sl-icon fal ${expanded ? 'fa-chevron-down' : 'fa-chevron-right'} fa-fw fa-sm` })) : (React__default.createElement("span", { className: "sl-icon fal fa-fw fa-sm", "aria-hidden": "true" })),
|
|
3024
|
-
' ' + displayTitle)) : null,
|
|
3025
|
-
!isRoot ? (React__default.createElement(Box, { mr: 2, pos: "relative" },
|
|
3026
|
-
React__default.createElement(Box, { display: "inline-flex", alignItems: "center", onMouseEnter: () => {
|
|
3027
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) {
|
|
3028
|
-
setIsHoveringSelector(true);
|
|
3029
|
-
}
|
|
3030
|
-
}, onMouseLeave: () => {
|
|
3031
|
-
if (!showSchemaDropdown) {
|
|
3032
|
-
setIsHoveringSelector(false);
|
|
3033
|
-
}
|
|
3034
|
-
}, onClick: (e) => {
|
|
3035
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) {
|
|
3036
|
-
e.stopPropagation();
|
|
3037
|
-
setShowSchemaDropdown(prev => !prev);
|
|
3038
|
-
}
|
|
3039
|
-
}, style: {
|
|
3040
|
-
cursor: (schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf) ? 'pointer' : 'default',
|
|
3041
|
-
} },
|
|
3042
|
-
React__default.createElement("span", { className: "sl-truncate sl-text-muted" },
|
|
3043
|
-
(() => {
|
|
3044
|
-
let typeDisplay = (schema === null || schema === void 0 ? void 0 : schema.type) === 'object' && (schema === null || schema === void 0 ? void 0 : schema.title) ? schema === null || schema === void 0 ? void 0 : schema.title : (schema === null || schema === void 0 ? void 0 : schema.type) || (root === null || root === void 0 ? void 0 : root.title);
|
|
3045
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
|
|
3046
|
-
return `any of ${typeDisplay}`;
|
|
3047
|
-
}
|
|
3048
|
-
else if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
|
|
3049
|
-
return `one of ${typeDisplay}`;
|
|
3050
|
-
}
|
|
3051
|
-
return typeDisplay;
|
|
3052
|
-
})(),
|
|
3053
|
-
(schema === null || schema === void 0 ? void 0 : schema.items) && ((_c = schema === null || schema === void 0 ? void 0 : schema.items) === null || _c === void 0 ? void 0 : _c.title) !== undefined ? ` [${(_d = schema === null || schema === void 0 ? void 0 : schema.items) === null || _d === void 0 ? void 0 : _d.title}] ` : null),
|
|
3054
|
-
((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) && (React__default.createElement(Box, { display: "inline-flex", alignItems: "center", ml: 1, style: {
|
|
3055
|
-
opacity: isHoveringSelector ? 1 : 0.6,
|
|
3056
|
-
transition: 'opacity 0.2s',
|
|
3057
|
-
} },
|
|
3058
|
-
React__default.createElement("i", { className: "sl-icon fas fa-chevron-down", style: {
|
|
3059
|
-
fontSize: '10px',
|
|
3060
|
-
opacity: 0.6,
|
|
3061
|
-
} })))),
|
|
3062
|
-
React__default.createElement("span", { className: "text-gray-500" }, (schema === null || schema === void 0 ? void 0 : schema.format) !== undefined ? `<${schema === null || schema === void 0 ? void 0 : schema.format}>` : null),
|
|
3063
|
-
((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) && showSchemaDropdown && combinedSchemaSelector())) : null),
|
|
3064
|
-
React__default.createElement(Flex, { pl: 1, w: "full", align: "start", direction: "col", style: { overflow: 'visible', paddingLeft: '20px' } },
|
|
3065
|
-
(schema === null || schema === void 0 ? void 0 : schema.description) && (React__default.createElement(Box, { fontFamily: "ui", fontWeight: "light" },
|
|
3066
|
-
React__default.createElement("span", { className: "sl-prose sl-markdown-viewer", style: { fontSize: '12px' } }, schema === null || schema === void 0 ? void 0 : schema.description))),
|
|
3067
|
-
!isRoot && (schema === null || schema === void 0 ? void 0 : schema.examples) !== undefined && (React__default.createElement(Flex, { align: "center", mb: 1, style: { flexWrap: 'wrap' } },
|
|
3068
|
-
React__default.createElement("span", { className: "text-gray-500", style: { marginRight: 8, flexShrink: 0 } }, "Example"),
|
|
3069
|
-
React__default.createElement(Box, { className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: {
|
|
3070
|
-
background: 'rgba(245, 247, 250, 0.5)',
|
|
3071
|
-
border: '1px solid #a0aec0',
|
|
3072
|
-
borderRadius: '4px',
|
|
3073
|
-
padding: '4px 8px',
|
|
3074
|
-
display: 'inline-block',
|
|
3075
|
-
overflowWrap: 'break-word',
|
|
3076
|
-
textAlign: 'left',
|
|
3077
|
-
maxWidth: '530px',
|
|
3078
|
-
} }, JSON.stringify(schema === null || schema === void 0 ? void 0 : schema.examples))))),
|
|
3079
|
-
React__default.createElement(Flex, { pl: 1, w: "full", align: "start", direction: "col", style: { overflow: 'visible', paddingLeft: '20px' } }, schema &&
|
|
3080
|
-
typeof schema === 'object' &&
|
|
3081
|
-
('minItems' in schema || 'enum' in schema) &&
|
|
3082
|
-
renderMinEnums(schema))),
|
|
3083
|
-
!isRoot && (React__default.createElement("label", { className: "inline-flex items-top ml-2" },
|
|
3084
|
-
React__default.createElement(Box, { mr: 2, fontFamily: "ui", fontWeight: "normal" }, showRequiredLabel && (React__default.createElement("div", { className: "sl-ml-2 sl-text-warning" },
|
|
3085
|
-
React__default.createElement("span", { style: { marginLeft: '10px' } }, "required"))))))),
|
|
3086
|
-
renderChildren()));
|
|
3087
|
-
};
|
|
3088
|
-
|
|
3089
2741
|
const isBodyEmpty = (body) => {
|
|
3090
2742
|
if (!body)
|
|
3091
2743
|
return true;
|
|
3092
2744
|
const { contents = [], description } = body;
|
|
3093
2745
|
return contents.length === 0 && !(description === null || description === void 0 ? void 0 : description.trim());
|
|
3094
2746
|
};
|
|
3095
|
-
const Body = ({ body, onChange, isHttpWebhookOperation = false
|
|
2747
|
+
const Body = ({ body, onChange, isHttpWebhookOperation = false }) => {
|
|
3096
2748
|
var _a;
|
|
3097
2749
|
const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
|
|
3098
2750
|
const [chosenContent, setChosenContent] = React.useState(0);
|
|
@@ -3105,36 +2757,13 @@ const Body = ({ body, onChange, isHttpWebhookOperation = false, disableProps })
|
|
|
3105
2757
|
const { contents = [], description } = body;
|
|
3106
2758
|
const schema = (_a = contents[chosenContent]) === null || _a === void 0 ? void 0 : _a.schema;
|
|
3107
2759
|
const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId: body.id, attr: 'description' });
|
|
3108
|
-
const getMaskProperties = () => {
|
|
3109
|
-
const disablePropsConfig = disableProps || [];
|
|
3110
|
-
const absolutePathsToHide = [];
|
|
3111
|
-
disablePropsConfig.forEach(configEntry => {
|
|
3112
|
-
const { location, paths, isComplex } = configEntry;
|
|
3113
|
-
if (paths.length === 0 && !isComplex) {
|
|
3114
|
-
absolutePathsToHide.push({ path: location });
|
|
3115
|
-
}
|
|
3116
|
-
else {
|
|
3117
|
-
paths.forEach((item) => {
|
|
3118
|
-
const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
|
|
3119
|
-
let object = { path: fullPath };
|
|
3120
|
-
if (item.hasOwnProperty('required')) {
|
|
3121
|
-
object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
|
|
3122
|
-
}
|
|
3123
|
-
absolutePathsToHide.push(object);
|
|
3124
|
-
});
|
|
3125
|
-
}
|
|
3126
|
-
});
|
|
3127
|
-
return absolutePathsToHide;
|
|
3128
|
-
};
|
|
3129
|
-
const shouldUseLazySchema = disableProps === null || disableProps === void 0 ? void 0 : disableProps.some(entry => entry.isComplex === true);
|
|
3130
|
-
console.log('!!!!! shouldUseLazySchema body!!!!', shouldUseLazySchema);
|
|
3131
2760
|
return (React.createElement(VStack, { spacing: 6 },
|
|
3132
2761
|
React.createElement(SectionSubtitle, { title: "Body", id: "request-body" }, contents.length > 0 && (React.createElement(Flex, { flex: 1, justify: "end" },
|
|
3133
2762
|
React.createElement(Select, { "aria-label": "Request Body Content Type", value: String(chosenContent), onChange: value => setChosenContent(parseInt(String(value), 10)), options: contents.map((content, index) => ({ label: content.mediaType, value: index })), size: "sm" })))),
|
|
3134
2763
|
description && (React.createElement(Box, { pos: "relative" },
|
|
3135
2764
|
React.createElement(MarkdownViewer, { markdown: description }),
|
|
3136
2765
|
React.createElement(NodeAnnotation, { change: descriptionChanged }))),
|
|
3137
|
-
|
|
2766
|
+
isJSONSchema(schema) && (React.createElement(JsonSchemaViewer, { resolveRef: refResolver, maxRefDepth: maxRefDepth, schema: getOriginalObject(schema), viewMode: isHttpWebhookOperation ? 'standalone' : 'write', renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }))));
|
|
3138
2767
|
};
|
|
3139
2768
|
Body.displayName = 'HttpOperation.Body';
|
|
3140
2769
|
|
|
@@ -3201,7 +2830,7 @@ const httpOperationParamsToSchema = ({ parameters, parameterType }) => {
|
|
|
3201
2830
|
return schema;
|
|
3202
2831
|
};
|
|
3203
2832
|
|
|
3204
|
-
const Request = ({ operation: { request, request: { path: pathParams = [], headers: headerParams = [], cookie: cookieParams = [], body, query: queryParams = [], } = {}, security, }, hideSecurityInfo, onChange, isHttpWebhookOperation = false,
|
|
2833
|
+
const Request = ({ operation: { request, request: { path: pathParams = [], headers: headerParams = [], cookie: cookieParams = [], body, query: queryParams = [], } = {}, security, }, hideSecurityInfo, onChange, isHttpWebhookOperation = false, }) => {
|
|
3205
2834
|
if (!request || typeof request !== 'object')
|
|
3206
2835
|
return null;
|
|
3207
2836
|
const bodyIsEmpty = isBodyEmpty(body);
|
|
@@ -3229,7 +2858,7 @@ const Request = ({ operation: { request, request: { path: pathParams = [], heade
|
|
|
3229
2858
|
cookieParams.length > 0 && (React.createElement(VStack, { spacing: 5 },
|
|
3230
2859
|
React.createElement(SectionSubtitle, { title: "Cookies", id: "request-cookies" }),
|
|
3231
2860
|
React.createElement(Parameters, { parameterType: "cookie", parameters: cookieParams }))),
|
|
3232
|
-
body &&
|
|
2861
|
+
body && React.createElement(Body, { onChange: onChange, body: body, isHttpWebhookOperation: isHttpWebhookOperation })));
|
|
3233
2862
|
};
|
|
3234
2863
|
Request.displayName = 'HttpOperation.Request';
|
|
3235
2864
|
const schemeExpandedState = atomWithStorage('HttpOperation_security_expanded', {});
|
|
@@ -3260,7 +2889,7 @@ const OptionalMessage$1 = () => {
|
|
|
3260
2889
|
return React.createElement(Callout, { appearance: "outline" }, OptionalSecurityMessage);
|
|
3261
2890
|
};
|
|
3262
2891
|
|
|
3263
|
-
const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTypeChange, isCompact,
|
|
2892
|
+
const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTypeChange, isCompact, }) => {
|
|
3264
2893
|
var _a, _b;
|
|
3265
2894
|
const responses = sortBy(uniqBy(unsortedResponses, r => r.code), r => r.code);
|
|
3266
2895
|
const [activeResponseId, setActiveResponseId] = React.useState((_b = (_a = responses[0]) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : '');
|
|
@@ -3293,12 +2922,11 @@ const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTy
|
|
|
3293
2922
|
const tabResponses = (React.createElement(TabList, { density: "compact" }, responses.map(({ code }) => (React.createElement(Tab, { key: code, id: code, intent: codeToIntentVal(code) }, code)))));
|
|
3294
2923
|
return (React.createElement(VStack, { spacing: 8, as: Tabs, selectedId: activeResponseId, onChange: setActiveResponseId, appearance: "pill" },
|
|
3295
2924
|
React.createElement(SectionTitle, { title: "Responses", isCompact: isCompact }, isCompact ? compactResponses : tabResponses),
|
|
3296
|
-
isCompact ? (React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange
|
|
3297
|
-
React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange
|
|
2925
|
+
isCompact ? (React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange })) : (React.createElement(TabPanels, { p: 0 }, responses.map(response => (React.createElement(TabPanel, { key: response.code, id: response.code },
|
|
2926
|
+
React.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange }))))))));
|
|
3298
2927
|
};
|
|
3299
2928
|
Responses.displayName = 'HttpOperation.Responses';
|
|
3300
|
-
const Response = ({ response, onMediaTypeChange
|
|
3301
|
-
var _a, _b;
|
|
2929
|
+
const Response = ({ response, onMediaTypeChange }) => {
|
|
3302
2930
|
const { contents = [], headers = [], description } = response;
|
|
3303
2931
|
const [chosenContent, setChosenContent] = React.useState(0);
|
|
3304
2932
|
const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
|
|
@@ -3309,29 +2937,6 @@ const Response = ({ response, onMediaTypeChange, disableProps, statusCode }) =>
|
|
|
3309
2937
|
responseContent && (onMediaTypeChange === null || onMediaTypeChange === void 0 ? void 0 : onMediaTypeChange(responseContent.mediaType));
|
|
3310
2938
|
}, [responseContent]);
|
|
3311
2939
|
const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId: response.id, attr: 'description' });
|
|
3312
|
-
const getMaskProperties = () => {
|
|
3313
|
-
if (!disableProps || !statusCode)
|
|
3314
|
-
return [];
|
|
3315
|
-
const configEntries = disableProps[statusCode] || [];
|
|
3316
|
-
const absolutePathsToHide = [];
|
|
3317
|
-
configEntries.forEach(({ location, paths, isComplex }) => {
|
|
3318
|
-
if (paths.length === 0 && !isComplex) {
|
|
3319
|
-
absolutePathsToHide.push({ path: location });
|
|
3320
|
-
}
|
|
3321
|
-
else {
|
|
3322
|
-
paths.forEach((item) => {
|
|
3323
|
-
const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
|
|
3324
|
-
let object = { path: fullPath };
|
|
3325
|
-
if (item.hasOwnProperty('required')) {
|
|
3326
|
-
object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
|
|
3327
|
-
}
|
|
3328
|
-
absolutePathsToHide.push(object);
|
|
3329
|
-
});
|
|
3330
|
-
}
|
|
3331
|
-
});
|
|
3332
|
-
return absolutePathsToHide;
|
|
3333
|
-
};
|
|
3334
|
-
const shouldUseLazySchema = (_b = (statusCode && ((_a = disableProps === null || disableProps === void 0 ? void 0 : disableProps[statusCode]) === null || _a === void 0 ? void 0 : _a.some(entry => entry.isComplex)))) !== null && _b !== void 0 ? _b : false;
|
|
3335
2940
|
return (React.createElement(VStack, { spacing: 8, pt: 8 },
|
|
3336
2941
|
description && (React.createElement(Box, { pos: "relative" },
|
|
3337
2942
|
React.createElement(MarkdownViewer, { markdown: description }),
|
|
@@ -3343,7 +2948,7 @@ const Response = ({ response, onMediaTypeChange, disableProps, statusCode }) =>
|
|
|
3343
2948
|
React.createElement(SectionSubtitle, { title: "Body", id: "response-body" },
|
|
3344
2949
|
React.createElement(Flex, { flex: 1, justify: "end" },
|
|
3345
2950
|
React.createElement(Select, { "aria-label": "Response Body Content Type", value: String(chosenContent), onChange: value => setChosenContent(parseInt(String(value), 10)), options: contents.map((content, index) => ({ label: content.mediaType, value: index })), size: "sm" }))),
|
|
3346
|
-
schema &&
|
|
2951
|
+
schema && (React.createElement(JsonSchemaViewer, { schema: getOriginalObject(schema), resolveRef: refResolver, maxRefDepth: maxRefDepth, viewMode: "read", parentCrumbs: ['responses', response.code], renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }))))));
|
|
3347
2952
|
};
|
|
3348
2953
|
Response.displayName = 'HttpOperation.Response';
|
|
3349
2954
|
const codeToIntentVal = (code) => {
|
|
@@ -3392,7 +2997,7 @@ const Callback = ({ data, isCompact }) => {
|
|
|
3392
2997
|
};
|
|
3393
2998
|
Callbacks.displayName = 'HttpOperation.Callback';
|
|
3394
2999
|
|
|
3395
|
-
const HttpOperationComponent = React.memo(({ className, data: unresolvedData, layoutOptions, tryItCredentialsPolicy, tryItCorsProxy
|
|
3000
|
+
const HttpOperationComponent = React.memo(({ className, data: unresolvedData, layoutOptions, tryItCredentialsPolicy, tryItCorsProxy }) => {
|
|
3396
3001
|
var _a;
|
|
3397
3002
|
const { nodeHasChanged } = useOptionsCtx();
|
|
3398
3003
|
const data = useResolvedObject(unresolvedData);
|
|
@@ -3423,11 +3028,11 @@ const HttpOperationComponent = React.memo(({ className, data: unresolvedData, la
|
|
|
3423
3028
|
React.createElement(MarkdownViewer, { className: "HttpOperation__Description", markdown: data.description }),
|
|
3424
3029
|
React.createElement(NodeAnnotation, { change: descriptionChanged }))),
|
|
3425
3030
|
React.createElement(NodeVendorExtensions, { data: data }),
|
|
3426
|
-
React.createElement(Request, { onChange: setTextRequestBodyIndex, operation: data, hideSecurityInfo: layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideSecurityInfo, isHttpWebhookOperation: isHttpWebhookOperation(data)
|
|
3427
|
-
data.responses && (React.createElement(Responses, { responses: data.responses, onMediaTypeChange: setResponseMediaType, onStatusCodeChange: setResponseStatusCode, isCompact: isCompact
|
|
3031
|
+
React.createElement(Request, { onChange: setTextRequestBodyIndex, operation: data, hideSecurityInfo: layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideSecurityInfo, isHttpWebhookOperation: isHttpWebhookOperation(data) }),
|
|
3032
|
+
data.responses && (React.createElement(Responses, { responses: data.responses, onMediaTypeChange: setResponseMediaType, onStatusCodeChange: setResponseStatusCode, isCompact: isCompact })),
|
|
3428
3033
|
((_a = data.callbacks) === null || _a === void 0 ? void 0 : _a.length) ? React.createElement(Callbacks, { callbacks: data.callbacks, isCompact: isCompact }) : null,
|
|
3429
3034
|
isCompact && tryItPanel));
|
|
3430
|
-
return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('HttpOperation', className), header: header, left: description, right: !
|
|
3035
|
+
return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('HttpOperation', className), header: header, left: description, right: !isCompact && tryItPanel }));
|
|
3431
3036
|
});
|
|
3432
3037
|
HttpOperationComponent.displayName = 'HttpOperation.Component';
|
|
3433
3038
|
const HttpOperation = withErrorBoundary(HttpOperationComponent, {
|
|
@@ -3678,7 +3283,7 @@ const HttpServiceComponent = React.memo(({ data: unresolvedData, location = {},
|
|
|
3678
3283
|
HttpServiceComponent.displayName = 'HttpService.Component';
|
|
3679
3284
|
const HttpService = withErrorBoundary(HttpServiceComponent, { recoverableProps: ['data'] });
|
|
3680
3285
|
|
|
3681
|
-
const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps,
|
|
3286
|
+
const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps, }) => {
|
|
3682
3287
|
var _a, _b;
|
|
3683
3288
|
const [resolveRef, maxRefDepth] = useSchemaInlineRefResolver();
|
|
3684
3289
|
const data = useResolvedObject(unresolvedData);
|
|
@@ -3701,40 +3306,14 @@ const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOpti
|
|
|
3701
3306
|
exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React.createElement(ExportButton, Object.assign({}, exportProps))));
|
|
3702
3307
|
const modelExamples = !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideModelExamples) && React.createElement(ModelExamples, { data: data, isCollapsible: isCompact });
|
|
3703
3308
|
const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId, attr: 'description' });
|
|
3704
|
-
const getMaskProperties = () => {
|
|
3705
|
-
const disablePropsConfig = disableProps === null || disableProps === void 0 ? void 0 : disableProps.models;
|
|
3706
|
-
const absolutePathsToHide = [];
|
|
3707
|
-
if (disableProps === null || disableProps === void 0 ? void 0 : disableProps.models) {
|
|
3708
|
-
disablePropsConfig.forEach((configEntry) => {
|
|
3709
|
-
const { location, paths, isComplex } = configEntry;
|
|
3710
|
-
if (paths.length === 0 && !isComplex) {
|
|
3711
|
-
absolutePathsToHide.push({ path: location });
|
|
3712
|
-
}
|
|
3713
|
-
else {
|
|
3714
|
-
paths.forEach((item) => {
|
|
3715
|
-
const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
|
|
3716
|
-
let object = { path: fullPath };
|
|
3717
|
-
if (item.hasOwnProperty('required')) {
|
|
3718
|
-
object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
|
|
3719
|
-
}
|
|
3720
|
-
absolutePathsToHide.push(object);
|
|
3721
|
-
});
|
|
3722
|
-
}
|
|
3723
|
-
});
|
|
3724
|
-
}
|
|
3725
|
-
return absolutePathsToHide;
|
|
3726
|
-
};
|
|
3727
|
-
const shouldUseLazySchema = disableProps && (disableProps === null || disableProps === void 0 ? void 0 : disableProps.models)
|
|
3728
|
-
? disableProps.models.some((entry) => entry.isComplex === true)
|
|
3729
|
-
: false;
|
|
3730
3309
|
const description = (React.createElement(VStack, { spacing: 10 },
|
|
3731
3310
|
data.description && data.type === 'object' && (React.createElement(Box, { pos: "relative" },
|
|
3732
3311
|
React.createElement(MarkdownViewer, { role: "textbox", markdown: data.description }),
|
|
3733
3312
|
React.createElement(NodeAnnotation, { change: descriptionChanged }))),
|
|
3734
3313
|
React.createElement(NodeVendorExtensions, { data: data }),
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('Model', className), header: header, left: description, right: !
|
|
3314
|
+
isCompact && modelExamples,
|
|
3315
|
+
React.createElement(JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon, skipTopLevelDescription: true })));
|
|
3316
|
+
return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('Model', className), header: header, left: description, right: !isCompact && modelExamples }));
|
|
3738
3317
|
};
|
|
3739
3318
|
const ModelExamples = React.memo(({ data, isCollapsible = false }) => {
|
|
3740
3319
|
var _a;
|
|
@@ -3756,41 +3335,30 @@ const Model = withErrorBoundary(ModelComponent, { recoverableProps: ['data'] });
|
|
|
3756
3335
|
|
|
3757
3336
|
const Docs = React.memo((_a) => {
|
|
3758
3337
|
var _b;
|
|
3759
|
-
var { nodeType, nodeData,
|
|
3338
|
+
var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, maxRefDepth, nodeHasChanged, renderExtensionAddon } = _a, commonProps = __rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "maxRefDepth", "nodeHasChanged", "renderExtensionAddon"]);
|
|
3760
3339
|
const parsedNode = useParsedData(nodeType, nodeData);
|
|
3761
3340
|
if (!parsedNode) {
|
|
3762
3341
|
(_b = commonProps.nodeUnsupported) === null || _b === void 0 ? void 0 : _b.call(commonProps, 'dataEmpty');
|
|
3763
3342
|
return null;
|
|
3764
3343
|
}
|
|
3765
|
-
let elem = React.createElement(ParsedDocs, Object.assign({ node: parsedNode
|
|
3344
|
+
let elem = React.createElement(ParsedDocs, Object.assign({ node: parsedNode }, commonProps));
|
|
3766
3345
|
if (useNodeForRefResolving) {
|
|
3767
3346
|
elem = (React.createElement(InlineRefResolverProvider, { document: parsedNode.data, resolver: refResolver, maxRefDepth: maxRefDepth }, elem));
|
|
3768
3347
|
}
|
|
3769
3348
|
return (React.createElement(ElementsOptionsProvider, { nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }, elem));
|
|
3770
3349
|
});
|
|
3771
|
-
const getTryItVisibility = (disableProps) => {
|
|
3772
|
-
var _a, _b, _c, _d;
|
|
3773
|
-
if (!disableProps)
|
|
3774
|
-
return { hideOperationTryIt: false, hideModelTryIt: false };
|
|
3775
|
-
const requestHasComplex = (_b = (_a = disableProps.request) === null || _a === void 0 ? void 0 : _a.some(item => item.isComplex)) !== null && _b !== void 0 ? _b : false;
|
|
3776
|
-
const responseHasComplex = Object.values(disableProps.response || {}).some(arr => arr.some(item => item.isComplex));
|
|
3777
|
-
const hideOperationTryIt = requestHasComplex || responseHasComplex;
|
|
3778
|
-
const hideModelTryIt = (_d = (_c = disableProps.models) === null || _c === void 0 ? void 0 : _c.some(item => item.isComplex)) !== null && _d !== void 0 ? _d : false;
|
|
3779
|
-
return { hideOperationTryIt, hideModelTryIt };
|
|
3780
|
-
};
|
|
3781
3350
|
const ParsedDocs = (_a) => {
|
|
3782
|
-
var { node, nodeUnsupported
|
|
3783
|
-
const { hideOperationTryIt, hideModelTryIt } = getTryItVisibility(disableProps);
|
|
3351
|
+
var { node, nodeUnsupported } = _a, commonProps = __rest(_a, ["node", "nodeUnsupported"]);
|
|
3784
3352
|
switch (node.type) {
|
|
3785
3353
|
case 'article':
|
|
3786
3354
|
return React.createElement(Article, Object.assign({ data: node.data }, commonProps));
|
|
3787
3355
|
case 'http_operation':
|
|
3788
3356
|
case 'http_webhook':
|
|
3789
|
-
return React.createElement(HttpOperation, Object.assign({ data: node.data
|
|
3357
|
+
return React.createElement(HttpOperation, Object.assign({ data: node.data }, commonProps));
|
|
3790
3358
|
case 'http_service':
|
|
3791
3359
|
return React.createElement(HttpService, Object.assign({ data: node.data }, commonProps));
|
|
3792
3360
|
case 'model':
|
|
3793
|
-
return React.createElement(Model, Object.assign({ data: node.data
|
|
3361
|
+
return React.createElement(Model, Object.assign({ data: node.data }, commonProps));
|
|
3794
3362
|
default:
|
|
3795
3363
|
nodeUnsupported === null || nodeUnsupported === void 0 ? void 0 : nodeUnsupported('invalidType');
|
|
3796
3364
|
return null;
|
|
@@ -4536,25 +4104,12 @@ const doBundle = (data, baseUrl) => {
|
|
|
4536
4104
|
}
|
|
4537
4105
|
};
|
|
4538
4106
|
|
|
4539
|
-
const
|
|
4540
|
-
|
|
4541
|
-
getChildContext() {
|
|
4542
|
-
return {
|
|
4543
|
-
blueprintPortalClassName: scopeClassName,
|
|
4544
|
-
};
|
|
4545
|
-
}
|
|
4546
|
-
render() {
|
|
4547
|
-
return (React.createElement(Box, { className: "sl-elements sl-antialiased", fontFamily: "ui", fontSize: "base", color: "body", h: "full" }, this.props.children));
|
|
4548
|
-
}
|
|
4549
|
-
}
|
|
4550
|
-
Styled.childContextTypes = {
|
|
4551
|
-
blueprintPortalClassName: PropTypes.string,
|
|
4107
|
+
const Styled = ({ children }) => {
|
|
4108
|
+
return (React.createElement(Box, { className: "sl-elements sl-antialiased", fontFamily: "ui", fontSize: "base", color: "body", h: "full" }, children));
|
|
4552
4109
|
};
|
|
4553
4110
|
function withStyles(Component) {
|
|
4554
|
-
const Inner = props =>
|
|
4555
|
-
|
|
4556
|
-
React.createElement(Component, Object.assign({}, props))));
|
|
4557
|
-
};
|
|
4111
|
+
const Inner = props => (React.createElement(Styled, null,
|
|
4112
|
+
React.createElement(Component, Object.assign({}, props))));
|
|
4558
4113
|
Inner.displayName = `withStyles(${getDisplayName(Component)})`;
|
|
4559
4114
|
return Inner;
|
|
4560
4115
|
}
|
|
@@ -4604,7 +4159,7 @@ const createElementClass = (Component, propDescriptors) => {
|
|
|
4604
4159
|
}
|
|
4605
4160
|
disconnectedCallback() {
|
|
4606
4161
|
if (this._mountPoint) {
|
|
4607
|
-
ReactDOM.
|
|
4162
|
+
ReactDOM.render(null, this._mountPoint);
|
|
4608
4163
|
this.removeChild(this._mountPoint);
|
|
4609
4164
|
this._mountPoint = undefined;
|
|
4610
4165
|
}
|