docusaurus-theme-openapi-docs 0.0.0-1016 → 0.0.0-1018

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.
@@ -116,7 +116,7 @@ function CodeBlockString({
116
116
  getLineProps: getLineProps,
117
117
  getTokenProps: getTokenProps,
118
118
  classNames: lineClassNames[i],
119
- showLineNumbers: showLineNumbers,
119
+ showLineNumbers: !!showLineNumbers,
120
120
  })
121
121
  )
122
122
  )
@@ -142,9 +142,9 @@ function CodeBlockString({
142
142
  ),
143
143
  code: code,
144
144
  language: language ?? "text",
145
- showLineNumbers: showLineNumbers,
145
+ showLineNumbers: !!showLineNumbers,
146
146
  blockClassName: blockClassName,
147
- title: title,
147
+ title: typeof title === "string" ? title : undefined,
148
148
  lineClassNames: lineClassNames,
149
149
  })
150
150
  )
@@ -1,3 +1,7 @@
1
1
  import React from "react";
2
- import { CopyButtonProps } from "@docusaurus/theme-common/internal";
2
+ interface CopyButtonProps {
3
+ code: string;
4
+ className?: string;
5
+ }
3
6
  export default function CopyButton({ code, className, }: CopyButtonProps): React.JSX.Element;
7
+ export {};
@@ -96,7 +96,7 @@ exports.slice = (0, toolkit_1.createSlice)({
96
96
  },
97
97
  },
98
98
  });
99
- (_a = exports.slice.actions),
99
+ ((_a = exports.slice.actions),
100
100
  (exports.setAuthData = _a.setAuthData),
101
- (exports.setSelectedAuth = _a.setSelectedAuth);
101
+ (exports.setSelectedAuth = _a.setSelectedAuth));
102
102
  exports.default = exports.slice.reducer;
@@ -87,11 +87,11 @@ exports.slice = (0, toolkit_1.createSlice)({
87
87
  },
88
88
  },
89
89
  });
90
- (_a = exports.slice.actions),
90
+ ((_a = exports.slice.actions),
91
91
  (exports.clearRawBody = _a.clearRawBody),
92
92
  (exports.setStringRawBody = _a.setStringRawBody),
93
93
  (exports.setFileRawBody = _a.setFileRawBody),
94
94
  (exports.clearFormBodyKey = _a.clearFormBodyKey),
95
95
  (exports.setStringFormBody = _a.setStringFormBody),
96
- (exports.setFileFormBody = _a.setFileFormBody);
96
+ (exports.setFileFormBody = _a.setFileFormBody));
97
97
  exports.default = exports.slice.reducer;
@@ -1,10 +1,10 @@
1
- import { type JSX } from "react";
2
- import sdk from "postman-collection";
1
+ import React from "react";
2
+ import * as sdk from "postman-collection";
3
3
  import { CodeSample, Language } from "./code-snippets-types";
4
4
  export declare const languageSet: Language[];
5
5
  export interface Props {
6
6
  postman: sdk.Request;
7
7
  codeSamples: CodeSample[];
8
8
  }
9
- declare function CodeSnippets({ postman, codeSamples }: Props): JSX.Element | null;
9
+ declare function CodeSnippets({ postman, codeSamples }: Props): React.JSX.Element | null;
10
10
  export default CodeSnippets;
@@ -87,11 +87,11 @@ const ParamOptions_1 = __importDefault(
87
87
  const slice_1 = require("@theme/ApiExplorer/Response/slice");
88
88
  const Server_1 = __importDefault(require("@theme/ApiExplorer/Server"));
89
89
  const hooks_1 = require("@theme/ApiItem/hooks");
90
- const postman_collection_1 = __importDefault(require("postman-collection"));
90
+ const sdk = __importStar(require("postman-collection"));
91
91
  const react_hook_form_1 = require("react-hook-form");
92
92
  const makeRequest_1 = __importDefault(require("./makeRequest"));
93
93
  function Request({ item }) {
94
- const postman = new postman_collection_1.default.Request(item.postman);
94
+ const postman = new sdk.Request(item.postman);
95
95
  const metadata = (0, client_1.useDoc)();
96
96
  const { proxy, hide_send_button: hideSendButton } = metadata.frontMatter;
97
97
  const pathParams = (0, hooks_1.useTypedSelector)(
@@ -1,4 +1,4 @@
1
1
  import { Body } from "@theme/ApiExplorer/Body/slice";
2
- import sdk from "postman-collection";
2
+ import * as sdk from "postman-collection";
3
3
  declare function makeRequest(request: sdk.Request, proxy: string | undefined, _body: Body): Promise<any>;
4
4
  export default makeRequest;
@@ -136,8 +136,9 @@ async function makeRequest(request, proxy, _body) {
136
136
  // The Content-Type header will be set automatically based on the type of body.
137
137
  myHeaders.delete("Content-Type");
138
138
  myBody = new FormData();
139
- if (Array.isArray(request.body.formdata.members)) {
140
- for (const data of request.body.formdata.members) {
139
+ const members = request.body?.formdata?.members;
140
+ if (Array.isArray(members)) {
141
+ for (const data of members) {
141
142
  if (data.key && data.value.content) {
142
143
  myBody.append(data.key, data.value.content);
143
144
  }
@@ -41,11 +41,11 @@ exports.slice = (0, toolkit_1.createSlice)({
41
41
  },
42
42
  },
43
43
  });
44
- (_a = exports.slice.actions),
44
+ ((_a = exports.slice.actions),
45
45
  (exports.setResponse = _a.setResponse),
46
46
  (exports.clearResponse = _a.clearResponse),
47
47
  (exports.setCode = _a.setCode),
48
48
  (exports.clearCode = _a.clearCode),
49
49
  (exports.setHeaders = _a.setHeaders),
50
- (exports.clearHeaders = _a.clearHeaders);
50
+ (exports.clearHeaders = _a.clearHeaders));
51
51
  exports.default = exports.slice.reducer;
@@ -27,7 +27,7 @@ exports.slice = (0, toolkit_1.createSlice)({
27
27
  },
28
28
  },
29
29
  });
30
- (_a = exports.slice.actions),
30
+ ((_a = exports.slice.actions),
31
31
  (exports.setServer = _a.setServer),
32
- (exports.setServerVariable = _a.setServerVariable);
32
+ (exports.setServerVariable = _a.setServerVariable));
33
33
  exports.default = exports.slice.reducer;
@@ -1,7 +1,7 @@
1
1
  import { AuthState } from "@theme/ApiExplorer/Authorization/slice";
2
2
  import { Body } from "@theme/ApiExplorer/Body/slice";
3
3
  import { ParameterObject, ServerObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
4
- import sdk from "postman-collection";
4
+ import * as sdk from "postman-collection";
5
5
  type Param = {
6
6
  value?: string | string[];
7
7
  } & ParameterObject;
@@ -5,6 +5,62 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
+ var __createBinding =
9
+ (this && this.__createBinding) ||
10
+ (Object.create
11
+ ? function (o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (
15
+ !desc ||
16
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
17
+ ) {
18
+ desc = {
19
+ enumerable: true,
20
+ get: function () {
21
+ return m[k];
22
+ },
23
+ };
24
+ }
25
+ Object.defineProperty(o, k2, desc);
26
+ }
27
+ : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+ var __setModuleDefault =
32
+ (this && this.__setModuleDefault) ||
33
+ (Object.create
34
+ ? function (o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }
37
+ : function (o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar =
41
+ (this && this.__importStar) ||
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
+ })();
8
64
  var __importDefault =
9
65
  (this && this.__importDefault) ||
10
66
  function (mod) {
@@ -12,7 +68,7 @@ var __importDefault =
12
68
  };
13
69
  Object.defineProperty(exports, "__esModule", { value: true });
14
70
  const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
15
- const postman_collection_1 = __importDefault(require("postman-collection"));
71
+ const sdk = __importStar(require("postman-collection"));
16
72
  function setQueryParams(postman, queryParams) {
17
73
  postman.url.query.clear();
18
74
  const qp = queryParams
@@ -23,25 +79,25 @@ function setQueryParams(postman, queryParams) {
23
79
  // Handle array values
24
80
  if (Array.isArray(param.value)) {
25
81
  if (param.style === "spaceDelimited") {
26
- return new postman_collection_1.default.QueryParam({
82
+ return new sdk.QueryParam({
27
83
  key: param.name,
28
84
  value: param.value.join(" "),
29
85
  });
30
86
  } else if (param.style === "pipeDelimited") {
31
- return new postman_collection_1.default.QueryParam({
87
+ return new sdk.QueryParam({
32
88
  key: param.name,
33
89
  value: param.value.join("|"),
34
90
  });
35
91
  } else if (param.explode) {
36
92
  return param.value.map(
37
93
  (val) =>
38
- new postman_collection_1.default.QueryParam({
94
+ new sdk.QueryParam({
39
95
  key: param.name,
40
96
  value: val,
41
97
  })
42
98
  );
43
99
  } else {
44
- return new postman_collection_1.default.QueryParam({
100
+ return new sdk.QueryParam({
45
101
  key: param.name,
46
102
  value: param.value.join(","),
47
103
  });
@@ -61,21 +117,21 @@ function setQueryParams(postman, queryParams) {
61
117
  if (param.style === "deepObject") {
62
118
  return Object.entries(jsonResult).map(
63
119
  ([key, val]) =>
64
- new postman_collection_1.default.QueryParam({
120
+ new sdk.QueryParam({
65
121
  key: `${param.name}[${key}]`,
66
- value: val,
122
+ value: String(val),
67
123
  })
68
124
  );
69
125
  } else if (param.explode) {
70
126
  return Object.entries(jsonResult).map(
71
127
  ([key, val]) =>
72
- new postman_collection_1.default.QueryParam({
128
+ new sdk.QueryParam({
73
129
  key: key,
74
- value: val,
130
+ value: String(val),
75
131
  })
76
132
  );
77
133
  } else {
78
- return new postman_collection_1.default.QueryParam({
134
+ return new sdk.QueryParam({
79
135
  key: param.name,
80
136
  value: Object.entries(jsonResult)
81
137
  .map(([key, val]) => `${key},${val}`)
@@ -85,7 +141,7 @@ function setQueryParams(postman, queryParams) {
85
141
  }
86
142
  // Handle boolean values
87
143
  if (typeof decodedValue === "boolean") {
88
- return new postman_collection_1.default.QueryParam({
144
+ return new sdk.QueryParam({
89
145
  key: param.name,
90
146
  value: decodedValue ? "true" : "false",
91
147
  });
@@ -93,14 +149,14 @@ function setQueryParams(postman, queryParams) {
93
149
  // Parameter allows empty value: "/hello?extended"
94
150
  if (param.allowEmptyValue) {
95
151
  if (decodedValue === "true") {
96
- return new postman_collection_1.default.QueryParam({
152
+ return new sdk.QueryParam({
97
153
  key: param.name,
98
154
  value: null,
99
155
  });
100
156
  }
101
157
  return undefined;
102
158
  }
103
- return new postman_collection_1.default.QueryParam({
159
+ return new sdk.QueryParam({
104
160
  key: param.name,
105
161
  value: param.value,
106
162
  });
@@ -127,7 +183,7 @@ function setPathParams(postman, pathParams) {
127
183
  } else {
128
184
  serializedValue = param.value.join(",");
129
185
  }
130
- return new postman_collection_1.default.Variable({
186
+ return new sdk.Variable({
131
187
  key: param.name,
132
188
  value: serializedValue,
133
189
  });
@@ -154,12 +210,15 @@ function setPathParams(postman, pathParams) {
154
210
  } else {
155
211
  serializedValue = decodedValue || `:${param.name}`;
156
212
  }
157
- return new postman_collection_1.default.Variable({
213
+ return new sdk.Variable({
158
214
  key: param.name,
159
215
  value: serializedValue,
160
216
  });
161
217
  });
162
- postman.url.variables.assimilate(source, false);
218
+ postman.url.variables.assimilate(
219
+ source.filter((v) => v !== undefined),
220
+ false
221
+ );
163
222
  }
164
223
  function buildCookie(cookieParams) {
165
224
  const cookies = cookieParams
@@ -181,26 +240,32 @@ function buildCookie(cookieParams) {
181
240
  // Serialize each key-value pair as a separate cookie
182
241
  return Object.entries(jsonResult).map(
183
242
  ([key, val]) =>
184
- new postman_collection_1.default.Cookie({
243
+ new sdk.Cookie({
185
244
  key: key,
186
- value: val,
245
+ value: String(val),
246
+ domain: "",
247
+ path: "",
187
248
  })
188
249
  );
189
250
  } else {
190
251
  // Serialize the object as a single cookie with key-value pairs joined by commas
191
- return new postman_collection_1.default.Cookie({
252
+ return new sdk.Cookie({
192
253
  key: param.name,
193
254
  value: Object.entries(jsonResult)
194
255
  .map(([key, val]) => `${key},${val}`)
195
256
  .join(","),
257
+ domain: "",
258
+ path: "",
196
259
  });
197
260
  }
198
261
  }
199
262
  } else {
200
263
  // Handle scalar values
201
- return new postman_collection_1.default.Cookie({
264
+ return new sdk.Cookie({
202
265
  key: param.name,
203
- value: param.value,
266
+ value: String(param.value),
267
+ domain: "",
268
+ path: "",
204
269
  });
205
270
  }
206
271
  }
@@ -208,7 +273,7 @@ function buildCookie(cookieParams) {
208
273
  })
209
274
  .flat() // Flatten the array in case of nested arrays from map
210
275
  .filter((item) => item !== undefined);
211
- const list = new postman_collection_1.default.CookieList(null, cookies);
276
+ const list = new sdk.CookieList(null, cookies);
212
277
  return list.toString();
213
278
  }
214
279
  function setHeaders(postman, contentType, accept, cookie, headerParams, other) {
@@ -312,15 +377,9 @@ function setBody(clonedPostman, body) {
312
377
  .filter((entry) => !!entry[1])
313
378
  .map(([key, content]) => {
314
379
  if (content.type === "file") {
315
- return new postman_collection_1.default.FormParam({
316
- key: key,
317
- ...content,
318
- });
380
+ return new sdk.FormParam({ key: key, ...content });
319
381
  }
320
- return new postman_collection_1.default.FormParam({
321
- key: key,
322
- value: content.value,
323
- });
382
+ return new sdk.FormParam({ key: key, value: content.value });
324
383
  });
325
384
  clonedPostman.body.formdata?.assimilate(params, false);
326
385
  return;
@@ -337,10 +396,7 @@ function setBody(clonedPostman, body) {
337
396
  .filter((entry) => !!entry[1])
338
397
  .map(([key, content]) => {
339
398
  if (content.type !== "file" && content.value) {
340
- return new postman_collection_1.default.QueryParam({
341
- key: key,
342
- value: content.value,
343
- });
399
+ return new sdk.QueryParam({ key: key, value: content.value });
344
400
  }
345
401
  return undefined;
346
402
  })
@@ -5,6 +5,62 @@
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  * ========================================================================== */
8
+ var __createBinding =
9
+ (this && this.__createBinding) ||
10
+ (Object.create
11
+ ? function (o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (
15
+ !desc ||
16
+ ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
17
+ ) {
18
+ desc = {
19
+ enumerable: true,
20
+ get: function () {
21
+ return m[k];
22
+ },
23
+ };
24
+ }
25
+ Object.defineProperty(o, k2, desc);
26
+ }
27
+ : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+ var __setModuleDefault =
32
+ (this && this.__setModuleDefault) ||
33
+ (Object.create
34
+ ? function (o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }
37
+ : function (o, v) {
38
+ o["default"] = v;
39
+ });
40
+ var __importStar =
41
+ (this && this.__importStar) ||
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
+ })();
8
64
  var __importDefault =
9
65
  (this && this.__importDefault) ||
10
66
  function (mod) {
@@ -20,9 +76,9 @@ const Response_1 = __importDefault(require("@theme/ApiExplorer/Response"));
20
76
  const SecuritySchemes_1 = __importDefault(
21
77
  require("@theme/ApiExplorer/SecuritySchemes")
22
78
  );
23
- const postman_collection_1 = __importDefault(require("postman-collection"));
79
+ const sdk = __importStar(require("postman-collection"));
24
80
  function ApiExplorer({ item, infoPath }) {
25
- const postman = new postman_collection_1.default.Request(item.postman);
81
+ const postman = new sdk.Request(item.postman ? item.postman.toJSON() : {});
26
82
  return react_1.default.createElement(
27
83
  react_1.default.Fragment,
28
84
  null,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-theme-openapi-docs",
3
3
  "description": "OpenAPI theme for Docusaurus.",
4
- "version": "0.0.0-1016",
4
+ "version": "0.0.0-1018",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -35,8 +35,10 @@
35
35
  "@types/file-saver": "^2.0.5",
36
36
  "@types/lodash": "^4.14.176",
37
37
  "@types/pako": "^2.0.3",
38
+ "@types/postman-collection": "^3.5.11",
39
+ "@types/react-modal": "^3.16.3",
38
40
  "concurrently": "^5.2.0",
39
- "docusaurus-plugin-openapi-docs": "0.0.0-1016",
41
+ "docusaurus-plugin-openapi-docs": "0.0.0-1018",
40
42
  "docusaurus-plugin-sass": "^0.2.3",
41
43
  "eslint-plugin-prettier": "^5.0.1"
42
44
  },
@@ -79,5 +81,5 @@
79
81
  "engines": {
80
82
  "node": ">=14"
81
83
  },
82
- "gitHead": "c6ced382c6fb3ee6efd7e1b7b9a11c33355131c5"
84
+ "gitHead": "4ed9784e2b92f3f65cdcc25b1606639b5a8c3c82"
83
85
  }
@@ -96,7 +96,7 @@ export default function CodeBlockString({
96
96
  getLineProps={getLineProps}
97
97
  getTokenProps={getTokenProps}
98
98
  classNames={lineClassNames[i]}
99
- showLineNumbers={showLineNumbers}
99
+ showLineNumbers={!!showLineNumbers}
100
100
  />
101
101
  ))}
102
102
  </code>
@@ -122,9 +122,9 @@ export default function CodeBlockString({
122
122
  )}
123
123
  code={code}
124
124
  language={(language ?? "text") as Language}
125
- showLineNumbers={showLineNumbers}
125
+ showLineNumbers={!!showLineNumbers}
126
126
  blockClassName={blockClassName}
127
- title={title}
127
+ title={typeof title === "string" ? title : undefined}
128
128
  lineClassNames={lineClassNames}
129
129
  />
130
130
  </div>
@@ -7,11 +7,15 @@
7
7
 
8
8
  import React, { useCallback, useState, useRef, useEffect } from "react";
9
9
 
10
- import { CopyButtonProps } from "@docusaurus/theme-common/internal";
11
10
  import { translate } from "@docusaurus/Translate";
12
11
  import clsx from "clsx";
13
12
  import copy from "copy-text-to-clipboard";
14
13
 
14
+ interface CopyButtonProps {
15
+ code: string;
16
+ className?: string;
17
+ }
18
+
15
19
  export default function CopyButton({
16
20
  code,
17
21
  className,
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  * ========================================================================== */
7
7
 
8
- import React, { useState, useEffect, type JSX } from "react";
8
+ import React, { useState, useEffect } from "react";
9
9
 
10
10
  import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
11
11
  import ApiCodeBlock from "@theme/ApiExplorer/ApiCodeBlock";
@@ -14,7 +14,7 @@ import CodeTabs from "@theme/ApiExplorer/CodeTabs";
14
14
  import { useTypedSelector } from "@theme/ApiItem/hooks";
15
15
  import cloneDeep from "lodash/cloneDeep";
16
16
  import codegen from "postman-code-generators";
17
- import sdk from "postman-collection";
17
+ import * as sdk from "postman-collection";
18
18
 
19
19
  import { CodeSample, Language } from "./code-snippets-types";
20
20
  import {
@@ -31,7 +31,7 @@ export interface Props {
31
31
  codeSamples: CodeSample[];
32
32
  }
33
33
 
34
- function CodeTab({ children, hidden, className }: any): JSX.Element {
34
+ function CodeTab({ children, hidden, className }: any): React.JSX.Element {
35
35
  return (
36
36
  <div role="tabpanel" className={className} {...{ hidden }}>
37
37
  {children}
@@ -26,7 +26,7 @@ import Server from "@theme/ApiExplorer/Server";
26
26
  import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
27
27
  import { ParameterObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
28
28
  import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
29
- import sdk from "postman-collection";
29
+ import * as sdk from "postman-collection";
30
30
  import { FormProvider, useForm } from "react-hook-form";
31
31
 
32
32
  import makeRequest from "./makeRequest";
@@ -126,7 +126,7 @@ function Request({ item }: { item: ApiItem }) {
126
126
  } else {
127
127
  await handleResponse(res);
128
128
  }
129
- } catch (e: any) {
129
+ } catch (e) {
130
130
  console.log(e);
131
131
  dispatch(setResponse("Connection failed"));
132
132
  dispatch(clearCode());
@@ -6,7 +6,7 @@
6
6
  * ========================================================================== */
7
7
 
8
8
  import { Body } from "@theme/ApiExplorer/Body/slice";
9
- import sdk from "postman-collection";
9
+ import * as sdk from "postman-collection";
10
10
 
11
11
  function fetchWithtimeout(
12
12
  url: string,
@@ -156,8 +156,9 @@ async function makeRequest(
156
156
  myHeaders.delete("Content-Type");
157
157
 
158
158
  myBody = new FormData();
159
- if (Array.isArray(request.body.formdata.members)) {
160
- for (const data of request.body.formdata.members) {
159
+ const members = (request.body as any)?.formdata?.members;
160
+ if (Array.isArray(members)) {
161
+ for (const data of members) {
161
162
  if (data.key && data.value.content) {
162
163
  myBody.append(data.key, data.value.content);
163
164
  }
@@ -12,7 +12,7 @@ import {
12
12
  ServerObject,
13
13
  } from "docusaurus-plugin-openapi-docs/src/openapi/types";
14
14
  import cloneDeep from "lodash/cloneDeep";
15
- import sdk from "postman-collection";
15
+ import * as sdk from "postman-collection";
16
16
 
17
17
  type Param = {
18
18
  value?: string | string[];
@@ -73,7 +73,7 @@ function setQueryParams(postman: sdk.Request, queryParams: Param[]) {
73
73
  ([key, val]) =>
74
74
  new sdk.QueryParam({
75
75
  key: `${param.name}[${key}]`,
76
- value: val,
76
+ value: String(val),
77
77
  })
78
78
  );
79
79
  } else if (param.explode) {
@@ -81,7 +81,7 @@ function setQueryParams(postman: sdk.Request, queryParams: Param[]) {
81
81
  ([key, val]) =>
82
82
  new sdk.QueryParam({
83
83
  key: key,
84
- value: val,
84
+ value: String(val),
85
85
  })
86
86
  );
87
87
  } else {
@@ -181,7 +181,10 @@ function setPathParams(postman: sdk.Request, pathParams: Param[]) {
181
181
  });
182
182
  });
183
183
 
184
- postman.url.variables.assimilate(source, false);
184
+ postman.url.variables.assimilate(
185
+ source.filter((v): v is sdk.Variable => v !== undefined),
186
+ false
187
+ );
185
188
  }
186
189
 
187
190
  function buildCookie(cookieParams: Param[]) {
@@ -207,7 +210,9 @@ function buildCookie(cookieParams: Param[]) {
207
210
  ([key, val]) =>
208
211
  new sdk.Cookie({
209
212
  key: key,
210
- value: val,
213
+ value: String(val),
214
+ domain: "",
215
+ path: "",
211
216
  })
212
217
  );
213
218
  } else {
@@ -217,6 +222,8 @@ function buildCookie(cookieParams: Param[]) {
217
222
  value: Object.entries(jsonResult)
218
223
  .map(([key, val]) => `${key},${val}`)
219
224
  .join(","),
225
+ domain: "",
226
+ path: "",
220
227
  });
221
228
  }
222
229
  }
@@ -224,7 +231,9 @@ function buildCookie(cookieParams: Param[]) {
224
231
  // Handle scalar values
225
232
  return new sdk.Cookie({
226
233
  key: param.name,
227
- value: param.value,
234
+ value: String(param.value),
235
+ domain: "",
236
+ path: "",
228
237
  });
229
238
  }
230
239
  }
@@ -12,7 +12,7 @@ import Request from "@theme/ApiExplorer/Request";
12
12
  import Response from "@theme/ApiExplorer/Response";
13
13
  import SecuritySchemes from "@theme/ApiExplorer/SecuritySchemes";
14
14
  import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
15
- import sdk from "postman-collection";
15
+ import * as sdk from "postman-collection";
16
16
 
17
17
  function ApiExplorer({
18
18
  item,
@@ -21,7 +21,9 @@ function ApiExplorer({
21
21
  item: NonNullable<ApiItem>;
22
22
  infoPath: string;
23
23
  }) {
24
- const postman = new sdk.Request(item.postman);
24
+ const postman = new sdk.Request(
25
+ item.postman ? (item.postman as any).toJSON() : {}
26
+ );
25
27
 
26
28
  return (
27
29
  <>
@@ -1 +1 @@
1
- {"root":["./src/index.ts","./src/plugin-content-docs.d.ts","./src/postman-code-generators.d.ts","./src/react-magic-dropzone.d.ts","./src/theme-classic.d.ts","./src/theme-openapi.d.ts","./src/theme-translations.d.ts","./src/types.ts","./src/markdown/createDescription.ts","./src/markdown/schema.ts","./src/markdown/utils.test.ts","./src/markdown/utils.ts","./src/theme/ApiExplorer/buildPostmanRequest.ts","./src/theme/ApiExplorer/index.tsx","./src/theme/ApiExplorer/persistanceMiddleware.ts","./src/theme/ApiExplorer/postman-collection.d.ts","./src/theme/ApiExplorer/react-modal.d.ts","./src/theme/ApiExplorer/storage-utils.ts","./src/theme/ApiExplorer/Accept/index.tsx","./src/theme/ApiExplorer/Accept/slice.ts","./src/theme/ApiExplorer/ApiCodeBlock/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx","./src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx","./src/theme/ApiExplorer/Authorization/auth-types.ts","./src/theme/ApiExplorer/Authorization/index.tsx","./src/theme/ApiExplorer/Authorization/slice.ts","./src/theme/ApiExplorer/Body/index.tsx","./src/theme/ApiExplorer/Body/slice.ts","./src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts","./src/theme/ApiExplorer/CodeSnippets/index.tsx","./src/theme/ApiExplorer/CodeSnippets/languages.ts","./src/theme/ApiExplorer/CodeTabs/index.tsx","./src/theme/ApiExplorer/ContentType/index.tsx","./src/theme/ApiExplorer/ContentType/slice.ts","./src/theme/ApiExplorer/Export/index.tsx","./src/theme/ApiExplorer/FloatingButton/index.tsx","./src/theme/ApiExplorer/FormFileUpload/index.tsx","./src/theme/ApiExplorer/FormItem/index.tsx","./src/theme/ApiExplorer/FormMultiSelect/index.tsx","./src/theme/ApiExplorer/FormSelect/index.tsx","./src/theme/ApiExplorer/FormTextInput/index.tsx","./src/theme/ApiExplorer/LiveEditor/index.tsx","./src/theme/ApiExplorer/MethodEndpoint/index.tsx","./src/theme/ApiExplorer/ParamOptions/index.tsx","./src/theme/ApiExplorer/ParamOptions/slice.ts","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx","./src/theme/ApiExplorer/Request/index.tsx","./src/theme/ApiExplorer/Request/makeRequest.ts","./src/theme/ApiExplorer/Response/index.tsx","./src/theme/ApiExplorer/Response/slice.ts","./src/theme/ApiExplorer/SecuritySchemes/index.tsx","./src/theme/ApiExplorer/Server/index.tsx","./src/theme/ApiExplorer/Server/slice.ts","./src/theme/ApiItem/hooks.ts","./src/theme/ApiItem/index.tsx","./src/theme/ApiItem/store.ts","./src/theme/ApiItem/Layout/index.tsx","./src/theme/ApiLogo/index.tsx","./src/theme/ApiTabs/index.tsx","./src/theme/ArrayBrackets/index.tsx","./src/theme/CodeSamples/index.tsx","./src/theme/DiscriminatorTabs/index.tsx","./src/theme/MimeTabs/index.tsx","./src/theme/OperationTabs/index.tsx","./src/theme/ParamsDetails/index.tsx","./src/theme/ParamsItem/index.tsx","./src/theme/RequestSchema/index.tsx","./src/theme/ResponseExamples/index.tsx","./src/theme/ResponseHeaders/index.tsx","./src/theme/ResponseSchema/index.tsx","./src/theme/Schema/index.tsx","./src/theme/SchemaItem/index.tsx","./src/theme/SchemaTabs/index.tsx","./src/theme/SkeletonLoader/index.tsx","./src/theme/StatusCodes/index.tsx"],"version":"5.7.3"}
1
+ {"root":["./src/index.ts","./src/plugin-content-docs.d.ts","./src/postman-code-generators.d.ts","./src/react-magic-dropzone.d.ts","./src/theme-classic.d.ts","./src/theme-openapi.d.ts","./src/types.ts","./src/markdown/createDescription.ts","./src/markdown/schema.ts","./src/markdown/utils.test.ts","./src/markdown/utils.ts","./src/theme/ApiExplorer/buildPostmanRequest.ts","./src/theme/ApiExplorer/index.tsx","./src/theme/ApiExplorer/persistanceMiddleware.ts","./src/theme/ApiExplorer/storage-utils.ts","./src/theme/ApiExplorer/Accept/index.tsx","./src/theme/ApiExplorer/Accept/slice.ts","./src/theme/ApiExplorer/ApiCodeBlock/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Content/Element.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx","./src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx","./src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.tsx","./src/theme/ApiExplorer/Authorization/auth-types.ts","./src/theme/ApiExplorer/Authorization/index.tsx","./src/theme/ApiExplorer/Authorization/slice.ts","./src/theme/ApiExplorer/Body/index.tsx","./src/theme/ApiExplorer/Body/slice.ts","./src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts","./src/theme/ApiExplorer/CodeSnippets/index.tsx","./src/theme/ApiExplorer/CodeSnippets/languages.ts","./src/theme/ApiExplorer/CodeTabs/index.tsx","./src/theme/ApiExplorer/ContentType/index.tsx","./src/theme/ApiExplorer/ContentType/slice.ts","./src/theme/ApiExplorer/Export/index.tsx","./src/theme/ApiExplorer/FloatingButton/index.tsx","./src/theme/ApiExplorer/FormFileUpload/index.tsx","./src/theme/ApiExplorer/FormItem/index.tsx","./src/theme/ApiExplorer/FormMultiSelect/index.tsx","./src/theme/ApiExplorer/FormSelect/index.tsx","./src/theme/ApiExplorer/FormTextInput/index.tsx","./src/theme/ApiExplorer/LiveEditor/index.tsx","./src/theme/ApiExplorer/MethodEndpoint/index.tsx","./src/theme/ApiExplorer/ParamOptions/index.tsx","./src/theme/ApiExplorer/ParamOptions/slice.ts","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx","./src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx","./src/theme/ApiExplorer/Request/index.tsx","./src/theme/ApiExplorer/Request/makeRequest.ts","./src/theme/ApiExplorer/Response/index.tsx","./src/theme/ApiExplorer/Response/slice.ts","./src/theme/ApiExplorer/SecuritySchemes/index.tsx","./src/theme/ApiExplorer/Server/index.tsx","./src/theme/ApiExplorer/Server/slice.ts","./src/theme/ApiItem/hooks.ts","./src/theme/ApiItem/index.tsx","./src/theme/ApiItem/store.ts","./src/theme/ApiItem/Layout/index.tsx","./src/theme/ApiLogo/index.tsx","./src/theme/ApiTabs/index.tsx","./src/theme/ArrayBrackets/index.tsx","./src/theme/CodeSamples/index.tsx","./src/theme/DiscriminatorTabs/index.tsx","./src/theme/MimeTabs/index.tsx","./src/theme/OperationTabs/index.tsx","./src/theme/ParamsDetails/index.tsx","./src/theme/ParamsItem/index.tsx","./src/theme/RequestSchema/index.tsx","./src/theme/ResponseExamples/index.tsx","./src/theme/ResponseHeaders/index.tsx","./src/theme/ResponseSchema/index.tsx","./src/theme/Schema/index.tsx","./src/theme/SchemaItem/index.tsx","./src/theme/SchemaTabs/index.tsx","./src/theme/SkeletonLoader/index.tsx","./src/theme/StatusCodes/index.tsx"],"version":"5.8.3"}
@@ -1,10 +0,0 @@
1
- /* ============================================================================
2
- * Copyright (c) Palo Alto Networks
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- * ========================================================================== */
7
-
8
- declare module "postman-collection" {
9
- export = Request.sdk;
10
- }
@@ -1,8 +0,0 @@
1
- /* ============================================================================
2
- * Copyright (c) Palo Alto Networks
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- * ========================================================================== */
7
-
8
- declare module "react-modal";
@@ -1,9 +0,0 @@
1
- /* ============================================================================
2
- * Copyright (c) Palo Alto Networks
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- * ========================================================================== */
7
-
8
- // TODO: Remove this when https://github.com/facebook/docusaurus/issues/6087 is resolved.
9
- declare module "@docusaurus/theme-translations";