docusaurus-theme-openapi-docs 4.3.0 → 4.3.2

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.
Files changed (77) hide show
  1. package/lib/index.js +1 -1
  2. package/lib/markdown/createDescription.js +1 -2
  3. package/lib/markdown/schema.js +2 -3
  4. package/lib/markdown/utils.d.ts +2 -2
  5. package/lib/markdown/utils.js +4 -5
  6. package/lib/theme/ApiExplorer/Accept/slice.d.ts +1 -1
  7. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +1 -1
  8. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +0 -1
  9. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +1 -1
  10. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +0 -1
  11. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +1 -1
  12. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +23 -11
  13. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +1 -1
  14. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +23 -11
  15. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +1 -1
  16. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +1 -1
  17. package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +23 -11
  18. package/lib/theme/ApiExplorer/Authorization/auth-types.js +1 -2
  19. package/lib/theme/ApiExplorer/Authorization/slice.d.ts +3 -3
  20. package/lib/theme/ApiExplorer/Authorization/slice.js +2 -6
  21. package/lib/theme/ApiExplorer/Body/slice.d.ts +1 -1
  22. package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +2 -2
  23. package/lib/theme/ApiExplorer/CodeSnippets/index.js +64 -56
  24. package/lib/theme/ApiExplorer/CodeSnippets/languages.js +4 -8
  25. package/lib/theme/ApiExplorer/CodeTabs/index.js +29 -13
  26. package/lib/theme/ApiExplorer/ContentType/slice.d.ts +1 -1
  27. package/lib/theme/ApiExplorer/FormFileUpload/index.js +22 -10
  28. package/lib/theme/ApiExplorer/LiveEditor/index.d.ts +1 -1
  29. package/lib/theme/ApiExplorer/LiveEditor/index.js +27 -13
  30. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +23 -11
  31. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +1 -1
  32. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +1 -1
  33. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +1 -1
  34. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.js +1 -1
  35. package/lib/theme/ApiExplorer/ParamOptions/index.js +22 -10
  36. package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +1 -1
  37. package/lib/theme/ApiExplorer/Request/index.js +22 -10
  38. package/lib/theme/ApiExplorer/Response/slice.d.ts +1 -1
  39. package/lib/theme/ApiExplorer/Server/index.js +22 -10
  40. package/lib/theme/ApiExplorer/Server/slice.d.ts +1 -1
  41. package/lib/theme/ApiExplorer/buildPostmanRequest.js +1 -1
  42. package/lib/theme/ApiExplorer/persistanceMiddleware.js +1 -2
  43. package/lib/theme/ApiExplorer/storage-utils.js +2 -3
  44. package/lib/theme/ApiItem/Layout/index.d.ts +1 -1
  45. package/lib/theme/ApiItem/Layout/index.js +1 -1
  46. package/lib/theme/ApiItem/hooks.d.ts +1 -1
  47. package/lib/theme/ApiItem/index.d.ts +0 -2
  48. package/lib/theme/ApiItem/index.js +1 -1
  49. package/lib/theme/ApiItem/store.d.ts +5 -5
  50. package/lib/theme/ApiLogo/index.js +1 -1
  51. package/lib/theme/ApiTabs/index.js +26 -12
  52. package/lib/theme/DiscriminatorTabs/index.js +26 -12
  53. package/lib/theme/MimeTabs/index.js +26 -12
  54. package/lib/theme/OperationTabs/index.js +26 -12
  55. package/lib/theme/ParamsDetails/index.js +4 -53
  56. package/lib/theme/RequestSchema/index.js +4 -53
  57. package/lib/theme/ResponseExamples/index.js +1 -2
  58. package/lib/theme/ResponseSchema/index.js +4 -53
  59. package/lib/theme/SchemaItem/index.js +4 -2
  60. package/lib/theme/SchemaTabs/index.js +26 -12
  61. package/package.json +5 -5
  62. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +46 -48
  63. package/src/theme/ApiExplorer/CodeTabs/index.tsx +6 -2
  64. package/src/theme/ApiExplorer/LiveEditor/index.tsx +6 -4
  65. package/src/theme/ApiExplorer/buildPostmanRequest.ts +1 -1
  66. package/src/theme/ApiItem/Layout/index.tsx +1 -1
  67. package/src/theme/ApiItem/index.tsx +1 -1
  68. package/src/theme/ApiTabs/index.tsx +3 -1
  69. package/src/theme/DiscriminatorTabs/index.tsx +3 -1
  70. package/src/theme/MimeTabs/index.tsx +3 -1
  71. package/src/theme/OperationTabs/index.tsx +3 -1
  72. package/src/theme/ParamsDetails/index.tsx +2 -9
  73. package/src/theme/RequestSchema/index.tsx +2 -9
  74. package/src/theme/ResponseSchema/index.tsx +2 -9
  75. package/src/theme/SchemaItem/index.tsx +3 -1
  76. package/src/theme/SchemaTabs/index.tsx +3 -1
  77. package/tsconfig.tsbuildinfo +1 -0
package/lib/index.js CHANGED
@@ -9,6 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.default = docusaurusThemeOpenAPI;
12
13
  const path_1 = __importDefault(require("path"));
13
14
  const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
14
15
  function docusaurusThemeOpenAPI() {
@@ -59,4 +60,3 @@ function docusaurusThemeOpenAPI() {
59
60
  },
60
61
  };
61
62
  }
62
- exports.default = docusaurusThemeOpenAPI;
@@ -6,11 +6,10 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.createDescription = void 0;
9
+ exports.createDescription = createDescription;
10
10
  function createDescription(description) {
11
11
  if (!description) {
12
12
  return "";
13
13
  }
14
14
  return `\n\n${description}\n\n`;
15
15
  }
16
- exports.createDescription = createDescription;
@@ -6,7 +6,8 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getQualifierMessage = exports.getSchemaName = void 0;
9
+ exports.getSchemaName = getSchemaName;
10
+ exports.getQualifierMessage = getQualifierMessage;
10
11
  function prettyName(schema, circular) {
11
12
  if (schema.format) {
12
13
  return schema.format;
@@ -42,7 +43,6 @@ function getSchemaName(schema, circular) {
42
43
  }
43
44
  return prettyName(schema, circular) ?? "";
44
45
  }
45
- exports.getSchemaName = getSchemaName;
46
46
  function getQualifierMessage(schema) {
47
47
  // TODO:
48
48
  // - uniqueItems
@@ -147,4 +147,3 @@ function getQualifierMessage(schema) {
147
147
  }
148
148
  return message + qualifierGroups.join(", ");
149
149
  }
150
- exports.getQualifierMessage = getQualifierMessage;
@@ -5,6 +5,6 @@ export type Props = Record<string, any> & {
5
5
  children?: ReactNode;
6
6
  };
7
7
  export declare function create(tag: string, props: Props): string;
8
- export declare function guard<T>(value: T | undefined | string, cb: (value: T) => ReactNode): string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>;
9
- export declare function render(children: ReactNode): string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>;
8
+ export declare function guard<T>(value: T | undefined | string, cb: (value: T) => ReactNode): string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined>;
9
+ export declare function render(children: ReactNode): string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined>;
10
10
  export declare function toString(value: any): string | undefined;
@@ -6,7 +6,10 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.toString = exports.render = exports.guard = exports.create = void 0;
9
+ exports.create = create;
10
+ exports.guard = guard;
11
+ exports.render = render;
12
+ exports.toString = toString;
10
13
  function create(tag, props) {
11
14
  const { children, ...rest } = props;
12
15
  let propString = "";
@@ -15,7 +18,6 @@ function create(tag, props) {
15
18
  }
16
19
  return `<${tag}${propString}>${render(children)}</${tag}>`;
17
20
  }
18
- exports.create = create;
19
21
  function guard(value, cb) {
20
22
  if (!!value || value === 0) {
21
23
  const children = cb(value);
@@ -23,14 +25,12 @@ function guard(value, cb) {
23
25
  }
24
26
  return "";
25
27
  }
26
- exports.guard = guard;
27
28
  function render(children) {
28
29
  if (Array.isArray(children)) {
29
30
  return children.filter((c) => c !== undefined).join("");
30
31
  }
31
32
  return children ?? "";
32
33
  }
33
- exports.render = render;
34
34
  function toString(value) {
35
35
  // Return as-is if already string
36
36
  if (typeof value === "string") {
@@ -47,4 +47,3 @@ function toString(value) {
47
47
  // Coerce to string in all other cases,
48
48
  return value + "";
49
49
  }
50
- exports.toString = toString;
@@ -7,5 +7,5 @@ export declare const slice: import("@reduxjs/toolkit").Slice<State, {
7
7
  setAccept: (state: import("immer/dist/internal").WritableDraft<State>, action: PayloadAction<string>) => void;
8
8
  }, "accept">;
9
9
  export declare const setAccept: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "accept/setAccept">;
10
- declare const _default: import("redux").Reducer<State, import("redux").AnyAction>;
10
+ declare const _default: import("redux").Reducer<State>;
11
11
  export default _default;
@@ -11,6 +11,7 @@ var __importDefault =
11
11
  return mod && mod.__esModule ? mod : { default: mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.default = CodeBlockContainer;
14
15
  const react_1 = __importDefault(require("react"));
15
16
  const theme_common_1 = require("@docusaurus/theme-common");
16
17
  const internal_1 = require("@docusaurus/theme-common/internal");
@@ -32,4 +33,3 @@ function CodeBlockContainer({ as: As, ...props }) {
32
33
  }
33
34
  );
34
35
  }
35
- exports.default = CodeBlockContainer;
@@ -1,4 +1,3 @@
1
- /// <reference types="@docusaurus/theme-classic" />
2
1
  import React from "react";
3
2
  import type { Props } from "@theme/CodeBlock/Content/Element";
4
3
  export default function CodeBlockJSX({ children, className, }: Props): React.JSX.Element;
@@ -11,6 +11,7 @@ var __importDefault =
11
11
  return mod && mod.__esModule ? mod : { default: mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.default = CodeBlockJSX;
14
15
  const react_1 = __importDefault(require("react"));
15
16
  const Container_1 = __importDefault(
16
17
  require("@theme/ApiExplorer/ApiCodeBlock/Container")
@@ -38,4 +39,3 @@ function CodeBlockJSX({ children, className }) {
38
39
  )
39
40
  );
40
41
  }
41
- exports.default = CodeBlockJSX;
@@ -1,4 +1,3 @@
1
- /// <reference types="@docusaurus/theme-classic" />
2
1
  import React from "react";
3
2
  import type { Props } from "@theme/CodeBlock/Content/String";
4
3
  export default function CodeBlockString({ children, className: blockClassName, metastring, title: titleProp, showLineNumbers: showLineNumbersProp, language: languageProp, }: Props): React.JSX.Element;
@@ -11,6 +11,7 @@ var __importDefault =
11
11
  return mod && mod.__esModule ? mod : { default: mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.default = CodeBlockString;
14
15
  const react_1 = __importDefault(require("react"));
15
16
  const theme_common_1 = require("@docusaurus/theme-common");
16
17
  const internal_1 = require("@docusaurus/theme-common/internal");
@@ -150,4 +151,3 @@ function CodeBlockString({
150
151
  )
151
152
  );
152
153
  }
153
- exports.default = CodeBlockString;
@@ -39,22 +39,35 @@ var __setModuleDefault =
39
39
  });
40
40
  var __importStar =
41
41
  (this && this.__importStar) ||
42
- function (mod) {
43
- if (mod && mod.__esModule) return mod;
44
- var result = {};
45
- if (mod != null)
46
- for (var k in mod)
47
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
48
- __createBinding(result, mod, k);
49
- __setModuleDefault(result, mod);
50
- return result;
51
- };
42
+ (function () {
43
+ var ownKeys = function (o) {
44
+ ownKeys =
45
+ Object.getOwnPropertyNames ||
46
+ function (o) {
47
+ var ar = [];
48
+ for (var k in o)
49
+ if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
50
+ return ar;
51
+ };
52
+ return ownKeys(o);
53
+ };
54
+ return function (mod) {
55
+ if (mod && mod.__esModule) return mod;
56
+ var result = {};
57
+ if (mod != null)
58
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
59
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
60
+ __setModuleDefault(result, mod);
61
+ return result;
62
+ };
63
+ })();
52
64
  var __importDefault =
53
65
  (this && this.__importDefault) ||
54
66
  function (mod) {
55
67
  return mod && mod.__esModule ? mod : { default: mod };
56
68
  };
57
69
  Object.defineProperty(exports, "__esModule", { value: true });
70
+ exports.default = CopyButton;
58
71
  const react_1 = __importStar(require("react"));
59
72
  const Translate_1 = require("@docusaurus/Translate");
60
73
  const clsx_1 = __importDefault(require("clsx"));
@@ -132,4 +145,3 @@ function CopyButton({ code, className }) {
132
145
  )
133
146
  );
134
147
  }
135
- exports.default = CopyButton;
@@ -11,6 +11,7 @@ var __importDefault =
11
11
  return mod && mod.__esModule ? mod : { default: mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.default = ExitButton;
14
15
  const react_1 = __importDefault(require("react"));
15
16
  const Translate_1 = require("@docusaurus/Translate");
16
17
  const clsx_1 = __importDefault(require("clsx"));
@@ -55,4 +56,3 @@ function ExitButton({ className, handler }) {
55
56
  )
56
57
  );
57
58
  }
58
- exports.default = ExitButton;
@@ -39,22 +39,35 @@ var __setModuleDefault =
39
39
  });
40
40
  var __importStar =
41
41
  (this && this.__importStar) ||
42
- function (mod) {
43
- if (mod && mod.__esModule) return mod;
44
- var result = {};
45
- if (mod != null)
46
- for (var k in mod)
47
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
48
- __createBinding(result, mod, k);
49
- __setModuleDefault(result, mod);
50
- return result;
51
- };
42
+ (function () {
43
+ var ownKeys = function (o) {
44
+ ownKeys =
45
+ Object.getOwnPropertyNames ||
46
+ function (o) {
47
+ var ar = [];
48
+ for (var k in o)
49
+ if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
50
+ return ar;
51
+ };
52
+ return ownKeys(o);
53
+ };
54
+ return function (mod) {
55
+ if (mod && mod.__esModule) return mod;
56
+ var result = {};
57
+ if (mod != null)
58
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
59
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
60
+ __setModuleDefault(result, mod);
61
+ return result;
62
+ };
63
+ })();
52
64
  var __importDefault =
53
65
  (this && this.__importDefault) ||
54
66
  function (mod) {
55
67
  return mod && mod.__esModule ? mod : { default: mod };
56
68
  };
57
69
  Object.defineProperty(exports, "__esModule", { value: true });
70
+ exports.default = ExpandButton;
58
71
  const react_1 = __importStar(require("react"));
59
72
  const theme_common_1 = require("@docusaurus/theme-common");
60
73
  const Translate_1 = require("@docusaurus/Translate");
@@ -233,4 +246,3 @@ function ExpandButton({
233
246
  )
234
247
  );
235
248
  }
236
- exports.default = ExpandButton;
@@ -11,6 +11,7 @@ var __importDefault =
11
11
  return mod && mod.__esModule ? mod : { default: mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.default = CodeBlockLine;
14
15
  const react_1 = __importDefault(require("react"));
15
16
  const clsx_1 = __importDefault(require("clsx"));
16
17
  function CodeBlockLine({
@@ -56,4 +57,3 @@ function CodeBlockLine({
56
57
  react_1.default.createElement("br", null)
57
58
  );
58
59
  }
59
- exports.default = CodeBlockLine;
@@ -11,6 +11,7 @@ var __importDefault =
11
11
  return mod && mod.__esModule ? mod : { default: mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.default = WordWrapButton;
14
15
  const react_1 = __importDefault(require("react"));
15
16
  const Translate_1 = require("@docusaurus/Translate");
16
17
  const clsx_1 = __importDefault(require("clsx"));
@@ -48,4 +49,3 @@ function WordWrapButton({ className, onClick, isEnabled }) {
48
49
  )
49
50
  );
50
51
  }
51
- exports.default = WordWrapButton;
@@ -39,22 +39,35 @@ var __setModuleDefault =
39
39
  });
40
40
  var __importStar =
41
41
  (this && this.__importStar) ||
42
- function (mod) {
43
- if (mod && mod.__esModule) return mod;
44
- var result = {};
45
- if (mod != null)
46
- for (var k in mod)
47
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
48
- __createBinding(result, mod, k);
49
- __setModuleDefault(result, mod);
50
- return result;
51
- };
42
+ (function () {
43
+ var ownKeys = function (o) {
44
+ ownKeys =
45
+ Object.getOwnPropertyNames ||
46
+ function (o) {
47
+ var ar = [];
48
+ for (var k in o)
49
+ if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
50
+ return ar;
51
+ };
52
+ return ownKeys(o);
53
+ };
54
+ return function (mod) {
55
+ if (mod && mod.__esModule) return mod;
56
+ var result = {};
57
+ if (mod != null)
58
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
59
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
60
+ __setModuleDefault(result, mod);
61
+ return result;
62
+ };
63
+ })();
52
64
  var __importDefault =
53
65
  (this && this.__importDefault) ||
54
66
  function (mod) {
55
67
  return mod && mod.__esModule ? mod : { default: mod };
56
68
  };
57
69
  Object.defineProperty(exports, "__esModule", { value: true });
70
+ exports.default = ApiCodeBlock;
58
71
  const react_1 = __importStar(require("react"));
59
72
  const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
60
73
  const Element_1 = __importDefault(
@@ -95,4 +108,3 @@ function ApiCodeBlock({ children: rawChildren, ...props }) {
95
108
  children
96
109
  );
97
110
  }
98
- exports.default = ApiCodeBlock;
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getAuthDataKeys = void 0;
9
+ exports.getAuthDataKeys = getAuthDataKeys;
10
10
  function getAuthDataKeys(security) {
11
11
  // Bearer Auth
12
12
  if (security.type === "http" && security.scheme === "bearer") {
@@ -26,4 +26,3 @@ function getAuthDataKeys(security) {
26
26
  // none
27
27
  return [];
28
28
  }
29
- exports.getAuthDataKeys = getAuthDataKeys;
@@ -1,7 +1,7 @@
1
1
  import { PayloadAction } from "@reduxjs/toolkit";
2
2
  import { SecurityRequirementObject, SecuritySchemeObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
3
3
  import { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types";
4
- export declare function createAuth({ security, securitySchemes, options, }: {
4
+ export declare function createAuth({ security, securitySchemes, options: opts, }: {
5
5
  security?: SecurityRequirementObject[];
6
6
  securitySchemes?: {
7
7
  [key: string]: SecuritySchemeObject;
@@ -34,7 +34,7 @@ export declare const slice: import("@reduxjs/toolkit").Slice<AuthState, {
34
34
  export declare const setAuthData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
35
35
  scheme: string;
36
36
  key: string;
37
- value?: string | undefined;
37
+ value?: string;
38
38
  }, "auth/setAuthData">, setSelectedAuth: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "auth/setSelectedAuth">;
39
- declare const _default: import("redux").Reducer<AuthState, import("redux").AnyAction>;
39
+ declare const _default: import("redux").Reducer<AuthState>;
40
40
  export default _default;
@@ -7,11 +7,8 @@
7
7
  * ========================================================================== */
8
8
  var _a;
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.setSelectedAuth =
11
- exports.setAuthData =
12
- exports.slice =
13
- exports.createAuth =
14
- void 0;
10
+ exports.setSelectedAuth = exports.setAuthData = exports.slice = void 0;
11
+ exports.createAuth = createAuth;
15
12
  const toolkit_1 = require("@reduxjs/toolkit");
16
13
  const storage_utils_1 = require("@theme/ApiExplorer/storage-utils");
17
14
  const auth_types_1 = require("./auth-types");
@@ -85,7 +82,6 @@ function createAuth({ security, securitySchemes, options: opts }) {
85
82
  selected: persisted ?? Object.keys(options)[0],
86
83
  };
87
84
  }
88
- exports.createAuth = createAuth;
89
85
  const initialState = {};
90
86
  exports.slice = (0, toolkit_1.createSlice)({
91
87
  name: "auth",
@@ -78,5 +78,5 @@ export declare const clearRawBody: import("@reduxjs/toolkit").ActionCreatorWitho
78
78
  key: string;
79
79
  value: FileContent["value"];
80
80
  }, "body/setFileFormBody">;
81
- declare const _default: import("redux").Reducer<FormBody | RawBody | EmptyBody, import("redux").AnyAction>;
81
+ declare const _default: import("redux").Reducer<FormBody | RawBody | EmptyBody>;
82
82
  export default _default;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import { type JSX } from "react";
2
2
  import sdk from "postman-collection";
3
3
  import { CodeSample, Language } from "./code-snippets-types";
4
4
  export declare const languageSet: Language[];
@@ -6,5 +6,5 @@ export interface Props {
6
6
  postman: sdk.Request;
7
7
  codeSamples: CodeSample[];
8
8
  }
9
- declare function CodeSnippets({ postman, codeSamples }: Props): React.JSX.Element | null;
9
+ declare function CodeSnippets({ postman, codeSamples }: Props): JSX.Element | null;
10
10
  export default CodeSnippets;
@@ -39,16 +39,28 @@ var __setModuleDefault =
39
39
  });
40
40
  var __importStar =
41
41
  (this && this.__importStar) ||
42
- function (mod) {
43
- if (mod && mod.__esModule) return mod;
44
- var result = {};
45
- if (mod != null)
46
- for (var k in mod)
47
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
48
- __createBinding(result, mod, k);
49
- __setModuleDefault(result, mod);
50
- return result;
51
- };
42
+ (function () {
43
+ var ownKeys = function (o) {
44
+ ownKeys =
45
+ Object.getOwnPropertyNames ||
46
+ function (o) {
47
+ var ar = [];
48
+ for (var k in o)
49
+ if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
50
+ return ar;
51
+ };
52
+ return ownKeys(o);
53
+ };
54
+ return function (mod) {
55
+ if (mod && mod.__esModule) return mod;
56
+ var result = {};
57
+ if (mod != null)
58
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++)
59
+ if (k[i] !== "default") __createBinding(result, mod, k[i]);
60
+ __setModuleDefault(result, mod);
61
+ return result;
62
+ };
63
+ })();
52
64
  var __importDefault =
53
65
  (this && this.__importDefault) ||
54
66
  function (mod) {
@@ -56,12 +68,6 @@ var __importDefault =
56
68
  };
57
69
  Object.defineProperty(exports, "__esModule", { value: true });
58
70
  exports.languageSet = void 0;
59
- /* ============================================================================
60
- * Copyright (c) Palo Alto Networks
61
- *
62
- * This source code is licensed under the MIT license found in the
63
- * LICENSE file in the root directory of this source tree.
64
- * ========================================================================== */
65
71
  const react_1 = __importStar(require("react"));
66
72
  const useDocusaurusContext_1 = __importDefault(
67
73
  require("@docusaurus/useDocusaurusContext")
@@ -74,6 +80,7 @@ const buildPostmanRequest_1 = __importDefault(
74
80
  );
75
81
  const CodeTabs_1 = __importDefault(require("@theme/ApiExplorer/CodeTabs"));
76
82
  const hooks_1 = require("@theme/ApiItem/hooks");
83
+ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
77
84
  const postman_code_generators_1 = __importDefault(
78
85
  require("postman-code-generators")
79
86
  );
@@ -82,7 +89,7 @@ exports.languageSet = (0, languages_1.generateLanguageSet)();
82
89
  function CodeTab({ children, hidden, className }) {
83
90
  return react_1.default.createElement(
84
91
  "div",
85
- { role: "tabpanel", className: className, ...{ hidden } },
92
+ { role: "tabpanel", className: className, hidden },
86
93
  children
87
94
  );
88
95
  }
@@ -107,6 +114,40 @@ function CodeSnippets({ postman, codeSamples }) {
107
114
  (state) => state.params.header
108
115
  );
109
116
  const auth = (0, hooks_1.useTypedSelector)((state) => state.auth);
117
+ const clonedAuth = (0, cloneDeep_1.default)(auth);
118
+ let placeholder;
119
+ function cleanCredentials(obj) {
120
+ for (const key in obj) {
121
+ if (typeof obj[key] === "object" && obj[key] !== null) {
122
+ // use name as placeholder if exists
123
+ const comboAuthId = Object.keys(obj).join(" and ");
124
+ const authOptions =
125
+ clonedAuth?.options?.[key] ?? clonedAuth?.options?.[comboAuthId];
126
+ placeholder = authOptions?.[0]?.name;
127
+ obj[key] = cleanCredentials(obj[key]);
128
+ } else {
129
+ obj[key] = `<${placeholder ?? key}>`;
130
+ }
131
+ }
132
+ return obj;
133
+ }
134
+ // scrub credentials from code snippets
135
+ const cleanedAuth = {
136
+ ...clonedAuth,
137
+ data: cleanCredentials(clonedAuth.data),
138
+ };
139
+ // Create a Postman request object using cleanedAuth
140
+ const cleanedPostmanRequest = (0, buildPostmanRequest_1.default)(postman, {
141
+ queryParams,
142
+ pathParams,
143
+ cookieParams,
144
+ contentType,
145
+ accept,
146
+ headerParams,
147
+ body,
148
+ server,
149
+ auth: cleanedAuth,
150
+ });
110
151
  // User-defined languages array
111
152
  // Can override languageSet, change order of langs, override options and variants
112
153
  const userDefinedLanguageSet =
@@ -151,21 +192,10 @@ function CodeSnippets({ postman, codeSamples }) {
151
192
  );
152
193
  }
153
194
  if (language && !!language.options) {
154
- const postmanRequest = (0, buildPostmanRequest_1.default)(postman, {
155
- queryParams,
156
- pathParams,
157
- cookieParams,
158
- contentType,
159
- accept,
160
- headerParams,
161
- body,
162
- server,
163
- auth,
164
- });
165
195
  postman_code_generators_1.default.convert(
166
196
  language.language,
167
197
  language.variant,
168
- postmanRequest,
198
+ cleanedPostmanRequest,
169
199
  language.options,
170
200
  (error, snippet) => {
171
201
  if (error) {
@@ -182,21 +212,10 @@ function CodeSnippets({ postman, codeSamples }) {
182
212
  // This allows users to define only the minimal properties necessary in languageTabs
183
213
  // User-defined properties should override languageSet properties
184
214
  const mergedLanguage = { ...langSource[0], ...language };
185
- const postmanRequest = (0, buildPostmanRequest_1.default)(postman, {
186
- queryParams,
187
- pathParams,
188
- cookieParams,
189
- contentType,
190
- accept,
191
- headerParams,
192
- body,
193
- server,
194
- auth,
195
- });
196
215
  postman_code_generators_1.default.convert(
197
216
  mergedLanguage.language,
198
217
  mergedLanguage.variant,
199
- postmanRequest,
218
+ cleanedPostmanRequest,
200
219
  mergedLanguage.options,
201
220
  (error, snippet) => {
202
221
  if (error) {
@@ -219,27 +238,16 @@ function CodeSnippets({ postman, codeSamples }) {
219
238
  postman,
220
239
  queryParams,
221
240
  server,
222
- auth,
241
+ cleanedPostmanRequest,
223
242
  mergedLangs,
224
243
  ]);
225
- // no dependencies was intentionlly set for this particular hook. it's safe as long as if conditions are set
244
+ // no dependencies was intentionally set for this particular hook. it's safe as long as if conditions are set
226
245
  (0, react_1.useEffect)(function onSelectedVariantUpdate() {
227
246
  if (selectedVariant && selectedVariant !== language?.variant) {
228
- const postmanRequest = (0, buildPostmanRequest_1.default)(postman, {
229
- queryParams,
230
- pathParams,
231
- cookieParams,
232
- contentType,
233
- accept,
234
- headerParams,
235
- body,
236
- server,
237
- auth,
238
- });
239
247
  postman_code_generators_1.default.convert(
240
248
  language.language,
241
249
  selectedVariant,
242
- postmanRequest,
250
+ cleanedPostmanRequest,
243
251
  language.options,
244
252
  (error, snippet) => {
245
253
  if (error) {
@@ -250,7 +258,7 @@ function CodeSnippets({ postman, codeSamples }) {
250
258
  );
251
259
  }
252
260
  });
253
- // no dependencies was intentionlly set for this particular hook. it's safe as long as if conditions are set
261
+ // no dependencies was intentionally set for this particular hook. it's safe as long as if conditions are set
254
262
  // eslint-disable-next-line react-hooks/exhaustive-deps
255
263
  (0, react_1.useEffect)(function onSelectedSampleUpdate() {
256
264
  if (