@stoplight/elements-core 9.0.6 → 9.0.7
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 -4
- package/components/Docs/HttpOperation/Body.d.ts +1 -7
- 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 -11
- package/index.d.ts +2 -2
- package/index.esm.js +23 -416
- package/index.js +23 -416
- package/index.mjs +23 -416
- package/package.json +1 -1
- package/components/Docs/HttpOperation/LazySchemaTreePreviewer.d.ts +0 -25
package/index.js
CHANGED
|
@@ -136,8 +136,6 @@ const isResolvedObjectProxy = (someObject) => {
|
|
|
136
136
|
return !!someObject[originalObjectSymbol];
|
|
137
137
|
};
|
|
138
138
|
const getOriginalObject = (resolvedObject) => {
|
|
139
|
-
if (!resolvedObject)
|
|
140
|
-
return resolvedObject;
|
|
141
139
|
const originalObject = resolvedObject[originalObjectSymbol] || resolvedObject;
|
|
142
140
|
if (!originalObject) {
|
|
143
141
|
return resolvedObject;
|
|
@@ -2607,7 +2605,7 @@ const TwoColumnLayout = React.forwardRef(({ header, right, left, className }, re
|
|
|
2607
2605
|
header,
|
|
2608
2606
|
React.createElement(mosaic.Flex, null,
|
|
2609
2607
|
React.createElement(mosaic.Box, { "data-testid": "two-column-left", w: 0, flex: 1 }, left),
|
|
2610
|
-
|
|
2608
|
+
right && (React.createElement(mosaic.Box, { "data-testid": "two-column-right", ml: 16, pos: "relative", w: "2/5", style: { maxWidth: 500 } }, right))))));
|
|
2611
2609
|
|
|
2612
2610
|
const DeprecatedBadge = () => (React.createElement(mosaic.Tooltip, { renderTrigger: React.createElement(mosaic.Badge, { intent: "warning", icon: ['fas', 'exclamation-circle'], "data-testid": "badge-deprecated" }, "Deprecated") }, "This operation has been marked as deprecated, which means it could be removed at some point in the future."));
|
|
2613
2611
|
const InternalBadge = ({ isHttpService }) => (React.createElement(mosaic.Tooltip, { renderTrigger: React.createElement(mosaic.Badge, { icon: faEye, "data-testid": "badge-internal", bg: "danger" }, "Internal") }, `This ${isHttpService ? 'operation' : 'model'} is marked as internal and won't be visible in public docs.`));
|
|
@@ -2758,349 +2756,13 @@ const PanelContent = ({ schemes }) => {
|
|
|
2758
2756
|
})));
|
|
2759
2757
|
};
|
|
2760
2758
|
|
|
2761
|
-
const TYPES = ['string', 'integer', 'boolean', 'any', 'number'];
|
|
2762
|
-
function resolvePointer(obj, pointer) {
|
|
2763
|
-
const parts = pointer.replace(/^#\//, '').split('/');
|
|
2764
|
-
return parts.reduce((acc, key) => acc && acc[key], obj);
|
|
2765
|
-
}
|
|
2766
|
-
function detectCircularPath(path) {
|
|
2767
|
-
const ignored = ['properties', 'items'];
|
|
2768
|
-
const parts = path.split('/').filter(part => !ignored.includes(part));
|
|
2769
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
2770
|
-
const current = parts[i];
|
|
2771
|
-
const rest = parts.slice(i + 1);
|
|
2772
|
-
if (rest.includes(current)) {
|
|
2773
|
-
return true;
|
|
2774
|
-
}
|
|
2775
|
-
}
|
|
2776
|
-
return false;
|
|
2777
|
-
}
|
|
2778
|
-
function dereference(node, root, visited = new WeakSet(), depth = 0, maxDepth = 10) {
|
|
2779
|
-
if (!node || typeof node !== 'object')
|
|
2780
|
-
return node;
|
|
2781
|
-
if (depth > maxDepth)
|
|
2782
|
-
return node;
|
|
2783
|
-
if (node.$ref || node['x-iata-$ref']) {
|
|
2784
|
-
let refPath = node.$ref || node['x-iata-$ref'];
|
|
2785
|
-
if (refPath.includes('#/%24defs')) {
|
|
2786
|
-
refPath = refPath.replace('#/%24defs', '$defs');
|
|
2787
|
-
}
|
|
2788
|
-
else {
|
|
2789
|
-
refPath = refPath.replace('__bundled__', 'definitions');
|
|
2790
|
-
}
|
|
2791
|
-
if (visited.has(node))
|
|
2792
|
-
return { circular: true, $ref: refPath, title: node.title, type: 'any', description: node.description };
|
|
2793
|
-
visited.add(node);
|
|
2794
|
-
const target = resolvePointer(root, refPath);
|
|
2795
|
-
if (!target)
|
|
2796
|
-
return node;
|
|
2797
|
-
const result = Object.assign({}, target);
|
|
2798
|
-
if ('description' in node)
|
|
2799
|
-
result.description = node.description;
|
|
2800
|
-
if ('title' in node)
|
|
2801
|
-
result.title = node.title;
|
|
2802
|
-
return dereference(result, root, visited, depth + 1, maxDepth);
|
|
2803
|
-
}
|
|
2804
|
-
if (Array.isArray(node)) {
|
|
2805
|
-
return node.map(item => dereference(item, root, visited, depth + 1, maxDepth));
|
|
2806
|
-
}
|
|
2807
|
-
const result = {};
|
|
2808
|
-
for (const key in node) {
|
|
2809
|
-
result[key] = dereference(node[key], root, visited, depth + 1, maxDepth);
|
|
2810
|
-
}
|
|
2811
|
-
return result;
|
|
2812
|
-
}
|
|
2813
|
-
const trimSlashes = (str) => {
|
|
2814
|
-
return str.replace(/^\/|\/$/g, '');
|
|
2815
|
-
};
|
|
2816
|
-
function isPropertiesAllHidden(path, hideData) {
|
|
2817
|
-
const current = trimSlashes(path);
|
|
2818
|
-
const parts = current.split('/');
|
|
2819
|
-
for (let i = parts.length; i >= 2; i--) {
|
|
2820
|
-
if (parts[i - 1] === 'properties') {
|
|
2821
|
-
const ancestorPropPath = parts.slice(0, i).join('/');
|
|
2822
|
-
const block = hideData.find(h => trimSlashes(h.path) === ancestorPropPath && ancestorPropPath.endsWith('/properties'));
|
|
2823
|
-
if (block && block.required === undefined) {
|
|
2824
|
-
return true;
|
|
2825
|
-
}
|
|
2826
|
-
}
|
|
2827
|
-
}
|
|
2828
|
-
return false;
|
|
2829
|
-
}
|
|
2830
|
-
function isRequiredOverride(path, hideData) {
|
|
2831
|
-
const entry = hideData.find(h => trimSlashes(h.path) === trimSlashes(path));
|
|
2832
|
-
return entry && typeof entry.required === 'boolean' ? entry.required : undefined;
|
|
2833
|
-
}
|
|
2834
|
-
function isPathHidden(path, hideData) {
|
|
2835
|
-
const normalizedPath = trimSlashes(path);
|
|
2836
|
-
const direct = hideData.find(h => trimSlashes(h.path) === normalizedPath);
|
|
2837
|
-
if (direct && direct.required === undefined)
|
|
2838
|
-
return true;
|
|
2839
|
-
if (isPropertiesAllHidden(path, hideData))
|
|
2840
|
-
return true;
|
|
2841
|
-
for (const h of hideData) {
|
|
2842
|
-
const hPath = trimSlashes(h.path);
|
|
2843
|
-
if (h.required !== undefined)
|
|
2844
|
-
continue;
|
|
2845
|
-
if (normalizedPath.length > hPath.length &&
|
|
2846
|
-
normalizedPath.startsWith(hPath) &&
|
|
2847
|
-
(hPath.endsWith('/items') || (hPath.match(/\/items\/[^\/]+$/) && normalizedPath.startsWith(hPath + '/')))) {
|
|
2848
|
-
return true;
|
|
2849
|
-
}
|
|
2850
|
-
}
|
|
2851
|
-
return false;
|
|
2852
|
-
}
|
|
2853
|
-
const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path = '', hideData = [], parentRequired, propertyKey, _subType, }) => {
|
|
2854
|
-
var _a, _b, _c, _d;
|
|
2855
|
-
const [expanded, setExpanded] = React.useState(false);
|
|
2856
|
-
const [selectedSchemaIndex, setSelectedSchemaIndex] = React.useState(0);
|
|
2857
|
-
const [showSchemaDropdown, setShowSchemaDropdown] = React.useState(false);
|
|
2858
|
-
const [isHoveringSelector, setIsHoveringSelector] = React.useState(false);
|
|
2859
|
-
const isRoot = level === 1 && (title === undefined || path === '');
|
|
2860
|
-
React.useState(() => {
|
|
2861
|
-
const disabledPaths = hideData || [];
|
|
2862
|
-
const initialState = {};
|
|
2863
|
-
if (disabledPaths) {
|
|
2864
|
-
for (const p of disabledPaths) {
|
|
2865
|
-
const { path } = p;
|
|
2866
|
-
initialState[path] = { checked: false, required: 0 };
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
|
-
return initialState;
|
|
2870
|
-
});
|
|
2871
|
-
React.useEffect(() => {
|
|
2872
|
-
setSelectedSchemaIndex(0);
|
|
2873
|
-
}, [schema === null || schema === void 0 ? void 0 : schema.anyOf, schema === null || schema === void 0 ? void 0 : schema.oneOf]);
|
|
2874
|
-
const thisNodeRequiredOverride = isRequiredOverride(path, hideData);
|
|
2875
|
-
const shouldHideAllChildren = (isRoot && hideData.some(h => trimSlashes(h.path) === 'properties' && h.required === undefined)) ||
|
|
2876
|
-
(!isRoot && isPropertiesAllHidden(path, hideData));
|
|
2877
|
-
const shouldHideNode = React.useMemo(() => {
|
|
2878
|
-
if (isRoot)
|
|
2879
|
-
return false;
|
|
2880
|
-
if (isPathHidden(path, hideData) && thisNodeRequiredOverride === undefined)
|
|
2881
|
-
return true;
|
|
2882
|
-
return false;
|
|
2883
|
-
}, [path, hideData, isRoot, thisNodeRequiredOverride]);
|
|
2884
|
-
if (!schema || shouldHideNode) {
|
|
2885
|
-
return null;
|
|
2886
|
-
}
|
|
2887
|
-
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';
|
|
2888
|
-
const handleToggle = () => {
|
|
2889
|
-
const circular = detectCircularPath(path);
|
|
2890
|
-
if (!circular) {
|
|
2891
|
-
setExpanded(prev => !prev);
|
|
2892
|
-
}
|
|
2893
|
-
};
|
|
2894
|
-
const renderChildren = () => {
|
|
2895
|
-
var _a, _b, _c, _d;
|
|
2896
|
-
if (shouldHideAllChildren)
|
|
2897
|
-
return null;
|
|
2898
|
-
if (!expanded && !isRoot)
|
|
2899
|
-
return null;
|
|
2900
|
-
const children = [];
|
|
2901
|
-
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))) {
|
|
2902
|
-
let props = schema === null || schema === void 0 ? void 0 : schema.properties;
|
|
2903
|
-
if (schema === null || schema === void 0 ? void 0 : schema.allOf) {
|
|
2904
|
-
schema === null || schema === void 0 ? void 0 : schema.allOf.forEach((item) => {
|
|
2905
|
-
props = Object.assign(Object.assign({}, props), item.properties);
|
|
2906
|
-
});
|
|
2907
|
-
}
|
|
2908
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
|
|
2909
|
-
const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.anyOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.anyOf[0]);
|
|
2910
|
-
props = Object.assign(Object.assign({}, props), selectedSchema.properties);
|
|
2911
|
-
}
|
|
2912
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
|
|
2913
|
-
const selectedSchema = (schema === null || schema === void 0 ? void 0 : schema.oneOf[selectedSchemaIndex]) || (schema === null || schema === void 0 ? void 0 : schema.oneOf[0]);
|
|
2914
|
-
props = Object.assign(Object.assign({}, props), selectedSchema.properties);
|
|
2915
|
-
}
|
|
2916
|
-
for (const [key, child] of Object.entries(props || {})) {
|
|
2917
|
-
const childPath = `${path}/properties/${key}`;
|
|
2918
|
-
const childRequiredOverride = isRequiredOverride(childPath, hideData);
|
|
2919
|
-
const shouldHideChild = isPathHidden(childPath, hideData) && childRequiredOverride === undefined;
|
|
2920
|
-
const resolved = dereference(child, root);
|
|
2921
|
-
if (!shouldHideChild) {
|
|
2922
|
-
children.push(React.createElement("li", { key: key },
|
|
2923
|
-
React.createElement(LazySchemaTreePreviewer, { schema: resolved, root: root, title: key, level: level + 1, path: childPath, hideData: hideData, 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 })));
|
|
2924
|
-
}
|
|
2925
|
-
}
|
|
2926
|
-
}
|
|
2927
|
-
else if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array' &&
|
|
2928
|
-
(schema === null || schema === void 0 ? void 0 : schema.items) &&
|
|
2929
|
-
Object.keys(schema === null || schema === void 0 ? void 0 : schema.items).length > 0 &&
|
|
2930
|
-
!((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular)) {
|
|
2931
|
-
const resolvedItems = dereference(schema === null || schema === void 0 ? void 0 : schema.items, root);
|
|
2932
|
-
const itemsPath = `${path}/items`;
|
|
2933
|
-
if (resolvedItems && resolvedItems.type === 'object' && resolvedItems.properties) {
|
|
2934
|
-
for (const [key, child] of Object.entries(resolvedItems.properties)) {
|
|
2935
|
-
const childPath = `${itemsPath}/properties/${key}`;
|
|
2936
|
-
const childRequiredOverride = isRequiredOverride(childPath, hideData);
|
|
2937
|
-
const shouldHideChild = isPathHidden(childPath, hideData) && childRequiredOverride === undefined;
|
|
2938
|
-
if (!shouldHideChild) {
|
|
2939
|
-
children.push(React.createElement("li", { key: key },
|
|
2940
|
-
React.createElement(LazySchemaTreePreviewer, { schema: dereference(child, root), root: root, title: key, level: level + 2, path: childPath, hideData: hideData, parentRequired: resolvedItems.required, propertyKey: key, _subType: (_c = resolvedItems === null || resolvedItems === void 0 ? void 0 : resolvedItems.items) === null || _c === void 0 ? void 0 : _c.type })));
|
|
2941
|
-
}
|
|
2942
|
-
}
|
|
2943
|
-
}
|
|
2944
|
-
else if (resolvedItems && resolvedItems.type === 'array' && resolvedItems.items.length > 0) {
|
|
2945
|
-
const childPath = `${path}/items`;
|
|
2946
|
-
const childRequiredOverride = isRequiredOverride(childPath, hideData);
|
|
2947
|
-
const shouldHideChild = isPathHidden(childPath, hideData) && childRequiredOverride === undefined;
|
|
2948
|
-
if (!shouldHideChild) {
|
|
2949
|
-
children.push(React.createElement("li", { key: "items" },
|
|
2950
|
-
React.createElement(LazySchemaTreePreviewer, { schema: resolvedItems, root: root, title: "items", level: level + 1, path: childPath, hideData: hideData, 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 })));
|
|
2951
|
-
}
|
|
2952
|
-
}
|
|
2953
|
-
}
|
|
2954
|
-
return children.length > 0 ? React.createElement("ul", { className: "ml-6 border-l border-gray-200 pl-2" }, children) : null;
|
|
2955
|
-
};
|
|
2956
|
-
const combinedSchemaSelector = () => {
|
|
2957
|
-
var _a;
|
|
2958
|
-
return (React.createElement(React.Fragment, null,
|
|
2959
|
-
React.createElement(mosaic.Box, { pos: "fixed", top: 0, left: 0, right: 0, bottom: 0, bg: "transparent", style: { zIndex: 999 }, onClick: () => setShowSchemaDropdown(false) }),
|
|
2960
|
-
React.createElement(mosaic.Box, { pos: "absolute", bg: "canvas", rounded: true, boxShadow: "md", style: {
|
|
2961
|
-
zIndex: 1000,
|
|
2962
|
-
top: '100%',
|
|
2963
|
-
left: 0,
|
|
2964
|
-
minWidth: '150px',
|
|
2965
|
-
maxWidth: '200px',
|
|
2966
|
-
marginTop: '2px',
|
|
2967
|
-
border: '1px solid rgba(0, 0, 0, 0.1)',
|
|
2968
|
-
}, 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.createElement(mosaic.Box, { key: index, px: 3, py: 2, cursor: "pointer", bg: selectedSchemaIndex === index ? 'primary-tint' : 'canvas', fontSize: "xs", display: "flex", alignItems: "center", style: {
|
|
2969
|
-
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',
|
|
2970
|
-
gap: '8px',
|
|
2971
|
-
}, onMouseEnter: (e) => {
|
|
2972
|
-
if (selectedSchemaIndex !== index) {
|
|
2973
|
-
e.currentTarget.style.backgroundColor = 'var(--sl-color-canvas-tint)';
|
|
2974
|
-
}
|
|
2975
|
-
}, onMouseLeave: (e) => {
|
|
2976
|
-
if (selectedSchemaIndex !== index) {
|
|
2977
|
-
e.currentTarget.style.backgroundColor = 'var(--sl-color-canvas)';
|
|
2978
|
-
}
|
|
2979
|
-
}, onClick: () => {
|
|
2980
|
-
setSelectedSchemaIndex(index);
|
|
2981
|
-
setShowSchemaDropdown(false);
|
|
2982
|
-
} },
|
|
2983
|
-
React.createElement(mosaic.Box, { flex: 1, color: "body" }, schemaOption.type || 'object'),
|
|
2984
|
-
selectedSchemaIndex === index && (React.createElement(mosaic.Box, { color: "primary", fontSize: "xs" }, "\u2713"))))))));
|
|
2985
|
-
};
|
|
2986
|
-
const renderMinEnums = (schema) => {
|
|
2987
|
-
if (!schema || typeof schema !== 'object')
|
|
2988
|
-
return null;
|
|
2989
|
-
const boxStyle = {
|
|
2990
|
-
background: 'rgba(245, 247, 250, 0.5)',
|
|
2991
|
-
border: '1px solid #a0aec0',
|
|
2992
|
-
borderRadius: '4px',
|
|
2993
|
-
padding: '0px 2px',
|
|
2994
|
-
display: 'inline-block',
|
|
2995
|
-
overflowWrap: 'break-word',
|
|
2996
|
-
textAlign: 'left',
|
|
2997
|
-
maxWidth: 'fit-content',
|
|
2998
|
-
maxHeight: 'fit-content',
|
|
2999
|
-
};
|
|
3000
|
-
if ('minItems' in schema) {
|
|
3001
|
-
const schemaWithMinItems = schema;
|
|
3002
|
-
if (typeof schemaWithMinItems.minItems === 'number') {
|
|
3003
|
-
return (React.createElement(mosaic.Box, { className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: boxStyle }, `>=${schemaWithMinItems.minItems} items`));
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
|
-
if ('enum' in schema && Array.isArray(schema.enum)) {
|
|
3007
|
-
return (React.createElement("div", null,
|
|
3008
|
-
"Allowed values:",
|
|
3009
|
-
' ',
|
|
3010
|
-
schema.enum.map((val, idx) => (React.createElement(mosaic.Box, { key: idx, className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: boxStyle }, val)))));
|
|
3011
|
-
}
|
|
3012
|
-
return null;
|
|
3013
|
-
};
|
|
3014
|
-
const isRequired = parentRequired && propertyKey && parentRequired.includes(propertyKey);
|
|
3015
|
-
let showRequiredLabel = false;
|
|
3016
|
-
const hideDataEntry = hideData.find(hideEntry => trimSlashes(hideEntry.path) === trimSlashes(path));
|
|
3017
|
-
if ((hideDataEntry === null || hideDataEntry === void 0 ? void 0 : hideDataEntry.required) === true || ((hideDataEntry === null || hideDataEntry === void 0 ? void 0 : hideDataEntry.required) === undefined && isRequired)) {
|
|
3018
|
-
showRequiredLabel = true;
|
|
3019
|
-
}
|
|
3020
|
-
if (schema === null || schema === void 0 ? void 0 : schema.$ref) {
|
|
3021
|
-
schema = dereference(schema, root);
|
|
3022
|
-
}
|
|
3023
|
-
return (React.createElement("div", { className: "mb-1" },
|
|
3024
|
-
React.createElement(mosaic.Flex, { maxW: "full", pl: 3, py: 2, "data-test": "schema-row", pos: "relative" },
|
|
3025
|
-
React.createElement(mosaic.VStack, { spacing: 1, maxW: "full", className: "w-full" },
|
|
3026
|
-
React.createElement(mosaic.Flex, { onClick: !isRoot ? handleToggle : undefined, className: `w-full ${isRoot ? '' : 'cursor-pointer'}` },
|
|
3027
|
-
!isRoot ? (React.createElement(mosaic.Box, { mr: 2, className: "sl-font-mono sl-font-semibold sl-mr-2" },
|
|
3028
|
-
!TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
|
|
3029
|
-
!detectCircularPath(path) &&
|
|
3030
|
-
!((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular) &&
|
|
3031
|
-
!(schema === null || schema === void 0 ? void 0 : schema.circular) ? (React.createElement("i", { role: "img", "aria-hidden": "true", className: `sl-icon fal ${expanded ? 'fa-chevron-down' : 'fa-chevron-right'} fa-fw fa-sm` })) : (React.createElement("span", { className: "sl-icon fal fa-fw fa-sm", "aria-hidden": "true" })),
|
|
3032
|
-
' ' + displayTitle)) : null,
|
|
3033
|
-
!isRoot ? (React.createElement(mosaic.Box, { mr: 2, pos: "relative" },
|
|
3034
|
-
React.createElement(mosaic.Box, { display: "inline-flex", alignItems: "center", onMouseEnter: () => {
|
|
3035
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) {
|
|
3036
|
-
setIsHoveringSelector(true);
|
|
3037
|
-
}
|
|
3038
|
-
}, onMouseLeave: () => {
|
|
3039
|
-
if (!showSchemaDropdown) {
|
|
3040
|
-
setIsHoveringSelector(false);
|
|
3041
|
-
}
|
|
3042
|
-
}, onClick: (e) => {
|
|
3043
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) {
|
|
3044
|
-
e.stopPropagation();
|
|
3045
|
-
setShowSchemaDropdown(prev => !prev);
|
|
3046
|
-
}
|
|
3047
|
-
}, style: {
|
|
3048
|
-
cursor: (schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf) ? 'pointer' : 'default',
|
|
3049
|
-
} },
|
|
3050
|
-
React.createElement("span", { className: "sl-truncate sl-text-muted" },
|
|
3051
|
-
(() => {
|
|
3052
|
-
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);
|
|
3053
|
-
if ((schema === null || schema === void 0 ? void 0 : schema.anyOf) && (schema === null || schema === void 0 ? void 0 : schema.anyOf.length) > 0) {
|
|
3054
|
-
return `any of ${typeDisplay}`;
|
|
3055
|
-
}
|
|
3056
|
-
else if ((schema === null || schema === void 0 ? void 0 : schema.oneOf) && (schema === null || schema === void 0 ? void 0 : schema.oneOf.length) > 0) {
|
|
3057
|
-
return `one of ${typeDisplay}`;
|
|
3058
|
-
}
|
|
3059
|
-
return typeDisplay;
|
|
3060
|
-
})(),
|
|
3061
|
-
(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),
|
|
3062
|
-
((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) && (React.createElement(mosaic.Box, { display: "inline-flex", alignItems: "center", ml: 1, style: {
|
|
3063
|
-
opacity: isHoveringSelector ? 1 : 0.6,
|
|
3064
|
-
transition: 'opacity 0.2s',
|
|
3065
|
-
} },
|
|
3066
|
-
React.createElement("i", { className: "sl-icon fas fa-chevron-down", style: {
|
|
3067
|
-
fontSize: '10px',
|
|
3068
|
-
opacity: 0.6,
|
|
3069
|
-
} })))),
|
|
3070
|
-
React.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),
|
|
3071
|
-
((schema === null || schema === void 0 ? void 0 : schema.anyOf) || (schema === null || schema === void 0 ? void 0 : schema.oneOf)) && showSchemaDropdown && combinedSchemaSelector())) : null),
|
|
3072
|
-
React.createElement(mosaic.Flex, { pl: 1, w: "full", align: "start", direction: "col", style: { overflow: 'visible', paddingLeft: '20px' } },
|
|
3073
|
-
(schema === null || schema === void 0 ? void 0 : schema.description) && (React.createElement(mosaic.Box, { fontFamily: "ui", fontWeight: "light" },
|
|
3074
|
-
React.createElement("span", { className: "sl-prose sl-markdown-viewer", style: { fontSize: '12px' } }, schema === null || schema === void 0 ? void 0 : schema.description))),
|
|
3075
|
-
!isRoot && (schema === null || schema === void 0 ? void 0 : schema.examples) !== undefined && (React.createElement(mosaic.Flex, { align: "center", mb: 1, style: { flexWrap: 'wrap' } },
|
|
3076
|
-
React.createElement("span", { className: "text-gray-500", style: { marginRight: 8, flexShrink: 0 } }, "Example"),
|
|
3077
|
-
React.createElement(mosaic.Box, { className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: {
|
|
3078
|
-
background: 'rgba(245, 247, 250, 0.5)',
|
|
3079
|
-
border: '1px solid #a0aec0',
|
|
3080
|
-
borderRadius: '4px',
|
|
3081
|
-
padding: '4px 8px',
|
|
3082
|
-
display: 'inline-block',
|
|
3083
|
-
overflowWrap: 'break-word',
|
|
3084
|
-
textAlign: 'left',
|
|
3085
|
-
maxWidth: '530px',
|
|
3086
|
-
} }, JSON.stringify(schema === null || schema === void 0 ? void 0 : schema.examples))))),
|
|
3087
|
-
React.createElement(mosaic.Flex, { pl: 1, w: "full", align: "start", direction: "col", style: { overflow: 'visible', paddingLeft: '20px' } }, schema &&
|
|
3088
|
-
typeof schema === 'object' &&
|
|
3089
|
-
('minItems' in schema || 'enum' in schema) &&
|
|
3090
|
-
renderMinEnums(schema))),
|
|
3091
|
-
!isRoot && (React.createElement("label", { className: "inline-flex items-top ml-2" },
|
|
3092
|
-
React.createElement(mosaic.Box, { mr: 2, fontFamily: "ui", fontWeight: "normal" }, showRequiredLabel && (React.createElement("div", { className: "sl-ml-2 sl-text-warning" },
|
|
3093
|
-
React.createElement("span", { style: { marginLeft: '10px' } }, "required"))))))),
|
|
3094
|
-
renderChildren()));
|
|
3095
|
-
};
|
|
3096
|
-
|
|
3097
2759
|
const isBodyEmpty = (body) => {
|
|
3098
2760
|
if (!body)
|
|
3099
2761
|
return true;
|
|
3100
2762
|
const { contents = [], description } = body;
|
|
3101
2763
|
return contents.length === 0 && !(description === null || description === void 0 ? void 0 : description.trim());
|
|
3102
2764
|
};
|
|
3103
|
-
const Body = ({ body, onChange, isHttpWebhookOperation = false
|
|
2765
|
+
const Body = ({ body, onChange, isHttpWebhookOperation = false }) => {
|
|
3104
2766
|
var _a;
|
|
3105
2767
|
const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
|
|
3106
2768
|
const [chosenContent, setChosenContent] = React__namespace.useState(0);
|
|
@@ -3113,29 +2775,13 @@ const Body = ({ body, onChange, isHttpWebhookOperation = false, disableProps })
|
|
|
3113
2775
|
const { contents = [], description } = body;
|
|
3114
2776
|
const schema = (_a = contents[chosenContent]) === null || _a === void 0 ? void 0 : _a.schema;
|
|
3115
2777
|
const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId: body.id, attr: 'description' });
|
|
3116
|
-
const getMaskProperties = () => {
|
|
3117
|
-
const disablePropsConfig = disableProps || [];
|
|
3118
|
-
const absolutePathsToHide = [];
|
|
3119
|
-
disablePropsConfig.forEach(configEntry => {
|
|
3120
|
-
const { location, paths } = configEntry;
|
|
3121
|
-
paths.forEach((item) => {
|
|
3122
|
-
const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
|
|
3123
|
-
let object = { path: fullPath };
|
|
3124
|
-
if (item.hasOwnProperty('required')) {
|
|
3125
|
-
object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
|
|
3126
|
-
}
|
|
3127
|
-
absolutePathsToHide.push(object);
|
|
3128
|
-
});
|
|
3129
|
-
});
|
|
3130
|
-
return absolutePathsToHide;
|
|
3131
|
-
};
|
|
3132
2778
|
return (React__namespace.createElement(mosaic.VStack, { spacing: 6 },
|
|
3133
2779
|
React__namespace.createElement(SectionSubtitle, { title: "Body", id: "request-body" }, contents.length > 0 && (React__namespace.createElement(mosaic.Flex, { flex: 1, justify: "end" },
|
|
3134
2780
|
React__namespace.createElement(mosaic.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" })))),
|
|
3135
2781
|
description && (React__namespace.createElement(mosaic.Box, { pos: "relative" },
|
|
3136
2782
|
React__namespace.createElement(MarkdownViewer, { markdown: description }),
|
|
3137
2783
|
React__namespace.createElement(mosaic.NodeAnnotation, { change: descriptionChanged }))),
|
|
3138
|
-
|
|
2784
|
+
isJSONSchema(schema) && (React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: refResolver, maxRefDepth: maxRefDepth, schema: getOriginalObject(schema), viewMode: isHttpWebhookOperation ? 'standalone' : 'write', renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }))));
|
|
3139
2785
|
};
|
|
3140
2786
|
Body.displayName = 'HttpOperation.Body';
|
|
3141
2787
|
|
|
@@ -3202,7 +2848,7 @@ const httpOperationParamsToSchema = ({ parameters, parameterType }) => {
|
|
|
3202
2848
|
return schema;
|
|
3203
2849
|
};
|
|
3204
2850
|
|
|
3205
|
-
const Request = ({ operation: { request, request: { path: pathParams = [], headers: headerParams = [], cookie: cookieParams = [], body, query: queryParams = [], } = {}, security, }, hideSecurityInfo, onChange, isHttpWebhookOperation = false,
|
|
2851
|
+
const Request = ({ operation: { request, request: { path: pathParams = [], headers: headerParams = [], cookie: cookieParams = [], body, query: queryParams = [], } = {}, security, }, hideSecurityInfo, onChange, isHttpWebhookOperation = false, }) => {
|
|
3206
2852
|
if (!request || typeof request !== 'object')
|
|
3207
2853
|
return null;
|
|
3208
2854
|
const bodyIsEmpty = isBodyEmpty(body);
|
|
@@ -3230,7 +2876,7 @@ const Request = ({ operation: { request, request: { path: pathParams = [], heade
|
|
|
3230
2876
|
cookieParams.length > 0 && (React__namespace.createElement(mosaic.VStack, { spacing: 5 },
|
|
3231
2877
|
React__namespace.createElement(SectionSubtitle, { title: "Cookies", id: "request-cookies" }),
|
|
3232
2878
|
React__namespace.createElement(Parameters, { parameterType: "cookie", parameters: cookieParams }))),
|
|
3233
|
-
body &&
|
|
2879
|
+
body && React__namespace.createElement(Body, { onChange: onChange, body: body, isHttpWebhookOperation: isHttpWebhookOperation })));
|
|
3234
2880
|
};
|
|
3235
2881
|
Request.displayName = 'HttpOperation.Request';
|
|
3236
2882
|
const schemeExpandedState = utils.atomWithStorage('HttpOperation_security_expanded', {});
|
|
@@ -3261,7 +2907,7 @@ const OptionalMessage$1 = () => {
|
|
|
3261
2907
|
return React__namespace.createElement(mosaic.Callout, { appearance: "outline" }, OptionalSecurityMessage);
|
|
3262
2908
|
};
|
|
3263
2909
|
|
|
3264
|
-
const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTypeChange, isCompact,
|
|
2910
|
+
const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTypeChange, isCompact, }) => {
|
|
3265
2911
|
var _a, _b;
|
|
3266
2912
|
const responses = sortBy(uniqBy(unsortedResponses, r => r.code), r => r.code);
|
|
3267
2913
|
const [activeResponseId, setActiveResponseId] = React__namespace.useState((_b = (_a = responses[0]) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : '');
|
|
@@ -3294,11 +2940,11 @@ const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTy
|
|
|
3294
2940
|
const tabResponses = (React__namespace.createElement(mosaic.TabList, { density: "compact" }, responses.map(({ code }) => (React__namespace.createElement(mosaic.Tab, { key: code, id: code, intent: codeToIntentVal(code) }, code)))));
|
|
3295
2941
|
return (React__namespace.createElement(mosaic.VStack, { spacing: 8, as: mosaic.Tabs, selectedId: activeResponseId, onChange: setActiveResponseId, appearance: "pill" },
|
|
3296
2942
|
React__namespace.createElement(SectionTitle, { title: "Responses", isCompact: isCompact }, isCompact ? compactResponses : tabResponses),
|
|
3297
|
-
isCompact ? (React__namespace.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange
|
|
3298
|
-
React__namespace.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange
|
|
2943
|
+
isCompact ? (React__namespace.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange })) : (React__namespace.createElement(mosaic.TabPanels, { p: 0 }, responses.map(response => (React__namespace.createElement(mosaic.TabPanel, { key: response.code, id: response.code },
|
|
2944
|
+
React__namespace.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange }))))))));
|
|
3299
2945
|
};
|
|
3300
2946
|
Responses.displayName = 'HttpOperation.Responses';
|
|
3301
|
-
const Response = ({ response, onMediaTypeChange
|
|
2947
|
+
const Response = ({ response, onMediaTypeChange }) => {
|
|
3302
2948
|
const { contents = [], headers = [], description } = response;
|
|
3303
2949
|
const [chosenContent, setChosenContent] = React__namespace.useState(0);
|
|
3304
2950
|
const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
|
|
@@ -3309,23 +2955,6 @@ const Response = ({ response, onMediaTypeChange, disableProps, statusCode }) =>
|
|
|
3309
2955
|
responseContent && (onMediaTypeChange === null || onMediaTypeChange === void 0 ? void 0 : onMediaTypeChange(responseContent.mediaType));
|
|
3310
2956
|
}, [responseContent]);
|
|
3311
2957
|
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 }) => {
|
|
3318
|
-
paths.forEach((item) => {
|
|
3319
|
-
const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
|
|
3320
|
-
let object = { path: fullPath };
|
|
3321
|
-
if (item.hasOwnProperty('required')) {
|
|
3322
|
-
object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
|
|
3323
|
-
}
|
|
3324
|
-
absolutePathsToHide.push(object);
|
|
3325
|
-
});
|
|
3326
|
-
});
|
|
3327
|
-
return absolutePathsToHide;
|
|
3328
|
-
};
|
|
3329
2958
|
return (React__namespace.createElement(mosaic.VStack, { spacing: 8, pt: 8 },
|
|
3330
2959
|
description && (React__namespace.createElement(mosaic.Box, { pos: "relative" },
|
|
3331
2960
|
React__namespace.createElement(MarkdownViewer, { markdown: description }),
|
|
@@ -3337,7 +2966,7 @@ const Response = ({ response, onMediaTypeChange, disableProps, statusCode }) =>
|
|
|
3337
2966
|
React__namespace.createElement(SectionSubtitle, { title: "Body", id: "response-body" },
|
|
3338
2967
|
React__namespace.createElement(mosaic.Flex, { flex: 1, justify: "end" },
|
|
3339
2968
|
React__namespace.createElement(mosaic.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" }))),
|
|
3340
|
-
schema &&
|
|
2969
|
+
schema && (React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { schema: getOriginalObject(schema), resolveRef: refResolver, maxRefDepth: maxRefDepth, viewMode: "read", parentCrumbs: ['responses', response.code], renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }))))));
|
|
3341
2970
|
};
|
|
3342
2971
|
Response.displayName = 'HttpOperation.Response';
|
|
3343
2972
|
const codeToIntentVal = (code) => {
|
|
@@ -3383,7 +3012,7 @@ const Callback = ({ data, isCompact }) => {
|
|
|
3383
3012
|
};
|
|
3384
3013
|
Callbacks.displayName = 'HttpOperation.Callback';
|
|
3385
3014
|
|
|
3386
|
-
const HttpOperationComponent = React__namespace.memo(({ className, data: unresolvedData, layoutOptions, tryItCredentialsPolicy, tryItCorsProxy
|
|
3015
|
+
const HttpOperationComponent = React__namespace.memo(({ className, data: unresolvedData, layoutOptions, tryItCredentialsPolicy, tryItCorsProxy }) => {
|
|
3387
3016
|
var _a;
|
|
3388
3017
|
const { nodeHasChanged } = useOptionsCtx();
|
|
3389
3018
|
const data = useResolvedObject(unresolvedData);
|
|
@@ -3414,8 +3043,8 @@ const HttpOperationComponent = React__namespace.memo(({ className, data: unresol
|
|
|
3414
3043
|
React__namespace.createElement(MarkdownViewer, { className: "HttpOperation__Description", markdown: data.description }),
|
|
3415
3044
|
React__namespace.createElement(mosaic.NodeAnnotation, { change: descriptionChanged }))),
|
|
3416
3045
|
React__namespace.createElement(NodeVendorExtensions, { data: data }),
|
|
3417
|
-
React__namespace.createElement(Request, { onChange: setTextRequestBodyIndex, operation: data, hideSecurityInfo: layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideSecurityInfo, isHttpWebhookOperation: isHttpWebhookOperation(data)
|
|
3418
|
-
data.responses && (React__namespace.createElement(Responses, { responses: data.responses, onMediaTypeChange: setResponseMediaType, onStatusCodeChange: setResponseStatusCode, isCompact: isCompact
|
|
3046
|
+
React__namespace.createElement(Request, { onChange: setTextRequestBodyIndex, operation: data, hideSecurityInfo: layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideSecurityInfo, isHttpWebhookOperation: isHttpWebhookOperation(data) }),
|
|
3047
|
+
data.responses && (React__namespace.createElement(Responses, { responses: data.responses, onMediaTypeChange: setResponseMediaType, onStatusCodeChange: setResponseStatusCode, isCompact: isCompact })),
|
|
3419
3048
|
((_a = data.callbacks) === null || _a === void 0 ? void 0 : _a.length) ? React__namespace.createElement(Callbacks, { callbacks: data.callbacks, isCompact: isCompact }) : null,
|
|
3420
3049
|
isCompact && tryItPanel));
|
|
3421
3050
|
return (React__namespace.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('HttpOperation', className), header: header, left: description, right: !isCompact && tryItPanel }));
|
|
@@ -3653,9 +3282,7 @@ const HttpServiceComponent = React__namespace.memo(({ data: unresolvedData, loca
|
|
|
3653
3282
|
React__namespace.createElement(mosaic.Box, { pos: "relative" },
|
|
3654
3283
|
React__namespace.createElement(mosaic.Heading, { size: 1, mb: 4, fontWeight: "semibold" }, data.name),
|
|
3655
3284
|
React__namespace.createElement(mosaic.NodeAnnotation, { change: nameChanged })),
|
|
3656
|
-
|
|
3657
|
-
? null
|
|
3658
|
-
: exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React__namespace.createElement(ExportButton, Object.assign({}, exportProps)))),
|
|
3285
|
+
exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React__namespace.createElement(ExportButton, Object.assign({}, exportProps)))),
|
|
3659
3286
|
data.version && (React__namespace.createElement(mosaic.Box, { mb: 5, pos: "relative" },
|
|
3660
3287
|
React__namespace.createElement(VersionBadge, { value: data.version }),
|
|
3661
3288
|
React__namespace.createElement(mosaic.NodeAnnotation, { change: versionChanged }))),
|
|
@@ -3671,7 +3298,7 @@ const HttpServiceComponent = React__namespace.memo(({ data: unresolvedData, loca
|
|
|
3671
3298
|
HttpServiceComponent.displayName = 'HttpService.Component';
|
|
3672
3299
|
const HttpService = reactErrorBoundary.withErrorBoundary(HttpServiceComponent, { recoverableProps: ['data'] });
|
|
3673
3300
|
|
|
3674
|
-
const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps,
|
|
3301
|
+
const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps, }) => {
|
|
3675
3302
|
var _a, _b;
|
|
3676
3303
|
const [resolveRef, maxRefDepth] = useSchemaInlineRefResolver();
|
|
3677
3304
|
const data = useResolvedObject(unresolvedData);
|
|
@@ -3691,36 +3318,16 @@ const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOpti
|
|
|
3691
3318
|
isDeprecated && React__namespace.createElement(DeprecatedBadge, null),
|
|
3692
3319
|
isInternal && React__namespace.createElement(InternalBadge, null))),
|
|
3693
3320
|
React__namespace.createElement(mosaic.NodeAnnotation, { change: titleChanged })),
|
|
3694
|
-
|
|
3695
|
-
? null
|
|
3696
|
-
: exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React__namespace.createElement(ExportButton, Object.assign({}, exportProps))));
|
|
3321
|
+
exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React__namespace.createElement(ExportButton, Object.assign({}, exportProps))));
|
|
3697
3322
|
const modelExamples = !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideModelExamples) && React__namespace.createElement(ModelExamples, { data: data, isCollapsible: isCompact });
|
|
3698
3323
|
const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId, attr: 'description' });
|
|
3699
|
-
const getMaskProperties = () => {
|
|
3700
|
-
const disablePropsConfig = disableProps === null || disableProps === void 0 ? void 0 : disableProps.models;
|
|
3701
|
-
const absolutePathsToHide = [];
|
|
3702
|
-
if (disableProps === null || disableProps === void 0 ? void 0 : disableProps.models) {
|
|
3703
|
-
disablePropsConfig.forEach((configEntry) => {
|
|
3704
|
-
const { location, paths } = configEntry;
|
|
3705
|
-
paths.forEach((item) => {
|
|
3706
|
-
const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
|
|
3707
|
-
let object = { path: fullPath };
|
|
3708
|
-
if (item.hasOwnProperty('required')) {
|
|
3709
|
-
object = Object.assign(Object.assign({}, object), { required: item === null || item === void 0 ? void 0 : item.required });
|
|
3710
|
-
}
|
|
3711
|
-
absolutePathsToHide.push(object);
|
|
3712
|
-
});
|
|
3713
|
-
});
|
|
3714
|
-
}
|
|
3715
|
-
return absolutePathsToHide;
|
|
3716
|
-
};
|
|
3717
3324
|
const description = (React__namespace.createElement(mosaic.VStack, { spacing: 10 },
|
|
3718
3325
|
data.description && data.type === 'object' && (React__namespace.createElement(mosaic.Box, { pos: "relative" },
|
|
3719
3326
|
React__namespace.createElement(MarkdownViewer, { role: "textbox", markdown: data.description }),
|
|
3720
3327
|
React__namespace.createElement(mosaic.NodeAnnotation, { change: descriptionChanged }))),
|
|
3721
3328
|
React__namespace.createElement(NodeVendorExtensions, { data: data }),
|
|
3722
|
-
|
|
3723
|
-
|
|
3329
|
+
isCompact && modelExamples,
|
|
3330
|
+
React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon, skipTopLevelDescription: true })));
|
|
3724
3331
|
return (React__namespace.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('Model', className), header: header, left: description, right: !isCompact && modelExamples }));
|
|
3725
3332
|
};
|
|
3726
3333
|
const ModelExamples = React__namespace.memo(({ data, isCollapsible = false }) => {
|
|
@@ -3743,30 +3350,30 @@ const Model = reactErrorBoundary.withErrorBoundary(ModelComponent, { recoverable
|
|
|
3743
3350
|
|
|
3744
3351
|
const Docs = React__namespace.memo((_a) => {
|
|
3745
3352
|
var _b;
|
|
3746
|
-
var { nodeType, nodeData,
|
|
3353
|
+
var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, maxRefDepth, nodeHasChanged, renderExtensionAddon } = _a, commonProps = tslib.__rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "maxRefDepth", "nodeHasChanged", "renderExtensionAddon"]);
|
|
3747
3354
|
const parsedNode = useParsedData(nodeType, nodeData);
|
|
3748
3355
|
if (!parsedNode) {
|
|
3749
3356
|
(_b = commonProps.nodeUnsupported) === null || _b === void 0 ? void 0 : _b.call(commonProps, 'dataEmpty');
|
|
3750
3357
|
return null;
|
|
3751
3358
|
}
|
|
3752
|
-
let elem = React__namespace.createElement(ParsedDocs, Object.assign({ node: parsedNode
|
|
3359
|
+
let elem = React__namespace.createElement(ParsedDocs, Object.assign({ node: parsedNode }, commonProps));
|
|
3753
3360
|
if (useNodeForRefResolving) {
|
|
3754
3361
|
elem = (React__namespace.createElement(InlineRefResolverProvider, { document: parsedNode.data, resolver: refResolver, maxRefDepth: maxRefDepth }, elem));
|
|
3755
3362
|
}
|
|
3756
3363
|
return (React__namespace.createElement(ElementsOptionsProvider, { nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }, elem));
|
|
3757
3364
|
});
|
|
3758
3365
|
const ParsedDocs = (_a) => {
|
|
3759
|
-
var { node, nodeUnsupported
|
|
3366
|
+
var { node, nodeUnsupported } = _a, commonProps = tslib.__rest(_a, ["node", "nodeUnsupported"]);
|
|
3760
3367
|
switch (node.type) {
|
|
3761
3368
|
case 'article':
|
|
3762
3369
|
return React__namespace.createElement(Article, Object.assign({ data: node.data }, commonProps));
|
|
3763
3370
|
case 'http_operation':
|
|
3764
3371
|
case 'http_webhook':
|
|
3765
|
-
return React__namespace.createElement(HttpOperation, Object.assign({ data: node.data
|
|
3372
|
+
return React__namespace.createElement(HttpOperation, Object.assign({ data: node.data }, commonProps));
|
|
3766
3373
|
case 'http_service':
|
|
3767
3374
|
return React__namespace.createElement(HttpService, Object.assign({ data: node.data }, commonProps));
|
|
3768
3375
|
case 'model':
|
|
3769
|
-
return React__namespace.createElement(Model, Object.assign({ data: node.data
|
|
3376
|
+
return React__namespace.createElement(Model, Object.assign({ data: node.data }, commonProps));
|
|
3770
3377
|
default:
|
|
3771
3378
|
nodeUnsupported === null || nodeUnsupported === void 0 ? void 0 : nodeUnsupported('invalidType');
|
|
3772
3379
|
return null;
|