fumadocs-openapi 10.6.6 → 10.6.8
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/css/generated/shared.css +29 -5
- package/dist/_virtual/_rolldown/runtime.js +2 -1
- package/dist/i18n.d.ts +2 -1
- package/dist/i18n.js +5 -3
- package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +108 -0
- package/dist/node_modules/.pnpm/fast-content-type-parse@3.0.0/node_modules/fast-content-type-parse/index.js +115 -0
- package/dist/playground/client.d.ts +3 -11
- package/dist/playground/client.js +3 -37
- package/dist/playground/components/inputs.js +2 -2
- package/dist/playground/components/oauth-dialog.js +18 -12
- package/dist/playground/components/result-display.d.ts +16 -0
- package/dist/playground/components/result-display.js +142 -0
- package/dist/playground/components/server-select.js +1 -1
- package/dist/playground/fetcher.d.ts +9 -3
- package/dist/playground/fetcher.js +7 -18
- package/dist/playground/schema.js +1 -1
- package/dist/playground/status-info.js +27 -23
- package/dist/scalar/client.js +14 -23
- package/dist/ui/base.js +1 -1
- package/dist/ui/client/i18n.js +6 -4
- package/dist/ui/components/dialog.js +1 -1
- package/dist/ui/operation/client.js +1 -1
- package/dist/ui/operation/get-example-requests.js +1 -1
- package/dist/ui/operation/index.js +1 -1
- package/dist/ui/operation/request-tabs.js +1 -1
- package/dist/ui/operation/response-tabs.js +1 -1
- package/dist/ui/operation/usage-tabs/client.js +1 -1
- package/dist/ui/schema/client.js +2 -2
- package/dist/ui/schema/index.js +1 -1
- package/dist/utils/schema/sample.js +442 -0
- package/package.json +18 -16
package/css/generated/shared.css
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
@source inline("allFlows");
|
|
46
46
|
@source inline("allOf");
|
|
47
47
|
@source inline("already");
|
|
48
|
+
@source inline("alt");
|
|
48
49
|
@source inline("and");
|
|
49
50
|
@source inline("animate-spin");
|
|
50
51
|
@source inline("another");
|
|
@@ -54,8 +55,11 @@
|
|
|
54
55
|
@source inline("apiExample");
|
|
55
56
|
@source inline("apiKey");
|
|
56
57
|
@source inline("apiPlayground");
|
|
58
|
+
@source inline("application/javascript");
|
|
57
59
|
@source inline("application/json");
|
|
60
|
+
@source inline("application/x-javascript");
|
|
58
61
|
@source inline("application/x-www-form-urlencoded");
|
|
62
|
+
@source inline("application/xml");
|
|
59
63
|
@source inline("apply");
|
|
60
64
|
@source inline("aria-label");
|
|
61
65
|
@source inline("array");
|
|
@@ -96,6 +100,7 @@
|
|
|
96
100
|
@source inline("bg-fd-primary/10");
|
|
97
101
|
@source inline("bg-fd-secondary");
|
|
98
102
|
@source inline("binary");
|
|
103
|
+
@source inline("blob");
|
|
99
104
|
@source inline("blue");
|
|
100
105
|
@source inline("body");
|
|
101
106
|
@source inline("bodyMediaType");
|
|
@@ -105,6 +110,7 @@
|
|
|
105
110
|
@source inline("border");
|
|
106
111
|
@source inline("border-b");
|
|
107
112
|
@source inline("border-current");
|
|
113
|
+
@source inline("border-fd-border");
|
|
108
114
|
@source inline("border-fd-primary/20");
|
|
109
115
|
@source inline("border-s");
|
|
110
116
|
@source inline("border-t");
|
|
@@ -112,11 +118,13 @@
|
|
|
112
118
|
@source inline("border-y");
|
|
113
119
|
@source inline("both");
|
|
114
120
|
@source inline("boundary");
|
|
121
|
+
@source inline("buffer");
|
|
115
122
|
@source inline("bundled");
|
|
116
123
|
@source inline("but");
|
|
117
124
|
@source inline("button");
|
|
118
125
|
@source inline("buttonVariants");
|
|
119
126
|
@source inline("by");
|
|
127
|
+
@source inline("byteLength");
|
|
120
128
|
@source inline("cache");
|
|
121
129
|
@source inline("cached");
|
|
122
130
|
@source inline("call");
|
|
@@ -129,6 +137,7 @@
|
|
|
129
137
|
@source inline("causes");
|
|
130
138
|
@source inline("change");
|
|
131
139
|
@source inline("changes");
|
|
140
|
+
@source inline("charset");
|
|
132
141
|
@source inline("check");
|
|
133
142
|
@source inline("child");
|
|
134
143
|
@source inline("children");
|
|
@@ -142,6 +151,7 @@
|
|
|
142
151
|
@source inline("clientId");
|
|
143
152
|
@source inline("clientSecret");
|
|
144
153
|
@source inline("client_credentials");
|
|
154
|
+
@source inline("client_error");
|
|
145
155
|
@source inline("client_id");
|
|
146
156
|
@source inline("client_secret");
|
|
147
157
|
@source inline("cloned");
|
|
@@ -178,6 +188,7 @@
|
|
|
178
188
|
@source inline("createRehypeCode");
|
|
179
189
|
@source inline("credentials");
|
|
180
190
|
@source inline("css");
|
|
191
|
+
@source inline("csv");
|
|
181
192
|
@source inline("ctx");
|
|
182
193
|
@source inline("current");
|
|
183
194
|
@source inline("currentRef");
|
|
@@ -278,8 +289,10 @@
|
|
|
278
289
|
@source inline("export");
|
|
279
290
|
@source inline("extends");
|
|
280
291
|
@source inline("factory");
|
|
292
|
+
@source inline("fall");
|
|
281
293
|
@source inline("fallback");
|
|
282
294
|
@source inline("false");
|
|
295
|
+
@source inline("fast-content-type-parse");
|
|
283
296
|
@source inline("fetch");
|
|
284
297
|
@source inline("fetchOptions");
|
|
285
298
|
@source inline("fetcher");
|
|
@@ -324,6 +337,7 @@
|
|
|
324
337
|
@source inline("font-semibold");
|
|
325
338
|
@source inline("for");
|
|
326
339
|
@source inline("form");
|
|
340
|
+
@source inline("formData");
|
|
327
341
|
@source inline("format");
|
|
328
342
|
@source inline("forwardRef");
|
|
329
343
|
@source inline("found");
|
|
@@ -364,7 +378,6 @@
|
|
|
364
378
|
@source inline("getExampleRequests");
|
|
365
379
|
@source inline("getSchema");
|
|
366
380
|
@source inline("getSchemaId");
|
|
367
|
-
@source inline("getStatusInfo");
|
|
368
381
|
@source inline("ghost");
|
|
369
382
|
@source inline("github-dark");
|
|
370
383
|
@source inline("github-light");
|
|
@@ -454,6 +467,7 @@
|
|
|
454
467
|
@source inline("items-end");
|
|
455
468
|
@source inline("items-start");
|
|
456
469
|
@source inline("j");
|
|
470
|
+
@source inline("js");
|
|
457
471
|
@source inline("json");
|
|
458
472
|
@source inline("json-schema-typed");
|
|
459
473
|
@source inline("justify-between");
|
|
@@ -510,6 +524,7 @@
|
|
|
510
524
|
@source inline("metaData");
|
|
511
525
|
@source inline("method");
|
|
512
526
|
@source inline("migrated");
|
|
527
|
+
@source inline("mime");
|
|
513
528
|
@source inline("min");
|
|
514
529
|
@source inline("min-h-(--initial-height,0)");
|
|
515
530
|
@source inline("min-w-0");
|
|
@@ -577,7 +592,6 @@
|
|
|
577
592
|
@source inline("openApiData");
|
|
578
593
|
@source inline("openIdConnect");
|
|
579
594
|
@source inline("openapi");
|
|
580
|
-
@source inline("openapi-sampler");
|
|
581
595
|
@source inline("openapi-types");
|
|
582
596
|
@source inline("openid");
|
|
583
597
|
@source inline("operation");
|
|
@@ -606,6 +620,7 @@
|
|
|
606
620
|
@source inline("page-level");
|
|
607
621
|
@source inline("pageData");
|
|
608
622
|
@source inline("pages");
|
|
623
|
+
@source inline("panelVariants");
|
|
609
624
|
@source inline("param");
|
|
610
625
|
@source inline("paramTypeKeys");
|
|
611
626
|
@source inline("parameter");
|
|
@@ -693,7 +708,6 @@
|
|
|
693
708
|
@source inline("raw");
|
|
694
709
|
@source inline("rawSearch");
|
|
695
710
|
@source inline("react");
|
|
696
|
-
@source inline("react-hook-form");
|
|
697
711
|
@source inline("react-hooks/exhaustive-deps");
|
|
698
712
|
@source inline("react/jsx-runtime");
|
|
699
713
|
@source inline("read");
|
|
@@ -776,6 +790,7 @@
|
|
|
776
790
|
@source inline("rounded-xl");
|
|
777
791
|
@source inline("route");
|
|
778
792
|
@source inline("s");
|
|
793
|
+
@source inline("safeParse");
|
|
779
794
|
@source inline("same");
|
|
780
795
|
@source inline("sample");
|
|
781
796
|
@source inline("sampleKey");
|
|
@@ -837,6 +852,7 @@
|
|
|
837
852
|
@source inline("setIsMounted");
|
|
838
853
|
@source inline("setMounted");
|
|
839
854
|
@source inline("setNextName");
|
|
855
|
+
@source inline("setObjectUrl");
|
|
840
856
|
@source inline("setOpen");
|
|
841
857
|
@source inline("setPath");
|
|
842
858
|
@source inline("setRequirementId");
|
|
@@ -886,6 +902,7 @@
|
|
|
886
902
|
@source inline("source");
|
|
887
903
|
@source inline("spec");
|
|
888
904
|
@source inline("specify");
|
|
905
|
+
@source inline("src");
|
|
889
906
|
@source inline("state");
|
|
890
907
|
@source inline("status");
|
|
891
908
|
@source inline("statusBadRequest");
|
|
@@ -949,13 +966,17 @@
|
|
|
949
966
|
@source inline("text-start");
|
|
950
967
|
@source inline("text-xs");
|
|
951
968
|
@source inline("text-yellow-600");
|
|
969
|
+
@source inline("text/css");
|
|
970
|
+
@source inline("text/csv");
|
|
952
971
|
@source inline("text/html");
|
|
972
|
+
@source inline("text/plain");
|
|
953
973
|
@source inline("that");
|
|
954
974
|
@source inline("the");
|
|
955
975
|
@source inline("their");
|
|
956
976
|
@source inline("theme");
|
|
957
977
|
@source inline("themes");
|
|
958
978
|
@source inline("this");
|
|
979
|
+
@source inline("through");
|
|
959
980
|
@source inline("throw");
|
|
960
981
|
@source inline("timeout");
|
|
961
982
|
@source inline("timerRef");
|
|
@@ -1015,12 +1036,11 @@
|
|
|
1015
1036
|
@source inline("usageTabs");
|
|
1016
1037
|
@source inline("usages");
|
|
1017
1038
|
@source inline("use");
|
|
1018
|
-
@source inline("
|
|
1039
|
+
@source inline("useApiClient");
|
|
1019
1040
|
@source inline("useApiContext");
|
|
1020
1041
|
@source inline("useAuth");
|
|
1021
1042
|
@source inline("useCopyButton");
|
|
1022
1043
|
@source inline("useFieldValue");
|
|
1023
|
-
@source inline("useForm");
|
|
1024
1044
|
@source inline("useI18n");
|
|
1025
1045
|
@source inline("useMemo");
|
|
1026
1046
|
@source inline("useNamespace");
|
|
@@ -1032,6 +1052,7 @@
|
|
|
1032
1052
|
@source inline("useResolvedSchema");
|
|
1033
1053
|
@source inline("useServerContext");
|
|
1034
1054
|
@source inline("useState");
|
|
1055
|
+
@source inline("useStatusInfo");
|
|
1035
1056
|
@source inline("useStf");
|
|
1036
1057
|
@source inline("useStorageKey");
|
|
1037
1058
|
@source inline("useTheme");
|
|
@@ -1040,6 +1061,7 @@
|
|
|
1040
1061
|
@source inline("used");
|
|
1041
1062
|
@source inline("username");
|
|
1042
1063
|
@source inline("using");
|
|
1064
|
+
@source inline("utf-8");
|
|
1043
1065
|
@source inline("valid");
|
|
1044
1066
|
@source inline("validateFormats");
|
|
1045
1067
|
@source inline("validateSchema");
|
|
@@ -1069,6 +1091,7 @@
|
|
|
1069
1091
|
@source inline("window");
|
|
1070
1092
|
@source inline("with");
|
|
1071
1093
|
@source inline("withBase");
|
|
1094
|
+
@source inline("withReplacements");
|
|
1072
1095
|
@source inline("without");
|
|
1073
1096
|
@source inline("wrap");
|
|
1074
1097
|
@source inline("wrap-break-word");
|
|
@@ -1082,6 +1105,7 @@
|
|
|
1082
1105
|
@source inline("x-exclusiveCodeSample");
|
|
1083
1106
|
@source inline("x-playground-lazy");
|
|
1084
1107
|
@source inline("x-selectedCodeSample");
|
|
1108
|
+
@source inline("xml");
|
|
1085
1109
|
@source inline("yellow");
|
|
1086
1110
|
@source inline("you");
|
|
1087
1111
|
@source inline("your");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
3
4
|
var __exportAll = (all, no_symbols) => {
|
|
4
5
|
let target = {};
|
|
5
6
|
for (var name in all) __defProp(target, name, {
|
|
@@ -10,4 +11,4 @@ var __exportAll = (all, no_symbols) => {
|
|
|
10
11
|
return target;
|
|
11
12
|
};
|
|
12
13
|
//#endregion
|
|
13
|
-
export { __exportAll };
|
|
14
|
+
export { __commonJSMin, __exportAll };
|
package/dist/i18n.d.ts
CHANGED
|
@@ -57,7 +57,8 @@ declare const defaultTranslations: {
|
|
|
57
57
|
statusInternalServerError: string;
|
|
58
58
|
statusSuccessful: string;
|
|
59
59
|
statusError: string;
|
|
60
|
-
|
|
60
|
+
statusClientError: string;
|
|
61
|
+
statusBinaryBody: string;
|
|
61
62
|
obtainAccessToken: string;
|
|
62
63
|
resourceOwnerPassword: string;
|
|
63
64
|
resourceOwnerPasswordDesc: string;
|
package/dist/i18n.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { require_deepmerge } from "./node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js";
|
|
2
2
|
//#region src/i18n.ts
|
|
3
|
+
var import_deepmerge = require_deepmerge();
|
|
3
4
|
const defaultTranslations = {
|
|
4
5
|
loading: "loading...",
|
|
5
6
|
empty: "Empty",
|
|
@@ -56,7 +57,8 @@ const defaultTranslations = {
|
|
|
56
57
|
statusInternalServerError: "Internal Server Error",
|
|
57
58
|
statusSuccessful: "Successful",
|
|
58
59
|
statusError: "Error",
|
|
59
|
-
|
|
60
|
+
statusClientError: "Client Error",
|
|
61
|
+
statusBinaryBody: "Binary response body, {length} bytes",
|
|
60
62
|
obtainAccessToken: "Obtain the access token for API.",
|
|
61
63
|
resourceOwnerPassword: "Resource Owner Password Flow",
|
|
62
64
|
resourceOwnerPasswordDesc: "Authenticate using username and password.",
|
|
@@ -94,7 +96,7 @@ const defaultTranslations = {
|
|
|
94
96
|
playgroundInputUnset: "Unset"
|
|
95
97
|
};
|
|
96
98
|
function defineI18nOpenAPI(config, translations) {
|
|
97
|
-
const dm = deepmerge();
|
|
99
|
+
const dm = (0, import_deepmerge.deepmerge)();
|
|
98
100
|
return {
|
|
99
101
|
...config,
|
|
100
102
|
provider(locale = config.defaultLanguage) {
|
package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@fastify+deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js
|
|
3
|
+
var require_deepmerge = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
const JSON_PROTO = Object.getPrototypeOf({});
|
|
5
|
+
function defaultIsMergeableObjectFactory() {
|
|
6
|
+
return function defaultIsMergeableObject(value) {
|
|
7
|
+
return typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Date);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function deepmergeConstructor(options) {
|
|
11
|
+
function isNotPrototypeKey(value) {
|
|
12
|
+
return value !== "constructor" && value !== "prototype" && value !== "__proto__";
|
|
13
|
+
}
|
|
14
|
+
function cloneArray(value) {
|
|
15
|
+
let i = 0;
|
|
16
|
+
const il = value.length;
|
|
17
|
+
const result = new Array(il);
|
|
18
|
+
for (; i < il; ++i) result[i] = clone(value[i]);
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
function cloneObject(target) {
|
|
22
|
+
const result = {};
|
|
23
|
+
if (cloneProtoObject && Object.getPrototypeOf(target) !== JSON_PROTO) return cloneProtoObject(target);
|
|
24
|
+
const targetKeys = getKeys(target);
|
|
25
|
+
let i, il, key;
|
|
26
|
+
for (i = 0, il = targetKeys.length; i < il; ++i) isNotPrototypeKey(key = targetKeys[i]) && (result[key] = clone(target[key]));
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
function concatArrays(target, source) {
|
|
30
|
+
const tl = target.length;
|
|
31
|
+
const sl = source.length;
|
|
32
|
+
let i = 0;
|
|
33
|
+
const result = new Array(tl + sl);
|
|
34
|
+
for (; i < tl; ++i) result[i] = clone(target[i]);
|
|
35
|
+
for (i = 0; i < sl; ++i) result[i + tl] = clone(source[i]);
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
const propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
39
|
+
function getSymbolsAndKeys(value) {
|
|
40
|
+
const result = Object.keys(value);
|
|
41
|
+
const keys = Object.getOwnPropertySymbols(value);
|
|
42
|
+
for (let i = 0, il = keys.length; i < il; ++i) propertyIsEnumerable.call(value, keys[i]) && result.push(keys[i]);
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
const getKeys = options?.symbols ? getSymbolsAndKeys : Object.keys;
|
|
46
|
+
const cloneProtoObject = typeof options?.cloneProtoObject === "function" ? options.cloneProtoObject : void 0;
|
|
47
|
+
const isMergeableObject = typeof options?.isMergeableObject === "function" ? options.isMergeableObject : defaultIsMergeableObjectFactory();
|
|
48
|
+
const onlyDefinedProperties = options?.onlyDefinedProperties === true;
|
|
49
|
+
function isPrimitive(value) {
|
|
50
|
+
return typeof value !== "object" || value === null;
|
|
51
|
+
}
|
|
52
|
+
const mergeArray = options && typeof options.mergeArray === "function" ? options.mergeArray({
|
|
53
|
+
clone,
|
|
54
|
+
deepmerge: _deepmerge,
|
|
55
|
+
getKeys,
|
|
56
|
+
isMergeableObject
|
|
57
|
+
}) : concatArrays;
|
|
58
|
+
function clone(entry) {
|
|
59
|
+
return isMergeableObject(entry) ? Array.isArray(entry) ? cloneArray(entry) : cloneObject(entry) : entry;
|
|
60
|
+
}
|
|
61
|
+
function mergeObject(target, source) {
|
|
62
|
+
const result = {};
|
|
63
|
+
const targetKeys = getKeys(target);
|
|
64
|
+
const sourceKeys = getKeys(source);
|
|
65
|
+
let i, il, key;
|
|
66
|
+
for (i = 0, il = targetKeys.length; i < il; ++i) isNotPrototypeKey(key = targetKeys[i]) && sourceKeys.indexOf(key) === -1 && (result[key] = clone(target[key]));
|
|
67
|
+
for (i = 0, il = sourceKeys.length; i < il; ++i) {
|
|
68
|
+
if (!isNotPrototypeKey(key = sourceKeys[i])) continue;
|
|
69
|
+
if (key in target) {
|
|
70
|
+
if (targetKeys.indexOf(key) !== -1) if (cloneProtoObject && isMergeableObject(source[key]) && Object.getPrototypeOf(source[key]) !== JSON_PROTO) result[key] = cloneProtoObject(source[key]);
|
|
71
|
+
else result[key] = _deepmerge(target[key], source[key]);
|
|
72
|
+
} else {
|
|
73
|
+
if (onlyDefinedProperties && typeof source[key] === "undefined") continue;
|
|
74
|
+
result[key] = clone(source[key]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
function _deepmerge(target, source) {
|
|
80
|
+
if (onlyDefinedProperties && typeof source === "undefined") return clone(target);
|
|
81
|
+
const sourceIsArray = Array.isArray(source);
|
|
82
|
+
const targetIsArray = Array.isArray(target);
|
|
83
|
+
if (isPrimitive(source)) return source;
|
|
84
|
+
else if (!isMergeableObject(target)) return clone(source);
|
|
85
|
+
else if (sourceIsArray && targetIsArray) return mergeArray(target, source);
|
|
86
|
+
else if (sourceIsArray !== targetIsArray) return clone(source);
|
|
87
|
+
else return mergeObject(target, source);
|
|
88
|
+
}
|
|
89
|
+
function _deepmergeAll() {
|
|
90
|
+
switch (arguments.length) {
|
|
91
|
+
case 0: return {};
|
|
92
|
+
case 1: return clone(arguments[0]);
|
|
93
|
+
case 2: return _deepmerge(arguments[0], arguments[1]);
|
|
94
|
+
}
|
|
95
|
+
let result;
|
|
96
|
+
for (let i = 0, il = arguments.length; i < il; ++i) result = _deepmerge(result, arguments[i]);
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
return options?.all ? _deepmergeAll : _deepmerge;
|
|
100
|
+
}
|
|
101
|
+
module.exports = deepmergeConstructor;
|
|
102
|
+
module.exports.default = deepmergeConstructor;
|
|
103
|
+
module.exports.deepmerge = deepmergeConstructor;
|
|
104
|
+
Object.defineProperty(module.exports, "isMergeableObject", { get: defaultIsMergeableObjectFactory });
|
|
105
|
+
}));
|
|
106
|
+
//#endregion
|
|
107
|
+
export default require_deepmerge();
|
|
108
|
+
export { require_deepmerge };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/fast-content-type-parse@3.0.0/node_modules/fast-content-type-parse/index.js
|
|
3
|
+
var require_fast_content_type_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
const NullObject = function NullObject() {};
|
|
5
|
+
NullObject.prototype = Object.create(null);
|
|
6
|
+
/**
|
|
7
|
+
* RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
|
|
8
|
+
*
|
|
9
|
+
* parameter = token "=" ( token / quoted-string )
|
|
10
|
+
* token = 1*tchar
|
|
11
|
+
* tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
|
|
12
|
+
* / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
|
|
13
|
+
* / DIGIT / ALPHA
|
|
14
|
+
* ; any VCHAR, except delimiters
|
|
15
|
+
* quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
|
|
16
|
+
* qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
|
|
17
|
+
* obs-text = %x80-FF
|
|
18
|
+
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
19
|
+
*/
|
|
20
|
+
const paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
|
|
21
|
+
/**
|
|
22
|
+
* RegExp to match quoted-pair in RFC 7230 sec 3.2.6
|
|
23
|
+
*
|
|
24
|
+
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
25
|
+
* obs-text = %x80-FF
|
|
26
|
+
*/
|
|
27
|
+
const quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
|
|
28
|
+
/**
|
|
29
|
+
* RegExp to match type in RFC 7231 sec 3.1.1.1
|
|
30
|
+
*
|
|
31
|
+
* media-type = type "/" subtype
|
|
32
|
+
* type = token
|
|
33
|
+
* subtype = token
|
|
34
|
+
*/
|
|
35
|
+
const mediaTypeRE = /^[!#$%&'*+.^\w|~-]+\/[!#$%&'*+.^\w|~-]+$/u;
|
|
36
|
+
const defaultContentType = {
|
|
37
|
+
type: "",
|
|
38
|
+
parameters: new NullObject()
|
|
39
|
+
};
|
|
40
|
+
Object.freeze(defaultContentType.parameters);
|
|
41
|
+
Object.freeze(defaultContentType);
|
|
42
|
+
/**
|
|
43
|
+
* Parse media type to object.
|
|
44
|
+
*
|
|
45
|
+
* @param {string|object} header
|
|
46
|
+
* @return {Object}
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
function parse(header) {
|
|
50
|
+
if (typeof header !== "string") throw new TypeError("argument header is required and must be a string");
|
|
51
|
+
let index = header.indexOf(";");
|
|
52
|
+
const type = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
53
|
+
if (mediaTypeRE.test(type) === false) throw new TypeError("invalid media type");
|
|
54
|
+
const result = {
|
|
55
|
+
type: type.toLowerCase(),
|
|
56
|
+
parameters: new NullObject()
|
|
57
|
+
};
|
|
58
|
+
if (index === -1) return result;
|
|
59
|
+
let key;
|
|
60
|
+
let match;
|
|
61
|
+
let value;
|
|
62
|
+
paramRE.lastIndex = index;
|
|
63
|
+
while (match = paramRE.exec(header)) {
|
|
64
|
+
if (match.index !== index) throw new TypeError("invalid parameter format");
|
|
65
|
+
index += match[0].length;
|
|
66
|
+
key = match[1].toLowerCase();
|
|
67
|
+
value = match[2];
|
|
68
|
+
if (value[0] === "\"") {
|
|
69
|
+
value = value.slice(1, value.length - 1);
|
|
70
|
+
quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1"));
|
|
71
|
+
}
|
|
72
|
+
result.parameters[key] = value;
|
|
73
|
+
}
|
|
74
|
+
if (index !== header.length) throw new TypeError("invalid parameter format");
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
function safeParse(header) {
|
|
78
|
+
if (typeof header !== "string") return defaultContentType;
|
|
79
|
+
let index = header.indexOf(";");
|
|
80
|
+
const type = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
81
|
+
if (mediaTypeRE.test(type) === false) return defaultContentType;
|
|
82
|
+
const result = {
|
|
83
|
+
type: type.toLowerCase(),
|
|
84
|
+
parameters: new NullObject()
|
|
85
|
+
};
|
|
86
|
+
if (index === -1) return result;
|
|
87
|
+
let key;
|
|
88
|
+
let match;
|
|
89
|
+
let value;
|
|
90
|
+
paramRE.lastIndex = index;
|
|
91
|
+
while (match = paramRE.exec(header)) {
|
|
92
|
+
if (match.index !== index) return defaultContentType;
|
|
93
|
+
index += match[0].length;
|
|
94
|
+
key = match[1].toLowerCase();
|
|
95
|
+
value = match[2];
|
|
96
|
+
if (value[0] === "\"") {
|
|
97
|
+
value = value.slice(1, value.length - 1);
|
|
98
|
+
quotedPairRE.test(value) && (value = value.replace(quotedPairRE, "$1"));
|
|
99
|
+
}
|
|
100
|
+
result.parameters[key] = value;
|
|
101
|
+
}
|
|
102
|
+
if (index !== header.length) return defaultContentType;
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
module.exports.default = {
|
|
106
|
+
parse,
|
|
107
|
+
safeParse
|
|
108
|
+
};
|
|
109
|
+
module.exports.parse = parse;
|
|
110
|
+
module.exports.safeParse = safeParse;
|
|
111
|
+
module.exports.defaultContentType = defaultContentType;
|
|
112
|
+
}));
|
|
113
|
+
//#endregion
|
|
114
|
+
export default require_fast_content_type_parse();
|
|
115
|
+
export { require_fast_content_type_parse };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BrowserFetcherOptions
|
|
1
|
+
import { BrowserFetcherOptions } from "./fetcher.js";
|
|
2
|
+
import { DefaultResultDisplay, ResultDisplayProps } from "./components/result-display.js";
|
|
2
3
|
import { SchemaScope } from "./schema.js";
|
|
3
4
|
import { Document, HttpMethods, ParameterObject } from "../types.js";
|
|
4
5
|
import { ParsedSchema, SecurityEntry } from "../utils/schema/index.js";
|
|
@@ -23,10 +24,6 @@ interface PlaygroundClientProps extends ComponentProps<'form'>, SchemaScope {
|
|
|
23
24
|
doc: Document;
|
|
24
25
|
proxyUrl?: string;
|
|
25
26
|
}
|
|
26
|
-
interface ResultDisplayProps extends ComponentProps<'div'> {
|
|
27
|
-
data: FetchResult;
|
|
28
|
-
reset: () => void;
|
|
29
|
-
}
|
|
30
27
|
interface CollapsiblePanelProps extends Omit<ComponentProps<typeof Collapsible>, 'title'> {
|
|
31
28
|
'data-type': 'authorization' | 'body' | ParamType;
|
|
32
29
|
title: ReactNode;
|
|
@@ -86,11 +83,6 @@ interface AuthField {
|
|
|
86
83
|
children: ReactNode;
|
|
87
84
|
mapOutput?: (values: unknown) => unknown;
|
|
88
85
|
}
|
|
89
|
-
declare function DefaultResultDisplay({
|
|
90
|
-
data,
|
|
91
|
-
reset,
|
|
92
|
-
...rest
|
|
93
|
-
}: ResultDisplayProps): _$react_jsx_runtime0.JSX.Element;
|
|
94
86
|
declare function DefaultCollapsiblePanel({
|
|
95
87
|
title,
|
|
96
88
|
children,
|
|
@@ -105,4 +97,4 @@ declare const Custom: {
|
|
|
105
97
|
};
|
|
106
98
|
};
|
|
107
99
|
//#endregion
|
|
108
|
-
export { AuthField, CollapsiblePanelProps, Custom, DefaultCollapsiblePanel, DefaultResultDisplay, FormValues, PlaygroundClientOptions, PlaygroundClientProps, ResultDisplayProps, PlaygroundClient as default };
|
|
100
|
+
export { AuthField, CollapsiblePanelProps, Custom, DefaultCollapsiblePanel, DefaultResultDisplay, FormValues, PlaygroundClientOptions, PlaygroundClientProps, type ResultDisplayProps, PlaygroundClient as default };
|
|
@@ -3,8 +3,9 @@ import { joinURL, resolveRequestData, resolveServerUrl, withBase } from "../util
|
|
|
3
3
|
import { getPreferredType } from "../utils/schema/index.js";
|
|
4
4
|
import { useStorageKey } from "../ui/client/storage-key.js";
|
|
5
5
|
import { useApiContext, useServerContext } from "../ui/contexts/api.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useTranslations } from "../ui/client/i18n.js";
|
|
7
7
|
import { cn } from "../utils/cn.js";
|
|
8
|
+
import { DefaultResultDisplay } from "./components/result-display.js";
|
|
8
9
|
import { MethodLabel } from "../ui/components/method-label.js";
|
|
9
10
|
import { useQuery } from "../utils/use-query.js";
|
|
10
11
|
import { encodeRequestData } from "../requests/media/encode.js";
|
|
@@ -12,10 +13,8 @@ import { dereferenceSwallow } from "../utils/schema/dereference.js";
|
|
|
12
13
|
import { SchemaProvider, anyFields, useResolvedSchema } from "./schema.js";
|
|
13
14
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/components/select.js";
|
|
14
15
|
import { labelVariants } from "../ui/components/input.js";
|
|
15
|
-
import { useTranslations } from "../ui/client/i18n.js";
|
|
16
16
|
import ServerSelect from "./components/server-select.js";
|
|
17
17
|
import { FieldInput, FieldSet, JsonInput, ObjectInput } from "./components/inputs.js";
|
|
18
|
-
import { ClientCodeBlock } from "../ui/components/codeblock.js";
|
|
19
18
|
import { useOperationContext } from "../ui/operation/client.js";
|
|
20
19
|
import { useAuth } from "./auth.js";
|
|
21
20
|
import { OAuthDialog, OAuthDialogContent, OAuthDialogTrigger } from "./components/oauth-dialog.js";
|
|
@@ -23,8 +22,8 @@ import { Spinner } from "./components/spinner.js";
|
|
|
23
22
|
import { Fragment, useEffect, useMemo, useRef, useState } from "react";
|
|
24
23
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
25
24
|
import { ChevronDown, LoaderCircle } from "lucide-react";
|
|
26
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "fumadocs-ui/components/ui/collapsible";
|
|
27
25
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
26
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "fumadocs-ui/components/ui/collapsible";
|
|
28
27
|
import { StfProvider, useDataEngine, useFieldValue, useListener, useStf } from "@fumari/stf";
|
|
29
28
|
import { arrayStartsWith, objectGet, objectSet, stringifyFieldKey } from "@fumari/stf/lib/utils";
|
|
30
29
|
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
@@ -516,39 +515,6 @@ function Route({ route, ...props }) {
|
|
|
516
515
|
})] }, index))
|
|
517
516
|
});
|
|
518
517
|
}
|
|
519
|
-
function DefaultResultDisplay({ data, reset, ...rest }) {
|
|
520
|
-
const t = useTranslations();
|
|
521
|
-
const statusInfo = useMemo(() => getStatusInfo(data.status, t), [data.status, t]);
|
|
522
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
523
|
-
...rest,
|
|
524
|
-
className: cn("flex flex-col gap-3 mt-2 px-3 py-2 border-y bg-fd-secondary text-fd-secondary-foreground", rest.className),
|
|
525
|
-
children: [
|
|
526
|
-
/* @__PURE__ */ jsxs("div", {
|
|
527
|
-
className: "flex justify-between items-center",
|
|
528
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
529
|
-
className: "inline-flex items-center gap-1.5 text-sm font-medium",
|
|
530
|
-
children: [/* @__PURE__ */ jsx(statusInfo.icon, { className: cn("size-4", statusInfo.color) }), statusInfo.description]
|
|
531
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
532
|
-
type: "button",
|
|
533
|
-
className: cn(buttonVariants({
|
|
534
|
-
size: "sm",
|
|
535
|
-
variant: "outline"
|
|
536
|
-
})),
|
|
537
|
-
onClick: () => reset(),
|
|
538
|
-
children: t.close
|
|
539
|
-
})]
|
|
540
|
-
}),
|
|
541
|
-
/* @__PURE__ */ jsx("p", {
|
|
542
|
-
className: "text-sm text-fd-muted-foreground",
|
|
543
|
-
children: data.status
|
|
544
|
-
}),
|
|
545
|
-
data.data !== void 0 && /* @__PURE__ */ jsx(ClientCodeBlock, {
|
|
546
|
-
lang: typeof data.data === "string" && data.data.length > 5e4 ? "text" : data.type,
|
|
547
|
-
code: typeof data.data === "string" ? data.data : JSON.stringify(data.data, null, 2)
|
|
548
|
-
})
|
|
549
|
-
]
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
518
|
function DefaultCollapsiblePanel({ title, children, ...props }) {
|
|
553
519
|
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
554
520
|
...props,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useTranslations } from "../../ui/client/i18n.js";
|
|
2
3
|
import { cn } from "../../utils/cn.js";
|
|
3
4
|
import { FormatFlags } from "../../utils/schema/to-string.js";
|
|
4
5
|
import { anyFields, useFieldInfo, useResolvedSchema, useSchemaScope, useSchemaUtils } from "../schema.js";
|
|
5
6
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../ui/components/select.js";
|
|
6
7
|
import { Input, labelVariants } from "../../ui/components/input.js";
|
|
7
|
-
import { useTranslations } from "../../ui/client/i18n.js";
|
|
8
8
|
import { useState } from "react";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { ChevronRight, Plus, Trash2, X } from "lucide-react";
|
|
11
|
-
import { cva } from "class-variance-authority";
|
|
12
11
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
12
|
+
import { cva } from "class-variance-authority";
|
|
13
13
|
import { useArray, useDataEngine, useFieldValue, useObject } from "@fumari/stf";
|
|
14
14
|
import { stringifyFieldKey } from "@fumari/stf/lib/utils";
|
|
15
15
|
//#region src/playground/components/inputs.tsx
|