@stoplight/elements-core 9.0.25-beta-0.4 → 9.0.26-beta-0.0

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.
@@ -1,5 +1,6 @@
1
1
  import { IMarkdownViewerProps } from '@stoplight/markdown-viewer';
2
+ import * as React from 'react';
2
3
  import { DocsComponentProps } from '..';
3
4
  declare type ArticleProps = DocsComponentProps<IMarkdownViewerProps['markdown']>;
4
- export declare const Article: import("react").FunctionComponent<ArticleProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
+ export declare const Article: React.FunctionComponent<ArticleProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
6
  export {};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IHttpOperationRequestBody } from '@stoplight/types';
2
3
  export interface BodyProps {
3
4
  body: IHttpOperationRequestBody;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IHttpCallbackOperation } from '@stoplight/types';
2
3
  import { ExtensionAddonRenderer } from '../Docs';
3
4
  export interface CallbacksProps {
@@ -1,7 +1,8 @@
1
1
  import { IHttpEndpointOperation } from '@stoplight/types';
2
+ import * as React from 'react';
2
3
  import { DocsComponentProps } from '..';
3
4
  export declare type HttpOperationProps = DocsComponentProps<IHttpEndpointOperation>;
4
- export declare const HttpOperation: import("react").FunctionComponent<HttpOperationProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
+ export declare const HttpOperation: React.FunctionComponent<HttpOperationProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
6
  export declare function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInternal, hideServerUrl, method, path, }: {
6
7
  id: string;
7
8
  noHeading?: boolean;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IHttpOperationResponse } from '@stoplight/types';
2
3
  interface ResponsesProps {
3
4
  responses: IHttpOperationResponse[];
@@ -1,4 +1,5 @@
1
1
  import { IHttpService } from '@stoplight/types';
2
+ import * as React from 'react';
2
3
  import { DocsComponentProps } from '..';
3
4
  export declare type HttpServiceProps = DocsComponentProps<Partial<IHttpService>>;
4
- export declare const HttpService: import("react").FunctionComponent<HttpServiceProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
+ export declare const HttpService: React.FunctionComponent<HttpServiceProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
@@ -1,4 +1,5 @@
1
1
  import { JSONSchema7 } from 'json-schema';
2
+ import * as React from 'react';
2
3
  import { DocsComponentProps } from '..';
3
4
  export declare type ModelProps = DocsComponentProps<JSONSchema7>;
4
- export declare const Model: import("react").FunctionComponent<ModelProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
+ export declare const Model: React.FunctionComponent<ModelProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const DocsSkeleton: ({ className, padding }: {
2
3
  className?: string | undefined;
3
4
  padding?: string | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ExtensionAddonRenderer } from './Docs';
2
3
  export declare const renderExtensionRenderer: ExtensionAddonRenderer;
3
4
  export declare const wrapOptionsContext: (story: any) => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { LogoProps } from '../../types';
2
3
  import type { TableOfContentsItem } from '../TableOfContents';
3
4
  export declare const MobileTopNav: ({ name, logo, tree, pathname, onTocClick, }: {
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const Loading: () => JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { LinkProps } from '@stoplight/mosaic';
2
3
  export declare const ReactRouterMarkdownLink: ({ title, to, href: _href, children, }: Omit<LinkProps<"a">, "target" | "rel"> & {
3
4
  to?: string | undefined;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { BundledBranchNode } from '../../../types';
3
- export declare const createResolvedImageComponent: (branchNode: BundledBranchNode) => React.NamedExoticComponent<import("react").ImgHTMLAttributes<HTMLImageElement> & import("@stoplight/markdown/ast-types/hast").ImageProperties>;
3
+ export declare const createResolvedImageComponent: (branchNode: BundledBranchNode) => React.NamedExoticComponent<React.ImgHTMLAttributes<HTMLImageElement> & import("@stoplight/markdown/ast-types/hast").ImageProperties>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IMarkdownViewerProps } from '@stoplight/markdown-viewer';
2
3
  export declare const MarkdownViewer: {
3
4
  (props: IMarkdownViewerProps): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IHttpEndpointOperation } from '@stoplight/types';
2
3
  export interface ResponseExamplesProps {
3
4
  httpOperation: IHttpEndpointOperation;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare type TableOfContentsProps = {
2
3
  tree: TableOfContentsItem[];
3
4
  activeId: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { IServer } from '@stoplight/types';
2
3
  export declare type ServersDropdownProps = {
3
4
  servers: IServer[];
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- export declare const PersistenceContextProvider: ({ initialValues, scope, children, }: import("react").PropsWithChildren<{
2
+ export declare const PersistenceContextProvider: ({ initialValues, scope, children, }: React.PropsWithChildren<{
3
3
  initialValues?: Iterable<readonly [import("jotai").Atom<unknown>, unknown]> | undefined;
4
4
  scope?: import("jotai/core/atom").Scope | undefined;
5
- }>) => import("react").FunctionComponentElement<import("react").ProviderProps<import("jotai/core/contexts").ScopeContainer>>;
5
+ }>) => React.FunctionComponentElement<React.ProviderProps<import("jotai/core/contexts").ScopeContainer>>;
6
6
  export declare function withPersistenceBoundary<T>(WrappedComponent: React.ComponentType<T>): React.FC<T>;
package/index.esm.js CHANGED
@@ -39,6 +39,7 @@ import map from 'lodash/map.js';
39
39
  import mapValues from 'lodash/mapValues.js';
40
40
  import pickBy from 'lodash/pickBy.js';
41
41
  import { CodeEditor } from '@stoplight/mosaic-code-editor';
42
+ import DOMPurify from 'dompurify';
42
43
  import compact from 'lodash/compact.js';
43
44
  import uniq from 'lodash/uniq.js';
44
45
  import orderBy from 'lodash/orderBy.js';
@@ -2161,14 +2162,15 @@ const getQueryParams = ({ httpOperation, parameterValues, }) => {
2161
2162
  function buildFetchRequest({ httpOperation, mediaTypeContent, bodyInput, parameterValues, serverVariableValues, mockData, auth, chosenServer, credentials = 'omit', corsProxy, }) {
2162
2163
  var _a, _b, _c;
2163
2164
  return __awaiter(this, void 0, void 0, function* () {
2165
+ const sanitizedParameterValues = Object.fromEntries(Object.entries(parameterValues).map(([key, value]) => [key, DOMPurify.sanitize(value)]));
2164
2166
  const serverUrl = getServerUrl({ httpOperation, mockData, chosenServer, corsProxy, serverVariableValues });
2165
2167
  const shouldIncludeBody = ['PUT', 'POST', 'PATCH', 'DELETE'].includes(httpOperation.method.toUpperCase()) && bodyInput !== undefined;
2166
- const queryParams = getQueryParams({ httpOperation, parameterValues });
2168
+ const queryParams = getQueryParams({ httpOperation, parameterValues: sanitizedParameterValues });
2167
2169
  const rawHeaders = filterOutAuthorizationParams((_b = (_a = httpOperation.request) === null || _a === void 0 ? void 0 : _a.headers) !== null && _b !== void 0 ? _b : [], httpOperation.security)
2168
- .map(header => { var _a; return ({ name: header.name, value: (_a = parameterValues[header.name]) !== null && _a !== void 0 ? _a : '' }); })
2170
+ .map(header => { var _a; return ({ name: header.name, value: (_a = sanitizedParameterValues[header.name]) !== null && _a !== void 0 ? _a : '' }); })
2169
2171
  .filter(({ value }) => value.length > 0);
2170
2172
  const [queryParamsWithAuth, headersWithAuth] = runAuthRequestEhancements(auth, queryParams, rawHeaders);
2171
- const expandedPath = uriExpand(httpOperation.path, parameterValues);
2173
+ const expandedPath = uriExpand(httpOperation.path, sanitizedParameterValues);
2172
2174
  const urlObject = new URL(serverUrl + expandedPath);
2173
2175
  urlObject.search = new URLSearchParams(queryParamsWithAuth.map(nameAndValueObjectToPair)).toString();
2174
2176
  const body = typeof bodyInput === 'object' && !(bodyInput instanceof File)
package/index.js CHANGED
@@ -39,6 +39,7 @@ var map = require('lodash/map.js');
39
39
  var mapValues = require('lodash/mapValues.js');
40
40
  var pickBy = require('lodash/pickBy.js');
41
41
  var mosaicCodeEditor = require('@stoplight/mosaic-code-editor');
42
+ var DOMPurify = require('dompurify');
42
43
  var compact = require('lodash/compact.js');
43
44
  var uniq = require('lodash/uniq.js');
44
45
  var orderBy = require('lodash/orderBy.js');
@@ -2182,14 +2183,15 @@ const getQueryParams = ({ httpOperation, parameterValues, }) => {
2182
2183
  function buildFetchRequest({ httpOperation, mediaTypeContent, bodyInput, parameterValues, serverVariableValues, mockData, auth, chosenServer, credentials = 'omit', corsProxy, }) {
2183
2184
  var _a, _b, _c;
2184
2185
  return tslib.__awaiter(this, void 0, void 0, function* () {
2186
+ const sanitizedParameterValues = Object.fromEntries(Object.entries(parameterValues).map(([key, value]) => [key, DOMPurify.sanitize(value)]));
2185
2187
  const serverUrl = getServerUrl({ httpOperation, mockData, chosenServer, corsProxy, serverVariableValues });
2186
2188
  const shouldIncludeBody = ['PUT', 'POST', 'PATCH', 'DELETE'].includes(httpOperation.method.toUpperCase()) && bodyInput !== undefined;
2187
- const queryParams = getQueryParams({ httpOperation, parameterValues });
2189
+ const queryParams = getQueryParams({ httpOperation, parameterValues: sanitizedParameterValues });
2188
2190
  const rawHeaders = filterOutAuthorizationParams((_b = (_a = httpOperation.request) === null || _a === void 0 ? void 0 : _a.headers) !== null && _b !== void 0 ? _b : [], httpOperation.security)
2189
- .map(header => { var _a; return ({ name: header.name, value: (_a = parameterValues[header.name]) !== null && _a !== void 0 ? _a : '' }); })
2191
+ .map(header => { var _a; return ({ name: header.name, value: (_a = sanitizedParameterValues[header.name]) !== null && _a !== void 0 ? _a : '' }); })
2190
2192
  .filter(({ value }) => value.length > 0);
2191
2193
  const [queryParamsWithAuth, headersWithAuth] = runAuthRequestEhancements(auth, queryParams, rawHeaders);
2192
- const expandedPath = uriExpand(httpOperation.path, parameterValues);
2194
+ const expandedPath = uriExpand(httpOperation.path, sanitizedParameterValues);
2193
2195
  const urlObject = new URL(serverUrl + expandedPath);
2194
2196
  urlObject.search = new URLSearchParams(queryParamsWithAuth.map(nameAndValueObjectToPair)).toString();
2195
2197
  const body = typeof bodyInput === 'object' && !(bodyInput instanceof File)
package/index.mjs CHANGED
@@ -39,6 +39,7 @@ import map from 'lodash/map.js';
39
39
  import mapValues from 'lodash/mapValues.js';
40
40
  import pickBy from 'lodash/pickBy.js';
41
41
  import { CodeEditor } from '@stoplight/mosaic-code-editor';
42
+ import DOMPurify from 'dompurify';
42
43
  import compact from 'lodash/compact.js';
43
44
  import uniq from 'lodash/uniq.js';
44
45
  import orderBy from 'lodash/orderBy.js';
@@ -2161,14 +2162,15 @@ const getQueryParams = ({ httpOperation, parameterValues, }) => {
2161
2162
  function buildFetchRequest({ httpOperation, mediaTypeContent, bodyInput, parameterValues, serverVariableValues, mockData, auth, chosenServer, credentials = 'omit', corsProxy, }) {
2162
2163
  var _a, _b, _c;
2163
2164
  return __awaiter(this, void 0, void 0, function* () {
2165
+ const sanitizedParameterValues = Object.fromEntries(Object.entries(parameterValues).map(([key, value]) => [key, DOMPurify.sanitize(value)]));
2164
2166
  const serverUrl = getServerUrl({ httpOperation, mockData, chosenServer, corsProxy, serverVariableValues });
2165
2167
  const shouldIncludeBody = ['PUT', 'POST', 'PATCH', 'DELETE'].includes(httpOperation.method.toUpperCase()) && bodyInput !== undefined;
2166
- const queryParams = getQueryParams({ httpOperation, parameterValues });
2168
+ const queryParams = getQueryParams({ httpOperation, parameterValues: sanitizedParameterValues });
2167
2169
  const rawHeaders = filterOutAuthorizationParams((_b = (_a = httpOperation.request) === null || _a === void 0 ? void 0 : _a.headers) !== null && _b !== void 0 ? _b : [], httpOperation.security)
2168
- .map(header => { var _a; return ({ name: header.name, value: (_a = parameterValues[header.name]) !== null && _a !== void 0 ? _a : '' }); })
2170
+ .map(header => { var _a; return ({ name: header.name, value: (_a = sanitizedParameterValues[header.name]) !== null && _a !== void 0 ? _a : '' }); })
2169
2171
  .filter(({ value }) => value.length > 0);
2170
2172
  const [queryParamsWithAuth, headersWithAuth] = runAuthRequestEhancements(auth, queryParams, rawHeaders);
2171
- const expandedPath = uriExpand(httpOperation.path, parameterValues);
2173
+ const expandedPath = uriExpand(httpOperation.path, sanitizedParameterValues);
2172
2174
  const urlObject = new URL(serverUrl + expandedPath);
2173
2175
  urlObject.search = new URLSearchParams(queryParamsWithAuth.map(nameAndValueObjectToPair)).toString();
2174
2176
  const body = typeof bodyInput === 'object' && !(bodyInput instanceof File)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-core",
3
- "version": "9.0.25-beta-0.4",
3
+ "version": "9.0.26-beta-0.0",
4
4
  "main": "./index.js",
5
5
  "sideEffects": [
6
6
  "web-components.min.js",
@@ -40,6 +40,7 @@
40
40
  "@stoplight/types": "^14.1.1",
41
41
  "@stoplight/yaml": "^4.3.0",
42
42
  "classnames": "^2.2.6",
43
+ "dompurify": "^3.4.15",
43
44
  "httpsnippet-lite": "^3.0.5",
44
45
  "jotai": "1.3.9",
45
46
  "json-schema": "^0.4.0",