@stoplight/elements-core 9.0.2 → 9.0.4

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/index.js CHANGED
@@ -136,6 +136,8 @@ const isResolvedObjectProxy = (someObject) => {
136
136
  return !!someObject[originalObjectSymbol];
137
137
  };
138
138
  const getOriginalObject = (resolvedObject) => {
139
+ if (!resolvedObject)
140
+ return resolvedObject;
139
141
  const originalObject = resolvedObject[originalObjectSymbol] || resolvedObject;
140
142
  if (!originalObject) {
141
143
  return resolvedObject;
@@ -2756,13 +2758,214 @@ const PanelContent = ({ schemes }) => {
2756
2758
  })));
2757
2759
  };
2758
2760
 
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
+ refPath = refPath.replace('__bundled__', 'definitions');
2786
+ if (visited.has(node))
2787
+ return { circular: true, $ref: refPath, title: node.title, type: 'any', description: node.description };
2788
+ visited.add(node);
2789
+ const target = resolvePointer(root, refPath);
2790
+ if (!target)
2791
+ return node;
2792
+ const result = Object.assign({}, target);
2793
+ if ('description' in node)
2794
+ result.description = node.description;
2795
+ if ('title' in node)
2796
+ result.title = node.title;
2797
+ return dereference(result, root, visited, depth + 1, maxDepth);
2798
+ }
2799
+ if (Array.isArray(node)) {
2800
+ return node.map(item => dereference(item, root, visited, depth + 1, maxDepth));
2801
+ }
2802
+ const result = {};
2803
+ for (const key in node) {
2804
+ result[key] = dereference(node[key], root, visited, depth + 1, maxDepth);
2805
+ }
2806
+ return result;
2807
+ }
2808
+ const trimSlashes = (str) => {
2809
+ return str.replace(/^\/|\/$/g, '');
2810
+ };
2811
+ const LazySchemaTreePreviewer = ({ schema, root = schema, title, level = 1, path = '', hideData = [], parentRequired, propertyKey, subType, }) => {
2812
+ var _a, _b, _c, _d;
2813
+ const [expanded, setExpanded] = React.useState(false);
2814
+ const isRoot = level === 1 && (title === undefined || path === '');
2815
+ React.useState(() => {
2816
+ const disabledPaths = hideData || [];
2817
+ const initialState = {};
2818
+ if (disabledPaths) {
2819
+ for (const p of disabledPaths) {
2820
+ const { path } = p;
2821
+ initialState[path] = { checked: false, required: 0 };
2822
+ }
2823
+ }
2824
+ return initialState;
2825
+ });
2826
+ const shouldHideNode = React.useMemo(() => {
2827
+ const currentPath = trimSlashes(path);
2828
+ const data = hideData.some(hideEntry => {
2829
+ const hideEntryPath = trimSlashes(hideEntry.path);
2830
+ return hideEntryPath === currentPath;
2831
+ });
2832
+ return data;
2833
+ }, [path, hideData]);
2834
+ if (!schema || shouldHideNode) {
2835
+ return null;
2836
+ }
2837
+ 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';
2838
+ const handleToggle = () => {
2839
+ const circular = detectCircularPath(path);
2840
+ if (!circular) {
2841
+ setExpanded(prev => !prev);
2842
+ }
2843
+ };
2844
+ const renderChildren = () => {
2845
+ var _a, _b, _c, _d;
2846
+ if (!expanded && !isRoot)
2847
+ return null;
2848
+ const children = [];
2849
+ if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'object' && (schema === null || schema === void 0 ? void 0 : schema.properties)) {
2850
+ for (const [key, child] of Object.entries(schema === null || schema === void 0 ? void 0 : schema.properties)) {
2851
+ const childPath = `${path}/properties/${key}`;
2852
+ const shouldHideChild = hideData.some(hideEntry => trimSlashes(hideEntry.path) === trimSlashes(childPath));
2853
+ const resolved = dereference(child, root);
2854
+ if (!shouldHideChild) {
2855
+ children.push(React.createElement("li", { key: key },
2856
+ 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 })));
2857
+ }
2858
+ }
2859
+ }
2860
+ else if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array' &&
2861
+ (schema === null || schema === void 0 ? void 0 : schema.items) &&
2862
+ Object.keys(schema === null || schema === void 0 ? void 0 : schema.items).length > 0 &&
2863
+ !((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular)) {
2864
+ const resolvedItems = dereference(schema === null || schema === void 0 ? void 0 : schema.items, root);
2865
+ const itemsPath = `${path}/items`;
2866
+ if (resolvedItems && resolvedItems.type === 'object' && resolvedItems.properties) {
2867
+ for (const [key, child] of Object.entries(resolvedItems.properties)) {
2868
+ const childPath = `${itemsPath}/properties/${key}`;
2869
+ const shouldHideChild = hideData.some(hideEntry => trimSlashes(hideEntry.path) === trimSlashes(childPath));
2870
+ if (!shouldHideChild) {
2871
+ children.push(React.createElement("li", { key: key },
2872
+ 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 })));
2873
+ }
2874
+ }
2875
+ }
2876
+ else if (resolvedItems && resolvedItems.type === 'array' && resolvedItems.items.length > 0) {
2877
+ const childPath = `${path}/items`;
2878
+ const shouldHideChild = hideData.some(hideEntry => trimSlashes(hideEntry.path) === trimSlashes(childPath));
2879
+ if (!shouldHideChild) {
2880
+ children.push(React.createElement("li", { key: "items" },
2881
+ 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 })));
2882
+ }
2883
+ }
2884
+ }
2885
+ return children.length > 0 ? React.createElement("ul", { className: "ml-6 border-l border-gray-200 pl-2" }, children) : null;
2886
+ };
2887
+ const renderMinEnums = (schema) => {
2888
+ if (!schema || typeof schema !== 'object')
2889
+ return null;
2890
+ const boxStyle = {
2891
+ background: 'rgba(245, 247, 250, 0.5)',
2892
+ border: '1px solid #a0aec0',
2893
+ borderRadius: '4px',
2894
+ padding: '0px 2px',
2895
+ display: 'inline-block',
2896
+ overflowWrap: 'break-word',
2897
+ textAlign: 'left',
2898
+ maxWidth: 'fit-content',
2899
+ maxHeight: 'fit-content',
2900
+ };
2901
+ if ('minItems' in schema) {
2902
+ const schemaWithMinItems = schema;
2903
+ if (typeof schemaWithMinItems.minItems === 'number') {
2904
+ return (React.createElement(mosaic.Box, { className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: boxStyle }, `>=${schemaWithMinItems.minItems} items`));
2905
+ }
2906
+ }
2907
+ if ('enum' in schema && Array.isArray(schema.enum)) {
2908
+ return (React.createElement("div", null,
2909
+ "Allowed values:",
2910
+ ' ',
2911
+ schema.enum.map((val, idx) => (React.createElement(mosaic.Box, { key: idx, className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: boxStyle }, val)))));
2912
+ }
2913
+ return null;
2914
+ };
2915
+ const isRequired = parentRequired && propertyKey && parentRequired.includes(propertyKey);
2916
+ let showRequiredLabel = false;
2917
+ const hideDataEntry = hideData.find(hideEntry => trimSlashes(hideEntry.path) === trimSlashes(path));
2918
+ if ((hideDataEntry === null || hideDataEntry === void 0 ? void 0 : hideDataEntry.required) === true || ((hideDataEntry === null || hideDataEntry === void 0 ? void 0 : hideDataEntry.required) === undefined && isRequired)) {
2919
+ showRequiredLabel = true;
2920
+ }
2921
+ return (React.createElement("div", { className: "mb-1" },
2922
+ React.createElement(mosaic.Flex, { maxW: "full", pl: 3, py: 2, "data-test": "schema-row", pos: "relative" },
2923
+ React.createElement(mosaic.VStack, { spacing: 1, maxW: "full", className: "w-full" },
2924
+ React.createElement(mosaic.Flex, { onClick: !isRoot ? handleToggle : undefined, className: `w-full ${isRoot ? '' : 'cursor-pointer'}` },
2925
+ !isRoot ? (React.createElement(mosaic.Box, { mr: 2, className: "sl-font-mono sl-font-semibold sl-mr-2" },
2926
+ !TYPES.includes(schema === null || schema === void 0 ? void 0 : schema.type) &&
2927
+ !detectCircularPath(path) &&
2928
+ !((_b = schema === null || schema === void 0 ? void 0 : schema.items) === null || _b === void 0 ? void 0 : _b.circular) &&
2929
+ !(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" })),
2930
+ ' ' + displayTitle)) : null,
2931
+ !isRoot ? (React.createElement(mosaic.Box, { mr: 2 },
2932
+ React.createElement("span", { className: "sl-truncate sl-text-muted" },
2933
+ (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.type) || (root === null || root === void 0 ? void 0 : root.title),
2934
+ (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,
2935
+ subType ? `[${subType}]` : ''),
2936
+ 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))) : null),
2937
+ React.createElement(mosaic.Flex, { pl: 1, w: "full", align: "start", direction: "col", style: { overflow: 'visible', paddingLeft: '20px' } },
2938
+ (schema === null || schema === void 0 ? void 0 : schema.description) && (React.createElement(mosaic.Box, { fontFamily: "ui", fontWeight: "light" },
2939
+ React.createElement("span", { className: "sl-prose sl-markdown-viewer", style: { fontSize: '12px' } }, schema === null || schema === void 0 ? void 0 : schema.description))),
2940
+ !isRoot && (schema === null || schema === void 0 ? void 0 : schema.examples) !== undefined && (React.createElement(mosaic.Flex, { align: "center", mb: 1, style: { flexWrap: 'wrap' } },
2941
+ React.createElement("span", { className: "text-gray-500", style: { marginRight: 8, flexShrink: 0 } }, "Example"),
2942
+ React.createElement(mosaic.Box, { className: "sl-text-muted", fontFamily: "ui", fontWeight: "normal", mr: 2, style: {
2943
+ background: 'rgba(245, 247, 250, 0.5)',
2944
+ border: '1px solid #a0aec0',
2945
+ borderRadius: '4px',
2946
+ padding: '4px 8px',
2947
+ display: 'inline-block',
2948
+ overflowWrap: 'break-word',
2949
+ textAlign: 'left',
2950
+ maxWidth: '530px',
2951
+ } }, JSON.stringify(schema === null || schema === void 0 ? void 0 : schema.examples))))),
2952
+ React.createElement(mosaic.Flex, { pl: 1, w: "full", align: "start", direction: "col", style: { overflow: 'visible', paddingLeft: '20px' } }, schema &&
2953
+ typeof schema === 'object' &&
2954
+ ('minItems' in schema || 'enum' in schema) &&
2955
+ renderMinEnums(schema))),
2956
+ !isRoot && (React.createElement("label", { className: "inline-flex items-top ml-2" },
2957
+ React.createElement(mosaic.Box, { mr: 2, fontFamily: "ui", fontWeight: "normal" }, showRequiredLabel && (React.createElement("div", { className: "sl-ml-2 sl-text-warning" },
2958
+ React.createElement("span", { style: { marginLeft: '10px' } }, "required"))))))),
2959
+ renderChildren()));
2960
+ };
2961
+
2759
2962
  const isBodyEmpty = (body) => {
2760
2963
  if (!body)
2761
2964
  return true;
2762
2965
  const { contents = [], description } = body;
2763
2966
  return contents.length === 0 && !(description === null || description === void 0 ? void 0 : description.trim());
2764
2967
  };
2765
- const Body = ({ body, onChange, isHttpWebhookOperation = false }) => {
2968
+ const Body = ({ body, onChange, isHttpWebhookOperation = false, disableProps }) => {
2766
2969
  var _a;
2767
2970
  const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
2768
2971
  const [chosenContent, setChosenContent] = React__namespace.useState(0);
@@ -2775,13 +2978,25 @@ const Body = ({ body, onChange, isHttpWebhookOperation = false }) => {
2775
2978
  const { contents = [], description } = body;
2776
2979
  const schema = (_a = contents[chosenContent]) === null || _a === void 0 ? void 0 : _a.schema;
2777
2980
  const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId: body.id, attr: 'description' });
2981
+ const getMaskProperties = () => {
2982
+ const disablePropsConfig = disableProps || [];
2983
+ const absolutePathsToHide = [];
2984
+ disablePropsConfig.forEach(configEntry => {
2985
+ const { location, paths } = configEntry;
2986
+ paths.forEach(item => {
2987
+ const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
2988
+ absolutePathsToHide.push({ path: fullPath });
2989
+ });
2990
+ });
2991
+ return absolutePathsToHide;
2992
+ };
2778
2993
  return (React__namespace.createElement(mosaic.VStack, { spacing: 6 },
2779
2994
  React__namespace.createElement(SectionSubtitle, { title: "Body", id: "request-body" }, contents.length > 0 && (React__namespace.createElement(mosaic.Flex, { flex: 1, justify: "end" },
2780
2995
  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" })))),
2781
2996
  description && (React__namespace.createElement(mosaic.Box, { pos: "relative" },
2782
2997
  React__namespace.createElement(MarkdownViewer, { markdown: description }),
2783
2998
  React__namespace.createElement(mosaic.NodeAnnotation, { change: descriptionChanged }))),
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 }))));
2999
+ schema && localStorage.getItem('use_new_mask_workflow') === 'true' ? (React__namespace.createElement(LazySchemaTreePreviewer, { schema: schema, hideData: getMaskProperties() })) : (isJSONSchema(schema) && (React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: refResolver, maxRefDepth: maxRefDepth, schema: getOriginalObject(schema), viewMode: isHttpWebhookOperation ? 'standalone' : 'write', renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon })))));
2785
3000
  };
2786
3001
  Body.displayName = 'HttpOperation.Body';
2787
3002
 
@@ -2848,7 +3063,7 @@ const httpOperationParamsToSchema = ({ parameters, parameterType }) => {
2848
3063
  return schema;
2849
3064
  };
2850
3065
 
2851
- const Request = ({ operation: { request, request: { path: pathParams = [], headers: headerParams = [], cookie: cookieParams = [], body, query: queryParams = [], } = {}, security, }, hideSecurityInfo, onChange, isHttpWebhookOperation = false, }) => {
3066
+ const Request = ({ operation: { request, request: { path: pathParams = [], headers: headerParams = [], cookie: cookieParams = [], body, query: queryParams = [], } = {}, security, }, hideSecurityInfo, onChange, isHttpWebhookOperation = false, disableProps, }) => {
2852
3067
  if (!request || typeof request !== 'object')
2853
3068
  return null;
2854
3069
  const bodyIsEmpty = isBodyEmpty(body);
@@ -2876,7 +3091,7 @@ const Request = ({ operation: { request, request: { path: pathParams = [], heade
2876
3091
  cookieParams.length > 0 && (React__namespace.createElement(mosaic.VStack, { spacing: 5 },
2877
3092
  React__namespace.createElement(SectionSubtitle, { title: "Cookies", id: "request-cookies" }),
2878
3093
  React__namespace.createElement(Parameters, { parameterType: "cookie", parameters: cookieParams }))),
2879
- body && React__namespace.createElement(Body, { onChange: onChange, body: body, isHttpWebhookOperation: isHttpWebhookOperation })));
3094
+ body && (React__namespace.createElement(Body, { onChange: onChange, body: body, isHttpWebhookOperation: isHttpWebhookOperation, disableProps: disableProps }))));
2880
3095
  };
2881
3096
  Request.displayName = 'HttpOperation.Request';
2882
3097
  const schemeExpandedState = utils.atomWithStorage('HttpOperation_security_expanded', {});
@@ -2907,7 +3122,7 @@ const OptionalMessage$1 = () => {
2907
3122
  return React__namespace.createElement(mosaic.Callout, { appearance: "outline" }, OptionalSecurityMessage);
2908
3123
  };
2909
3124
 
2910
- const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTypeChange, isCompact, }) => {
3125
+ const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTypeChange, isCompact, disableProps, }) => {
2911
3126
  var _a, _b;
2912
3127
  const responses = sortBy(uniqBy(unsortedResponses, r => r.code), r => r.code);
2913
3128
  const [activeResponseId, setActiveResponseId] = React__namespace.useState((_b = (_a = responses[0]) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : '');
@@ -2940,11 +3155,11 @@ const Responses = ({ responses: unsortedResponses, onStatusCodeChange, onMediaTy
2940
3155
  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)))));
2941
3156
  return (React__namespace.createElement(mosaic.VStack, { spacing: 8, as: mosaic.Tabs, selectedId: activeResponseId, onChange: setActiveResponseId, appearance: "pill" },
2942
3157
  React__namespace.createElement(SectionTitle, { title: "Responses", isCompact: isCompact }, isCompact ? compactResponses : tabResponses),
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 }))))))));
3158
+ isCompact ? (React__namespace.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange, disableProps: disableProps, statusCode: activeResponseId })) : (React__namespace.createElement(mosaic.TabPanels, { p: 0 }, responses.map(response => (React__namespace.createElement(mosaic.TabPanel, { key: response.code, id: response.code },
3159
+ React__namespace.createElement(Response, { response: response, onMediaTypeChange: onMediaTypeChange, disableProps: disableProps, statusCode: response.code }))))))));
2945
3160
  };
2946
3161
  Responses.displayName = 'HttpOperation.Responses';
2947
- const Response = ({ response, onMediaTypeChange }) => {
3162
+ const Response = ({ response, onMediaTypeChange, disableProps, statusCode }) => {
2948
3163
  const { contents = [], headers = [], description } = response;
2949
3164
  const [chosenContent, setChosenContent] = React__namespace.useState(0);
2950
3165
  const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
@@ -2955,6 +3170,18 @@ const Response = ({ response, onMediaTypeChange }) => {
2955
3170
  responseContent && (onMediaTypeChange === null || onMediaTypeChange === void 0 ? void 0 : onMediaTypeChange(responseContent.mediaType));
2956
3171
  }, [responseContent]);
2957
3172
  const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId: response.id, attr: 'description' });
3173
+ const getMaskProperties = () => {
3174
+ if (!disableProps || !statusCode)
3175
+ return [];
3176
+ const configEntries = disableProps[statusCode] || [];
3177
+ const absolutePathsToHide = [];
3178
+ configEntries.forEach(({ location, paths }) => {
3179
+ paths.forEach(item => {
3180
+ absolutePathsToHide.push({ path: location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}` });
3181
+ });
3182
+ });
3183
+ return absolutePathsToHide;
3184
+ };
2958
3185
  return (React__namespace.createElement(mosaic.VStack, { spacing: 8, pt: 8 },
2959
3186
  description && (React__namespace.createElement(mosaic.Box, { pos: "relative" },
2960
3187
  React__namespace.createElement(MarkdownViewer, { markdown: description }),
@@ -2966,7 +3193,7 @@ const Response = ({ response, onMediaTypeChange }) => {
2966
3193
  React__namespace.createElement(SectionSubtitle, { title: "Body", id: "response-body" },
2967
3194
  React__namespace.createElement(mosaic.Flex, { flex: 1, justify: "end" },
2968
3195
  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" }))),
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 }))))));
3196
+ schema && localStorage.getItem('use_new_mask_workflow') === 'true' ? (React__namespace.createElement(LazySchemaTreePreviewer, { schema: schema, path: "", hideData: getMaskProperties() })) : (React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { schema: getOriginalObject(schema), resolveRef: refResolver, maxRefDepth: maxRefDepth, viewMode: "read", parentCrumbs: ['responses', response.code], renderRootTreeLines: true, nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }))))));
2970
3197
  };
2971
3198
  Response.displayName = 'HttpOperation.Response';
2972
3199
  const codeToIntentVal = (code) => {
@@ -3012,7 +3239,7 @@ const Callback = ({ data, isCompact }) => {
3012
3239
  };
3013
3240
  Callbacks.displayName = 'HttpOperation.Callback';
3014
3241
 
3015
- const HttpOperationComponent = React__namespace.memo(({ className, data: unresolvedData, layoutOptions, tryItCredentialsPolicy, tryItCorsProxy }) => {
3242
+ const HttpOperationComponent = React__namespace.memo(({ className, data: unresolvedData, layoutOptions, tryItCredentialsPolicy, tryItCorsProxy, disableProps }) => {
3016
3243
  var _a;
3017
3244
  const { nodeHasChanged } = useOptionsCtx();
3018
3245
  const data = useResolvedObject(unresolvedData);
@@ -3043,8 +3270,8 @@ const HttpOperationComponent = React__namespace.memo(({ className, data: unresol
3043
3270
  React__namespace.createElement(MarkdownViewer, { className: "HttpOperation__Description", markdown: data.description }),
3044
3271
  React__namespace.createElement(mosaic.NodeAnnotation, { change: descriptionChanged }))),
3045
3272
  React__namespace.createElement(NodeVendorExtensions, { data: data }),
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 })),
3273
+ React__namespace.createElement(Request, { onChange: setTextRequestBodyIndex, operation: data, hideSecurityInfo: layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideSecurityInfo, isHttpWebhookOperation: isHttpWebhookOperation(data), disableProps: disableProps === null || disableProps === void 0 ? void 0 : disableProps.request }),
3274
+ data.responses && (React__namespace.createElement(Responses, { responses: data.responses, onMediaTypeChange: setResponseMediaType, onStatusCodeChange: setResponseStatusCode, isCompact: isCompact, disableProps: disableProps === null || disableProps === void 0 ? void 0 : disableProps.response })),
3048
3275
  ((_a = data.callbacks) === null || _a === void 0 ? void 0 : _a.length) ? React__namespace.createElement(Callbacks, { callbacks: data.callbacks, isCompact: isCompact }) : null,
3049
3276
  isCompact && tryItPanel));
3050
3277
  return (React__namespace.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('HttpOperation', className), header: header, left: description, right: !isCompact && tryItPanel }));
@@ -3298,7 +3525,7 @@ const HttpServiceComponent = React__namespace.memo(({ data: unresolvedData, loca
3298
3525
  HttpServiceComponent.displayName = 'HttpService.Component';
3299
3526
  const HttpService = reactErrorBoundary.withErrorBoundary(HttpServiceComponent, { recoverableProps: ['data'] });
3300
3527
 
3301
- const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps, }) => {
3528
+ const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps, disableProps, }) => {
3302
3529
  var _a, _b;
3303
3530
  const [resolveRef, maxRefDepth] = useSchemaInlineRefResolver();
3304
3531
  const data = useResolvedObject(unresolvedData);
@@ -3321,13 +3548,27 @@ const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOpti
3321
3548
  exportProps && !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideExport) && !isCompact && React__namespace.createElement(ExportButton, Object.assign({}, exportProps))));
3322
3549
  const modelExamples = !(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.hideModelExamples) && React__namespace.createElement(ModelExamples, { data: data, isCollapsible: isCompact });
3323
3550
  const descriptionChanged = nodeHasChanged === null || nodeHasChanged === void 0 ? void 0 : nodeHasChanged({ nodeId, attr: 'description' });
3551
+ const getMaskProperties = () => {
3552
+ const disablePropsConfig = disableProps === null || disableProps === void 0 ? void 0 : disableProps.models;
3553
+ const absolutePathsToHide = [];
3554
+ if (disableProps === null || disableProps === void 0 ? void 0 : disableProps.models) {
3555
+ disablePropsConfig.forEach((configEntry) => {
3556
+ const { location, paths } = configEntry;
3557
+ paths.forEach((item) => {
3558
+ const fullPath = location === '#' ? item === null || item === void 0 ? void 0 : item.path : `${location}/${item.path}`;
3559
+ absolutePathsToHide.push({ path: fullPath });
3560
+ });
3561
+ });
3562
+ }
3563
+ return absolutePathsToHide;
3564
+ };
3324
3565
  const description = (React__namespace.createElement(mosaic.VStack, { spacing: 10 },
3325
3566
  data.description && data.type === 'object' && (React__namespace.createElement(mosaic.Box, { pos: "relative" },
3326
3567
  React__namespace.createElement(MarkdownViewer, { role: "textbox", markdown: data.description }),
3327
3568
  React__namespace.createElement(mosaic.NodeAnnotation, { change: descriptionChanged }))),
3328
3569
  React__namespace.createElement(NodeVendorExtensions, { data: data }),
3329
- isCompact && modelExamples,
3330
- React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon, skipTopLevelDescription: true })));
3570
+ localStorage.getItem('use_new_mask_workflow') !== 'true' && isCompact && modelExamples,
3571
+ data && localStorage.getItem('use_new_mask_workflow') === 'true' ? (React__namespace.createElement(LazySchemaTreePreviewer, { schema: data, hideData: getMaskProperties() })) : (React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon, skipTopLevelDescription: true }))));
3331
3572
  return (React__namespace.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('Model', className), header: header, left: description, right: !isCompact && modelExamples }));
3332
3573
  };
3333
3574
  const ModelExamples = React__namespace.memo(({ data, isCollapsible = false }) => {
@@ -3350,30 +3591,30 @@ const Model = reactErrorBoundary.withErrorBoundary(ModelComponent, { recoverable
3350
3591
 
3351
3592
  const Docs = React__namespace.memo((_a) => {
3352
3593
  var _b;
3353
- var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, maxRefDepth, nodeHasChanged, renderExtensionAddon } = _a, commonProps = tslib.__rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "maxRefDepth", "nodeHasChanged", "renderExtensionAddon"]);
3594
+ var { nodeType, nodeData, disableProps, useNodeForRefResolving = false, refResolver, maxRefDepth, nodeHasChanged, renderExtensionAddon } = _a, commonProps = tslib.__rest(_a, ["nodeType", "nodeData", "disableProps", "useNodeForRefResolving", "refResolver", "maxRefDepth", "nodeHasChanged", "renderExtensionAddon"]);
3354
3595
  const parsedNode = useParsedData(nodeType, nodeData);
3355
3596
  if (!parsedNode) {
3356
3597
  (_b = commonProps.nodeUnsupported) === null || _b === void 0 ? void 0 : _b.call(commonProps, 'dataEmpty');
3357
3598
  return null;
3358
3599
  }
3359
- let elem = React__namespace.createElement(ParsedDocs, Object.assign({ node: parsedNode }, commonProps));
3600
+ let elem = React__namespace.createElement(ParsedDocs, Object.assign({ node: parsedNode, disableProps: disableProps }, commonProps));
3360
3601
  if (useNodeForRefResolving) {
3361
3602
  elem = (React__namespace.createElement(InlineRefResolverProvider, { document: parsedNode.data, resolver: refResolver, maxRefDepth: maxRefDepth }, elem));
3362
3603
  }
3363
3604
  return (React__namespace.createElement(ElementsOptionsProvider, { nodeHasChanged: nodeHasChanged, renderExtensionAddon: renderExtensionAddon }, elem));
3364
3605
  });
3365
3606
  const ParsedDocs = (_a) => {
3366
- var { node, nodeUnsupported } = _a, commonProps = tslib.__rest(_a, ["node", "nodeUnsupported"]);
3607
+ var { node, nodeUnsupported, disableProps } = _a, commonProps = tslib.__rest(_a, ["node", "nodeUnsupported", "disableProps"]);
3367
3608
  switch (node.type) {
3368
3609
  case 'article':
3369
3610
  return React__namespace.createElement(Article, Object.assign({ data: node.data }, commonProps));
3370
3611
  case 'http_operation':
3371
3612
  case 'http_webhook':
3372
- return React__namespace.createElement(HttpOperation, Object.assign({ data: node.data }, commonProps));
3613
+ return React__namespace.createElement(HttpOperation, Object.assign({ data: node.data, disableProps: disableProps }, commonProps));
3373
3614
  case 'http_service':
3374
3615
  return React__namespace.createElement(HttpService, Object.assign({ data: node.data }, commonProps));
3375
3616
  case 'model':
3376
- return React__namespace.createElement(Model, Object.assign({ data: node.data }, commonProps));
3617
+ return React__namespace.createElement(Model, Object.assign({ data: node.data, disableProps: disableProps }, commonProps));
3377
3618
  default:
3378
3619
  nodeUnsupported === null || nodeUnsupported === void 0 ? void 0 : nodeUnsupported('invalidType');
3379
3620
  return null;