docusaurus-theme-openapi-docs 0.0.0-346 → 0.0.0-348
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/package.json +3 -3
- package/src/theme/ApiItem/styles.module.css +4 -0
- package/lib/index.js +0 -48
- package/lib/markdown/createDescription.js +0 -20
- package/lib/markdown/schema.js +0 -121
- package/lib/markdown/utils.js +0 -45
- package/lib/postman-code-generators.d.ts +0 -9
- package/lib/react-magic-dropzone.d.ts +0 -9
- package/lib/theme/ApiDemoPanel/Accept/index.js +0 -41
- package/lib/theme/ApiDemoPanel/Accept/slice.js +0 -32
- package/lib/theme/ApiDemoPanel/Authorization/auth-types.js +0 -32
- package/lib/theme/ApiDemoPanel/Authorization/index.js +0 -174
- package/lib/theme/ApiDemoPanel/Authorization/slice.js +0 -137
- package/lib/theme/ApiDemoPanel/Body/index.js +0 -185
- package/lib/theme/ApiDemoPanel/Body/slice.js +0 -105
- package/lib/theme/ApiDemoPanel/ContentType/index.js +0 -41
- package/lib/theme/ApiDemoPanel/ContentType/slice.js +0 -32
- package/lib/theme/ApiDemoPanel/Curl/index.js +0 -235
- package/lib/theme/ApiDemoPanel/Curl/styles.module.css +0 -84
- package/lib/theme/ApiDemoPanel/Execute/index.js +0 -85
- package/lib/theme/ApiDemoPanel/Execute/makeRequest.js +0 -200
- package/lib/theme/ApiDemoPanel/FloatingButton/index.js +0 -32
- package/lib/theme/ApiDemoPanel/FloatingButton/styles.module.css +0 -26
- package/lib/theme/ApiDemoPanel/FormFileUpload/index.js +0 -96
- package/lib/theme/ApiDemoPanel/FormFileUpload/styles.module.css +0 -75
- package/lib/theme/ApiDemoPanel/FormItem/index.js +0 -35
- package/lib/theme/ApiDemoPanel/FormItem/styles.module.css +0 -7
- package/lib/theme/ApiDemoPanel/FormMultiSelect/index.js +0 -52
- package/lib/theme/ApiDemoPanel/FormMultiSelect/styles.module.css +0 -38
- package/lib/theme/ApiDemoPanel/FormSelect/index.js +0 -39
- package/lib/theme/ApiDemoPanel/FormSelect/styles.module.css +0 -51
- package/lib/theme/ApiDemoPanel/FormTextInput/index.js +0 -30
- package/lib/theme/ApiDemoPanel/FormTextInput/styles.module.css +0 -21
- package/lib/theme/ApiDemoPanel/MethodEndpoint/index.js +0 -60
- package/lib/theme/ApiDemoPanel/ParamOptions/index.js +0 -248
- package/lib/theme/ApiDemoPanel/ParamOptions/slice.js +0 -35
- package/lib/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -180
- package/lib/theme/ApiDemoPanel/Response/index.js +0 -75
- package/lib/theme/ApiDemoPanel/Response/slice.js +0 -37
- package/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +0 -51
- package/lib/theme/ApiDemoPanel/Server/index.js +0 -109
- package/lib/theme/ApiDemoPanel/Server/slice.js +0 -41
- package/lib/theme/ApiDemoPanel/Server/styles.module.css +0 -61
- package/lib/theme/ApiDemoPanel/VSCode/index.js +0 -252
- package/lib/theme/ApiDemoPanel/VSCode/styles.module.css +0 -19
- package/lib/theme/ApiDemoPanel/buildPostmanRequest.js +0 -328
- package/lib/theme/ApiDemoPanel/hooks.js +0 -20
- package/lib/theme/ApiDemoPanel/index.js +0 -132
- package/lib/theme/ApiDemoPanel/persistanceMiddleware.js +0 -44
- package/lib/theme/ApiDemoPanel/postman-collection.d.ts +0 -10
- package/lib/theme/ApiDemoPanel/storage-utils.js +0 -47
- package/lib/theme/ApiDemoPanel/store.js +0 -48
- package/lib/theme/ApiDemoPanel/styles.module.css +0 -44
- package/lib/theme/ApiItem/index.js +0 -160
- package/lib/theme/ApiItem/styles.module.css +0 -109
- package/lib/theme/ApiTabs/index.js +0 -258
- package/lib/theme/ApiTabs/styles.module.css +0 -118
- package/lib/theme/ParamsItem/index.js +0 -68
- package/lib/theme/ParamsItem/styles.module.css +0 -24
- package/lib/theme/SchemaItem/index.js +0 -58
- package/lib/theme/SchemaItem/styles.module.css +0 -24
- package/lib/theme-classic.d.ts +0 -8
- package/lib/theme-openapi.d.ts +0 -48
- package/lib/theme-translations.d.ts +0 -9
- package/lib/types.js +0 -1
- package/lib-next/index.js +0 -38
- package/lib-next/markdown/createDescription.js +0 -13
- package/lib-next/markdown/schema.js +0 -115
- package/lib-next/markdown/utils.js +0 -31
- package/lib-next/postman-code-generators.d.ts +0 -9
- package/lib-next/react-magic-dropzone.d.ts +0 -9
- package/lib-next/theme/ApiDemoPanel/Accept/index.js +0 -33
- package/lib-next/theme/ApiDemoPanel/Accept/slice.js +0 -19
- package/lib-next/theme/ApiDemoPanel/Authorization/auth-types.js +0 -22
- package/lib-next/theme/ApiDemoPanel/Authorization/index.js +0 -203
- package/lib-next/theme/ApiDemoPanel/Authorization/slice.js +0 -101
- package/lib-next/theme/ApiDemoPanel/Body/index.js +0 -210
- package/lib-next/theme/ApiDemoPanel/Body/slice.js +0 -89
- package/lib-next/theme/ApiDemoPanel/ContentType/index.js +0 -33
- package/lib-next/theme/ApiDemoPanel/ContentType/slice.js +0 -19
- package/lib-next/theme/ApiDemoPanel/Curl/index.js +0 -262
- package/lib-next/theme/ApiDemoPanel/Curl/styles.module.css +0 -84
- package/lib-next/theme/ApiDemoPanel/Execute/index.js +0 -73
- package/lib-next/theme/ApiDemoPanel/Execute/makeRequest.js +0 -181
- package/lib-next/theme/ApiDemoPanel/FloatingButton/index.js +0 -19
- package/lib-next/theme/ApiDemoPanel/FloatingButton/styles.module.css +0 -26
- package/lib-next/theme/ApiDemoPanel/FormFileUpload/index.js +0 -112
- package/lib-next/theme/ApiDemoPanel/FormFileUpload/styles.module.css +0 -75
- package/lib-next/theme/ApiDemoPanel/FormItem/index.js +0 -29
- package/lib-next/theme/ApiDemoPanel/FormItem/styles.module.css +0 -7
- package/lib-next/theme/ApiDemoPanel/FormMultiSelect/index.js +0 -49
- package/lib-next/theme/ApiDemoPanel/FormMultiSelect/styles.module.css +0 -38
- package/lib-next/theme/ApiDemoPanel/FormSelect/index.js +0 -28
- package/lib-next/theme/ApiDemoPanel/FormSelect/styles.module.css +0 -51
- package/lib-next/theme/ApiDemoPanel/FormTextInput/index.js +0 -23
- package/lib-next/theme/ApiDemoPanel/FormTextInput/styles.module.css +0 -21
- package/lib-next/theme/ApiDemoPanel/MethodEndpoint/index.js +0 -53
- package/lib-next/theme/ApiDemoPanel/ParamOptions/index.js +0 -284
- package/lib-next/theme/ApiDemoPanel/ParamOptions/slice.js +0 -22
- package/lib-next/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -180
- package/lib-next/theme/ApiDemoPanel/Response/index.js +0 -65
- package/lib-next/theme/ApiDemoPanel/Response/slice.js +0 -22
- package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +0 -48
- package/lib-next/theme/ApiDemoPanel/Server/index.js +0 -114
- package/lib-next/theme/ApiDemoPanel/Server/slice.js +0 -25
- package/lib-next/theme/ApiDemoPanel/Server/styles.module.css +0 -61
- package/lib-next/theme/ApiDemoPanel/VSCode/index.js +0 -265
- package/lib-next/theme/ApiDemoPanel/VSCode/styles.module.css +0 -19
- package/lib-next/theme/ApiDemoPanel/buildPostmanRequest.js +0 -309
- package/lib-next/theme/ApiDemoPanel/hooks.js +0 -9
- package/lib-next/theme/ApiDemoPanel/index.js +0 -108
- package/lib-next/theme/ApiDemoPanel/persistanceMiddleware.js +0 -38
- package/lib-next/theme/ApiDemoPanel/postman-collection.d.ts +0 -10
- package/lib-next/theme/ApiDemoPanel/storage-utils.js +0 -35
- package/lib-next/theme/ApiDemoPanel/store.js +0 -30
- package/lib-next/theme/ApiDemoPanel/styles.module.css +0 -44
- package/lib-next/theme/ApiItem/index.js +0 -171
- package/lib-next/theme/ApiItem/styles.module.css +0 -109
- package/lib-next/theme/ApiTabs/index.js +0 -258
- package/lib-next/theme/ApiTabs/styles.module.css +0 -118
- package/lib-next/theme/ParamsItem/index.js +0 -68
- package/lib-next/theme/ParamsItem/styles.module.css +0 -24
- package/lib-next/theme/SchemaItem/index.js +0 -58
- package/lib-next/theme/SchemaItem/styles.module.css +0 -24
- package/lib-next/theme-classic.d.ts +0 -8
- package/lib-next/theme-openapi.d.ts +0 -48
- package/lib-next/theme-translations.d.ts +0 -9
- package/lib-next/types.js +0 -1
- package/yarn-error.log +0 -15035
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-
|
|
4
|
+
"version": "0.0.0-348",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"buffer": "^6.0.3",
|
|
52
52
|
"clsx": "^1.1.1",
|
|
53
53
|
"crypto-js": "^4.1.1",
|
|
54
|
-
"docusaurus-plugin-openapi-docs": "0.0.0-
|
|
54
|
+
"docusaurus-plugin-openapi-docs": "0.0.0-348",
|
|
55
55
|
"immer": "^9.0.7",
|
|
56
56
|
"lodash": "^4.17.20",
|
|
57
57
|
"monaco-editor": "^0.31.1",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">=14"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "0a63473c72f3c60567bae5730ad586f14b2c1080"
|
|
74
74
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--openapi-required: var(--ifm-color-danger);
|
|
3
|
+
--openapi-code-blue: var(--ifm-color-info);
|
|
4
|
+
--openapi-code-red: var(--ifm-color-danger);
|
|
5
|
+
--openapi-code-orange: var(--ifm-color-warning);
|
|
6
|
+
--openapi-code-green: var(--ifm-color-success);
|
|
3
7
|
}
|
|
4
8
|
|
|
5
9
|
.apiItemContainer article > *:first-child,
|
package/lib/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = docusaurusThemeOpenAPI;
|
|
7
|
-
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
|
-
var _webpack = require("webpack");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
/* ============================================================================
|
|
15
|
-
* Copyright (c) Palo Alto Networks
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the MIT license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
* ========================================================================== */
|
|
20
|
-
function docusaurusThemeOpenAPI() {
|
|
21
|
-
return {
|
|
22
|
-
name: "docusaurus-theme-openapi",
|
|
23
|
-
|
|
24
|
-
getThemePath() {
|
|
25
|
-
return _path.default.join(__dirname, "..", "lib-next", "theme");
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
getTypeScriptThemePath() {
|
|
29
|
-
return _path.default.resolve(__dirname, "..", "src", "theme");
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
configureWebpack() {
|
|
33
|
-
return {
|
|
34
|
-
plugins: [new _webpack.ProvidePlugin({
|
|
35
|
-
Buffer: [require.resolve("buffer/"), "Buffer"],
|
|
36
|
-
process: require.resolve("process/browser")
|
|
37
|
-
})],
|
|
38
|
-
resolve: {
|
|
39
|
-
fallback: {
|
|
40
|
-
buffer: require.resolve("buffer/"),
|
|
41
|
-
process: require.resolve("process/browser")
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createDescription = createDescription;
|
|
7
|
-
|
|
8
|
-
/* ============================================================================
|
|
9
|
-
* Copyright (c) Palo Alto Networks
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
* ========================================================================== */
|
|
14
|
-
function createDescription(description) {
|
|
15
|
-
if (!description) {
|
|
16
|
-
return "";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return `\n\n${description}\n\n`;
|
|
20
|
-
}
|
package/lib/markdown/schema.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getQualifierMessage = getQualifierMessage;
|
|
7
|
-
exports.getSchemaName = getSchemaName;
|
|
8
|
-
|
|
9
|
-
/* ============================================================================
|
|
10
|
-
* Copyright (c) Palo Alto Networks
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the MIT license found in the
|
|
13
|
-
* LICENSE file in the root directory of this source tree.
|
|
14
|
-
* ========================================================================== */
|
|
15
|
-
function prettyName(schema, circular) {
|
|
16
|
-
var _schema$title;
|
|
17
|
-
|
|
18
|
-
if (schema.$ref) {
|
|
19
|
-
return schema.$ref.replace("#/components/schemas/", "") + circular ? " (circular)" : "";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (schema.format) {
|
|
23
|
-
return schema.format;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (schema.allOf) {
|
|
27
|
-
return "object";
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (schema.type === "object") {
|
|
31
|
-
var _schema$xml$name, _schema$xml;
|
|
32
|
-
|
|
33
|
-
return (_schema$xml$name = (_schema$xml = schema.xml) === null || _schema$xml === void 0 ? void 0 : _schema$xml.name) !== null && _schema$xml$name !== void 0 ? _schema$xml$name : schema.type;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return (_schema$title = schema.title) !== null && _schema$title !== void 0 ? _schema$title : schema.type;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function getSchemaName(schema, circular) {
|
|
40
|
-
var _prettyName;
|
|
41
|
-
|
|
42
|
-
if (schema.items) {
|
|
43
|
-
return prettyName(schema.items, circular) + "[]";
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return (_prettyName = prettyName(schema, circular)) !== null && _prettyName !== void 0 ? _prettyName : "";
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function getQualifierMessage(schema) {
|
|
50
|
-
// TODO:
|
|
51
|
-
// - maxItems
|
|
52
|
-
// - minItems
|
|
53
|
-
// - uniqueItems
|
|
54
|
-
// - maxProperties
|
|
55
|
-
// - minProperties
|
|
56
|
-
// - multipleOf
|
|
57
|
-
if (!schema) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (schema.items) {
|
|
62
|
-
return getQualifierMessage(schema.items);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
let message = "**Possible values:** ";
|
|
66
|
-
let qualifierGroups = [];
|
|
67
|
-
|
|
68
|
-
if (schema.minLength || schema.maxLength) {
|
|
69
|
-
let lengthQualifier = "";
|
|
70
|
-
|
|
71
|
-
if (schema.minLength) {
|
|
72
|
-
lengthQualifier += `${schema.minLength} ≤ `;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
lengthQualifier += "length";
|
|
76
|
-
|
|
77
|
-
if (schema.maxLength) {
|
|
78
|
-
lengthQualifier += ` ≤ ${schema.maxLength}`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
qualifierGroups.push(lengthQualifier);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (schema.minimum || schema.maximum || typeof schema.exclusiveMinimum === "number" || typeof schema.exclusiveMaximum === "number") {
|
|
85
|
-
let minmaxQualifier = "";
|
|
86
|
-
|
|
87
|
-
if (typeof schema.exclusiveMinimum === "number") {
|
|
88
|
-
minmaxQualifier += `${schema.exclusiveMinimum} < `;
|
|
89
|
-
} else if (schema.minimum && !schema.exclusiveMinimum) {
|
|
90
|
-
minmaxQualifier += `${schema.minimum} ≤ `;
|
|
91
|
-
} else if (schema.minimum && schema.exclusiveMinimum === true) {
|
|
92
|
-
minmaxQualifier += `${schema.minimum} < `;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
minmaxQualifier += "value";
|
|
96
|
-
|
|
97
|
-
if (typeof schema.exclusiveMaximum === "number") {
|
|
98
|
-
minmaxQualifier += ` < ${schema.exclusiveMaximum}`;
|
|
99
|
-
} else if (schema.maximum && !schema.exclusiveMaximum) {
|
|
100
|
-
minmaxQualifier += ` ≤ ${schema.maximum}`;
|
|
101
|
-
} else if (schema.maximum && schema.exclusiveMaximum === true) {
|
|
102
|
-
minmaxQualifier += ` < ${schema.maximum}`;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
qualifierGroups.push(minmaxQualifier);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (schema.pattern) {
|
|
109
|
-
qualifierGroups.push(`Value must match regular expression \`${schema.pattern}\``);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (schema.enum) {
|
|
113
|
-
qualifierGroups.push(`[${schema.enum.map(e => `\`${e}\``).join(", ")}]`);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (qualifierGroups.length === 0) {
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return message + qualifierGroups.join(", ");
|
|
121
|
-
}
|
package/lib/markdown/utils.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.create = create;
|
|
7
|
-
exports.guard = guard;
|
|
8
|
-
exports.render = render;
|
|
9
|
-
|
|
10
|
-
/* ============================================================================
|
|
11
|
-
* Copyright (c) Palo Alto Networks
|
|
12
|
-
*
|
|
13
|
-
* This source code is licensed under the MIT license found in the
|
|
14
|
-
* LICENSE file in the root directory of this source tree.
|
|
15
|
-
* ========================================================================== */
|
|
16
|
-
function create(tag, props) {
|
|
17
|
-
const {
|
|
18
|
-
children,
|
|
19
|
-
...rest
|
|
20
|
-
} = props;
|
|
21
|
-
let propString = "";
|
|
22
|
-
|
|
23
|
-
for (const [key, value] of Object.entries(rest)) {
|
|
24
|
-
propString += ` ${key}={${JSON.stringify(value)}}`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return `<${tag}${propString}>${render(children)}</${tag}>`;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function guard(value, cb) {
|
|
31
|
-
if (value) {
|
|
32
|
-
const children = cb(value);
|
|
33
|
-
return render(children);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return "";
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function render(children) {
|
|
40
|
-
if (Array.isArray(children)) {
|
|
41
|
-
return children.filter(c => c !== undefined).join("");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return children !== null && children !== void 0 ? children : "";
|
|
45
|
-
}
|
|
@@ -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 "@paloaltonetworks/postman-code-generators";
|
|
@@ -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 "react-magic-dropzone";
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
var _hooks = require("../hooks");
|
|
11
|
-
|
|
12
|
-
var _FormItem = _interopRequireDefault(require("./../FormItem"));
|
|
13
|
-
|
|
14
|
-
var _FormSelect = _interopRequireDefault(require("./../FormSelect"));
|
|
15
|
-
|
|
16
|
-
var _slice = require("./slice");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
/* ============================================================================
|
|
21
|
-
* Copyright (c) Palo Alto Networks
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
* ========================================================================== */
|
|
26
|
-
function Accept() {
|
|
27
|
-
const value = (0, _hooks.useTypedSelector)(state => state.accept.value);
|
|
28
|
-
const options = (0, _hooks.useTypedSelector)(state => state.accept.options);
|
|
29
|
-
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
30
|
-
|
|
31
|
-
if (options.length <= 1) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return <_FormItem.default label="Accept">
|
|
36
|
-
<_FormSelect.default value={value} options={options} onChange={e => dispatch((0, _slice.setAccept)(e.target.value))} />
|
|
37
|
-
</_FormItem.default>;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
var _default = Accept;
|
|
41
|
-
exports.default = _default;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.slice = exports.setAccept = exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
-
|
|
10
|
-
/* ============================================================================
|
|
11
|
-
* Copyright (c) Palo Alto Networks
|
|
12
|
-
*
|
|
13
|
-
* This source code is licensed under the MIT license found in the
|
|
14
|
-
* LICENSE file in the root directory of this source tree.
|
|
15
|
-
* ========================================================================== */
|
|
16
|
-
const initialState = {};
|
|
17
|
-
const slice = (0, _toolkit.createSlice)({
|
|
18
|
-
name: "accept",
|
|
19
|
-
initialState,
|
|
20
|
-
reducers: {
|
|
21
|
-
setAccept: (state, action) => {
|
|
22
|
-
state.value = action.payload;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
exports.slice = slice;
|
|
27
|
-
const {
|
|
28
|
-
setAccept
|
|
29
|
-
} = slice.actions;
|
|
30
|
-
exports.setAccept = setAccept;
|
|
31
|
-
var _default = slice.reducer;
|
|
32
|
-
exports.default = _default;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getAuthDataKeys = getAuthDataKeys;
|
|
7
|
-
|
|
8
|
-
/* ============================================================================
|
|
9
|
-
* Copyright (c) Palo Alto Networks
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
* ========================================================================== */
|
|
14
|
-
function getAuthDataKeys(security) {
|
|
15
|
-
// Bearer Auth
|
|
16
|
-
if (security.type === "http" && security.scheme === "bearer") {
|
|
17
|
-
return ["token"];
|
|
18
|
-
} // Basic Auth
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (security.type === "http" && security.scheme === "basic") {
|
|
22
|
-
return ["username", "password"];
|
|
23
|
-
} // API Auth
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (security.type === "apiKey") {
|
|
27
|
-
return ["apiKey"];
|
|
28
|
-
} // none
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
|
-
|
|
12
|
-
var _FormItem = _interopRequireDefault(require("../FormItem"));
|
|
13
|
-
|
|
14
|
-
var _FormSelect = _interopRequireDefault(require("../FormSelect"));
|
|
15
|
-
|
|
16
|
-
var _FormTextInput = _interopRequireDefault(require("../FormTextInput"));
|
|
17
|
-
|
|
18
|
-
var _hooks = require("../hooks");
|
|
19
|
-
|
|
20
|
-
var _stylesModule = _interopRequireDefault(require("../styles.module.css"));
|
|
21
|
-
|
|
22
|
-
var _slice = require("./slice");
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
|
|
26
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
-
|
|
30
|
-
/* ============================================================================
|
|
31
|
-
* Copyright (c) Palo Alto Networks
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the MIT license found in the
|
|
34
|
-
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
* ========================================================================== */
|
|
36
|
-
function LockButton({
|
|
37
|
-
mode,
|
|
38
|
-
children,
|
|
39
|
-
style,
|
|
40
|
-
...rest
|
|
41
|
-
}) {
|
|
42
|
-
return <button className={(0, _clsx.default)("button", "button--primary", {
|
|
43
|
-
"button--outline": mode !== "locked"
|
|
44
|
-
})} style={{
|
|
45
|
-
marginLeft: "auto",
|
|
46
|
-
display: "flex",
|
|
47
|
-
alignItems: "center",
|
|
48
|
-
marginBottom: "var(--ifm-spacing-vertical)",
|
|
49
|
-
...style
|
|
50
|
-
}} {...rest}>
|
|
51
|
-
<span>{children}</span>
|
|
52
|
-
|
|
53
|
-
<svg style={{
|
|
54
|
-
marginLeft: "12px",
|
|
55
|
-
width: "18px",
|
|
56
|
-
height: "18px",
|
|
57
|
-
fill: "currentColor"
|
|
58
|
-
}} viewBox="0 0 20 20" id={mode}>
|
|
59
|
-
{mode === "locked" ? <path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"></path> : <path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>}
|
|
60
|
-
</svg>
|
|
61
|
-
</button>;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function validateData(selectedAuth, data) {
|
|
65
|
-
for (const scheme of selectedAuth) {
|
|
66
|
-
if (data[scheme.key] === undefined) {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const hasMissingKeys = Object.values(data[scheme.key]).includes(undefined);
|
|
71
|
-
|
|
72
|
-
if (hasMissingKeys) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function Authorization() {
|
|
81
|
-
const [editing, setEditing] = (0, _react.useState)(false);
|
|
82
|
-
const data = (0, _hooks.useTypedSelector)(state => state.auth.data);
|
|
83
|
-
const options = (0, _hooks.useTypedSelector)(state => state.auth.options);
|
|
84
|
-
const selected = (0, _hooks.useTypedSelector)(state => state.auth.selected);
|
|
85
|
-
const dispatch = (0, _hooks.useTypedDispatch)();
|
|
86
|
-
|
|
87
|
-
if (selected === undefined) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const selectedAuth = options[selected];
|
|
92
|
-
const authenticated = validateData(selectedAuth, data);
|
|
93
|
-
const optionKeys = Object.keys(options);
|
|
94
|
-
|
|
95
|
-
if (editing) {
|
|
96
|
-
return <div className={_stylesModule.default.optionsPanel}>
|
|
97
|
-
{optionKeys.length > 1 && <_FormItem.default label="Security Scheme">
|
|
98
|
-
<_FormSelect.default options={optionKeys} value={selected} onChange={e => {
|
|
99
|
-
dispatch((0, _slice.setSelectedAuth)(e.target.value));
|
|
100
|
-
}} />
|
|
101
|
-
</_FormItem.default>}
|
|
102
|
-
{selectedAuth.map(a => {
|
|
103
|
-
if (a.type === "http" && a.scheme === "bearer") {
|
|
104
|
-
var _data$a$key$token;
|
|
105
|
-
|
|
106
|
-
return <_FormItem.default label="Bearer Token" key={selected + "-bearer"}>
|
|
107
|
-
<_FormTextInput.default placeholder="Bearer Token" value={(_data$a$key$token = data[a.key].token) !== null && _data$a$key$token !== void 0 ? _data$a$key$token : ""} onChange={e => {
|
|
108
|
-
const value = e.target.value.trim();
|
|
109
|
-
dispatch((0, _slice.setAuthData)({
|
|
110
|
-
scheme: a.key,
|
|
111
|
-
key: "token",
|
|
112
|
-
value: value ? value : undefined
|
|
113
|
-
}));
|
|
114
|
-
}} />
|
|
115
|
-
</_FormItem.default>;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (a.type === "http" && a.scheme === "basic") {
|
|
119
|
-
var _data$a$key$username, _data$a$key$password;
|
|
120
|
-
|
|
121
|
-
return <_react.default.Fragment key={selected + "-basic"}>
|
|
122
|
-
<_FormItem.default label="Username">
|
|
123
|
-
<_FormTextInput.default placeholder="Username" value={(_data$a$key$username = data[a.key].username) !== null && _data$a$key$username !== void 0 ? _data$a$key$username : ""} onChange={e => {
|
|
124
|
-
const value = e.target.value.trim();
|
|
125
|
-
dispatch((0, _slice.setAuthData)({
|
|
126
|
-
scheme: a.key,
|
|
127
|
-
key: "username",
|
|
128
|
-
value: value ? value : undefined
|
|
129
|
-
}));
|
|
130
|
-
}} />
|
|
131
|
-
</_FormItem.default>
|
|
132
|
-
<_FormItem.default label="Password">
|
|
133
|
-
<_FormTextInput.default placeholder="Password" password value={(_data$a$key$password = data[a.key].password) !== null && _data$a$key$password !== void 0 ? _data$a$key$password : ""} onChange={e => {
|
|
134
|
-
const value = e.target.value.trim();
|
|
135
|
-
dispatch((0, _slice.setAuthData)({
|
|
136
|
-
scheme: a.key,
|
|
137
|
-
key: "password",
|
|
138
|
-
value: value ? value : undefined
|
|
139
|
-
}));
|
|
140
|
-
}} />
|
|
141
|
-
</_FormItem.default>
|
|
142
|
-
</_react.default.Fragment>;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return null;
|
|
146
|
-
})}
|
|
147
|
-
<LockButton mode="unlocked" style={{
|
|
148
|
-
marginTop: "var(--ifm-spacing-vertical)",
|
|
149
|
-
marginBottom: 0
|
|
150
|
-
}} onClick={() => {
|
|
151
|
-
setEditing(false);
|
|
152
|
-
}}>
|
|
153
|
-
Save
|
|
154
|
-
</LockButton>
|
|
155
|
-
</div>;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (authenticated) {
|
|
159
|
-
return <LockButton mode="locked" onClick={() => {
|
|
160
|
-
setEditing(true);
|
|
161
|
-
}}>
|
|
162
|
-
Authorized
|
|
163
|
-
</LockButton>;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return <LockButton mode="unlocked" onClick={() => {
|
|
167
|
-
setEditing(true);
|
|
168
|
-
}}>
|
|
169
|
-
Authorize
|
|
170
|
-
</LockButton>;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
var _default = Authorization;
|
|
174
|
-
exports.default = _default;
|