fumadocs-openapi 10.2.2 → 10.2.3
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/dist/generate-file.d.ts +53 -49
- package/dist/generate-file.d.ts.map +1 -1
- package/dist/generate-file.js +88 -102
- package/dist/generate-file.js.map +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +3 -1
- package/dist/playground/client.d.ts +88 -72
- package/dist/playground/client.d.ts.map +1 -1
- package/dist/playground/client.js +446 -296
- package/dist/playground/client.js.map +1 -0
- package/dist/playground/components/inputs.js +395 -172
- package/dist/playground/components/inputs.js.map +1 -0
- package/dist/playground/components/oauth-dialog.js +270 -174
- package/dist/playground/components/oauth-dialog.js.map +1 -0
- package/dist/playground/components/server-select.js +115 -55
- package/dist/playground/components/server-select.js.map +1 -0
- package/dist/playground/fetcher.d.ts +10 -18
- package/dist/playground/fetcher.d.ts.map +1 -1
- package/dist/playground/fetcher.js +67 -75
- package/dist/playground/fetcher.js.map +1 -0
- package/dist/playground/get-default-values.js +23 -26
- package/dist/playground/get-default-values.js.map +1 -0
- package/dist/playground/index.d.ts +23 -13
- package/dist/playground/index.d.ts.map +1 -1
- package/dist/playground/index.js +87 -91
- package/dist/playground/index.js.map +1 -0
- package/dist/playground/lazy.js +9 -2
- package/dist/playground/lazy.js.map +1 -0
- package/dist/playground/schema.d.ts +18 -55
- package/dist/playground/schema.d.ts.map +1 -1
- package/dist/playground/schema.js +117 -106
- package/dist/playground/schema.js.map +1 -0
- package/dist/playground/status-info.js +49 -37
- package/dist/playground/status-info.js.map +1 -0
- package/dist/requests/generators/csharp.js +40 -50
- package/dist/requests/generators/csharp.js.map +1 -0
- package/dist/requests/generators/curl.js +28 -27
- package/dist/requests/generators/curl.js.map +1 -0
- package/dist/requests/generators/go.js +39 -35
- package/dist/requests/generators/go.js.map +1 -0
- package/dist/requests/generators/index.js +49 -43
- package/dist/requests/generators/index.js.map +1 -0
- package/dist/requests/generators/java.js +56 -67
- package/dist/requests/generators/java.js.map +1 -0
- package/dist/requests/generators/javascript.js +38 -45
- package/dist/requests/generators/javascript.js.map +1 -0
- package/dist/requests/generators/python.js +33 -37
- package/dist/requests/generators/python.js.map +1 -0
- package/dist/requests/media/adapter.d.ts +38 -84
- package/dist/requests/media/adapter.d.ts.map +1 -1
- package/dist/requests/media/adapter.js +122 -169
- package/dist/requests/media/adapter.js.map +1 -0
- package/dist/requests/media/encode.d.ts +12 -7
- package/dist/requests/media/encode.d.ts.map +1 -1
- package/dist/requests/media/encode.js +129 -109
- package/dist/requests/media/encode.js.map +1 -0
- package/dist/requests/media/resolve-adapter.js +28 -28
- package/dist/requests/media/resolve-adapter.js.map +1 -0
- package/dist/requests/string-utils.js +28 -35
- package/dist/requests/string-utils.js.map +1 -0
- package/dist/requests/to-python-object.js +16 -28
- package/dist/requests/to-python-object.js.map +1 -0
- package/dist/requests/types.d.ts +25 -21
- package/dist/requests/types.d.ts.map +1 -1
- package/dist/scalar/client.js +57 -20
- package/dist/scalar/client.js.map +1 -0
- package/dist/scalar/index.d.ts +8 -2
- package/dist/scalar/index.d.ts.map +1 -1
- package/dist/scalar/index.js +29 -19
- package/dist/scalar/index.js.map +1 -0
- package/dist/server/create.d.ts +29 -25
- package/dist/server/create.d.ts.map +1 -1
- package/dist/server/create.js +42 -39
- package/dist/server/create.js.map +1 -0
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +4 -2
- package/dist/server/proxy.d.ts +28 -28
- package/dist/server/proxy.d.ts.map +1 -1
- package/dist/server/proxy.js +58 -75
- package/dist/server/proxy.js.map +1 -0
- package/dist/server/source-api.d.ts +32 -29
- package/dist/server/source-api.d.ts.map +1 -1
- package/dist/server/source-api.js +82 -75
- package/dist/server/source-api.js.map +1 -0
- package/dist/types.d.ts +41 -36
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/api-page.d.ts +140 -136
- package/dist/ui/api-page.d.ts.map +1 -1
- package/dist/ui/api-page.js +134 -118
- package/dist/ui/api-page.js.map +1 -0
- package/dist/ui/client/index.d.ts +30 -26
- package/dist/ui/client/index.d.ts.map +1 -1
- package/dist/ui/client/index.js +8 -2
- package/dist/ui/client/index.js.map +1 -0
- package/dist/ui/client/storage-key.js +16 -10
- package/dist/ui/client/storage-key.js.map +1 -0
- package/dist/ui/components/accordion.js +40 -14
- package/dist/ui/components/accordion.js.map +1 -0
- package/dist/ui/components/dialog.js +51 -15
- package/dist/ui/components/dialog.js.map +1 -0
- package/dist/ui/components/input.js +18 -8
- package/dist/ui/components/input.js.map +1 -0
- package/dist/ui/components/method-label.js +38 -33
- package/dist/ui/components/method-label.js.map +1 -0
- package/dist/ui/components/select.js +66 -15
- package/dist/ui/components/select.js.map +1 -0
- package/dist/ui/contexts/api.js +96 -85
- package/dist/ui/contexts/api.js.map +1 -0
- package/dist/ui/contexts/api.lazy.js +9 -2
- package/dist/ui/contexts/api.lazy.js.map +1 -0
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +3 -1
- package/dist/ui/operation/client.js +65 -27
- package/dist/ui/operation/client.js.map +1 -0
- package/dist/ui/operation/index.js +403 -186
- package/dist/ui/operation/index.js.map +1 -0
- package/dist/ui/operation/request-tabs.d.ts +15 -16
- package/dist/ui/operation/request-tabs.d.ts.map +1 -1
- package/dist/ui/operation/request-tabs.js +151 -131
- package/dist/ui/operation/request-tabs.js.map +1 -0
- package/dist/ui/operation/response-tabs.d.ts +27 -28
- package/dist/ui/operation/response-tabs.d.ts.map +1 -1
- package/dist/ui/operation/response-tabs.js +73 -56
- package/dist/ui/operation/response-tabs.js.map +1 -0
- package/dist/ui/operation/usage-tabs/client.js +117 -88
- package/dist/ui/operation/usage-tabs/client.js.map +1 -0
- package/dist/ui/operation/usage-tabs/index.d.ts +22 -21
- package/dist/ui/operation/usage-tabs/index.d.ts.map +1 -1
- package/dist/ui/operation/usage-tabs/index.js +63 -48
- package/dist/ui/operation/usage-tabs/index.js.map +1 -0
- package/dist/ui/operation/usage-tabs/lazy.js +11 -4
- package/dist/ui/operation/usage-tabs/lazy.js.map +1 -0
- package/dist/ui/schema/client.d.ts +11 -7
- package/dist/ui/schema/client.d.ts.map +1 -1
- package/dist/ui/schema/client.js +213 -127
- package/dist/ui/schema/client.js.map +1 -0
- package/dist/ui/schema/index.d.ts +51 -50
- package/dist/ui/schema/index.d.ts.map +1 -1
- package/dist/ui/schema/index.js +225 -248
- package/dist/ui/schema/index.js.map +1 -0
- package/dist/ui/schema/lazy.js +9 -2
- package/dist/ui/schema/lazy.js.map +1 -0
- package/dist/utils/cn.js +3 -1
- package/dist/utils/deep-equal.js +18 -26
- package/dist/utils/deep-equal.js.map +1 -0
- package/dist/utils/get-typescript-schema.js +21 -19
- package/dist/utils/get-typescript-schema.js.map +1 -0
- package/dist/utils/id-to-title.js +13 -16
- package/dist/utils/id-to-title.js.map +1 -0
- package/dist/utils/lazy.js +13 -11
- package/dist/utils/lazy.js.map +1 -0
- package/dist/utils/merge-schema.js +130 -174
- package/dist/utils/merge-schema.js.map +1 -0
- package/dist/utils/pages/builder.d.ts +80 -76
- package/dist/utils/pages/builder.d.ts.map +1 -1
- package/dist/utils/pages/builder.js +101 -118
- package/dist/utils/pages/builder.js.map +1 -0
- package/dist/utils/pages/preset-auto.d.ts +58 -55
- package/dist/utils/pages/preset-auto.d.ts.map +1 -1
- package/dist/utils/pages/preset-auto.js +124 -137
- package/dist/utils/pages/preset-auto.js.map +1 -0
- package/dist/utils/pages/to-body.js +21 -18
- package/dist/utils/pages/to-body.js.map +1 -0
- package/dist/utils/pages/to-static-data.js +48 -40
- package/dist/utils/pages/to-static-data.js.map +1 -0
- package/dist/utils/pages/to-text.d.ts +43 -41
- package/dist/utils/pages/to-text.d.ts.map +1 -1
- package/dist/utils/pages/to-text.js +93 -126
- package/dist/utils/pages/to-text.js.map +1 -0
- package/dist/utils/process-document.d.ts +18 -19
- package/dist/utils/process-document.d.ts.map +1 -1
- package/dist/utils/process-document.js +43 -54
- package/dist/utils/process-document.js.map +1 -0
- package/dist/utils/remove-undefined.js +18 -18
- package/dist/utils/remove-undefined.js.map +1 -0
- package/dist/utils/schema-to-string.js +46 -64
- package/dist/utils/schema-to-string.js.map +1 -0
- package/dist/utils/schema.d.ts +11 -27
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +43 -44
- package/dist/utils/schema.js.map +1 -0
- package/dist/utils/url.js +35 -56
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/use-query.js +39 -33
- package/dist/utils/use-query.js.map +1 -0
- package/package.json +33 -32
- package/dist/index.d.ts.map +0 -1
- package/dist/playground/components/inputs.d.ts +0 -25
- package/dist/playground/components/inputs.d.ts.map +0 -1
- package/dist/playground/components/oauth-dialog.d.ts +0 -13
- package/dist/playground/components/oauth-dialog.d.ts.map +0 -1
- package/dist/playground/components/server-select.d.ts +0 -3
- package/dist/playground/components/server-select.d.ts.map +0 -1
- package/dist/playground/get-default-values.d.ts +0 -3
- package/dist/playground/get-default-values.d.ts.map +0 -1
- package/dist/playground/lazy.d.ts +0 -2
- package/dist/playground/lazy.d.ts.map +0 -1
- package/dist/playground/status-info.d.ts +0 -8
- package/dist/playground/status-info.d.ts.map +0 -1
- package/dist/requests/generators/csharp.d.ts +0 -3
- package/dist/requests/generators/csharp.d.ts.map +0 -1
- package/dist/requests/generators/curl.d.ts +0 -3
- package/dist/requests/generators/curl.d.ts.map +0 -1
- package/dist/requests/generators/go.d.ts +0 -3
- package/dist/requests/generators/go.d.ts.map +0 -1
- package/dist/requests/generators/index.d.ts +0 -3
- package/dist/requests/generators/index.d.ts.map +0 -1
- package/dist/requests/generators/java.d.ts +0 -3
- package/dist/requests/generators/java.d.ts.map +0 -1
- package/dist/requests/generators/javascript.d.ts +0 -3
- package/dist/requests/generators/javascript.d.ts.map +0 -1
- package/dist/requests/generators/python.d.ts +0 -3
- package/dist/requests/generators/python.d.ts.map +0 -1
- package/dist/requests/media/resolve-adapter.d.ts +0 -19
- package/dist/requests/media/resolve-adapter.d.ts.map +0 -1
- package/dist/requests/string-utils.d.ts +0 -7
- package/dist/requests/string-utils.d.ts.map +0 -1
- package/dist/requests/to-python-object.d.ts +0 -2
- package/dist/requests/to-python-object.d.ts.map +0 -1
- package/dist/requests/types.js +0 -1
- package/dist/scalar/client.d.ts +0 -7
- package/dist/scalar/client.d.ts.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/ui/client/storage-key.d.ts +0 -9
- package/dist/ui/client/storage-key.d.ts.map +0 -1
- package/dist/ui/components/accordion.d.ts +0 -8
- package/dist/ui/components/accordion.d.ts.map +0 -1
- package/dist/ui/components/dialog.d.ts +0 -20
- package/dist/ui/components/dialog.d.ts.map +0 -1
- package/dist/ui/components/input.d.ts +0 -6
- package/dist/ui/components/input.d.ts.map +0 -1
- package/dist/ui/components/method-label.d.ts +0 -10
- package/dist/ui/components/method-label.d.ts.map +0 -1
- package/dist/ui/components/select.d.ts +0 -14
- package/dist/ui/components/select.d.ts.map +0 -1
- package/dist/ui/contexts/api.d.ts +0 -33
- package/dist/ui/contexts/api.d.ts.map +0 -1
- package/dist/ui/contexts/api.lazy.d.ts +0 -2
- package/dist/ui/contexts/api.lazy.d.ts.map +0 -1
- package/dist/ui/icons.d.ts +0 -49
- package/dist/ui/icons.d.ts.map +0 -1
- package/dist/ui/icons.js +0 -281
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/operation/client.d.ts +0 -19
- package/dist/ui/operation/client.d.ts.map +0 -1
- package/dist/ui/operation/index.d.ts +0 -12
- package/dist/ui/operation/index.d.ts.map +0 -1
- package/dist/ui/operation/usage-tabs/client.d.ts +0 -23
- package/dist/ui/operation/usage-tabs/client.d.ts.map +0 -1
- package/dist/ui/operation/usage-tabs/lazy.d.ts +0 -4
- package/dist/ui/operation/usage-tabs/lazy.d.ts.map +0 -1
- package/dist/ui/schema/lazy.d.ts +0 -2
- package/dist/ui/schema/lazy.d.ts.map +0 -1
- package/dist/utils/cn.d.ts +0 -2
- package/dist/utils/cn.d.ts.map +0 -1
- package/dist/utils/deep-equal.d.ts +0 -2
- package/dist/utils/deep-equal.d.ts.map +0 -1
- package/dist/utils/get-typescript-schema.d.ts +0 -4
- package/dist/utils/get-typescript-schema.d.ts.map +0 -1
- package/dist/utils/id-to-title.d.ts +0 -2
- package/dist/utils/id-to-title.d.ts.map +0 -1
- package/dist/utils/lazy.d.ts +0 -5
- package/dist/utils/lazy.d.ts.map +0 -1
- package/dist/utils/merge-schema.d.ts +0 -7
- package/dist/utils/merge-schema.d.ts.map +0 -1
- package/dist/utils/pages/to-body.d.ts +0 -4
- package/dist/utils/pages/to-body.d.ts.map +0 -1
- package/dist/utils/pages/to-static-data.d.ts +0 -10
- package/dist/utils/pages/to-static-data.d.ts.map +0 -1
- package/dist/utils/remove-undefined.d.ts +0 -2
- package/dist/utils/remove-undefined.d.ts.map +0 -1
- package/dist/utils/schema-to-string.d.ts +0 -8
- package/dist/utils/schema-to-string.d.ts.map +0 -1
- package/dist/utils/url.d.ts +0 -11
- package/dist/utils/url.d.ts.map +0 -1
- package/dist/utils/use-query.d.ts +0 -8
- package/dist/utils/use-query.d.ts.map +0 -1
|
@@ -1,138 +1,125 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const { pathItem, operation, displayName } = builder.fromExtractedWebhook(webhook);
|
|
122
|
-
const entry = {
|
|
123
|
-
type: 'webhook',
|
|
124
|
-
schemaId: builder.id,
|
|
125
|
-
info: {
|
|
126
|
-
title: displayName,
|
|
127
|
-
description: operation.description ?? pathItem.description,
|
|
128
|
-
},
|
|
129
|
-
item: webhook,
|
|
130
|
-
path: '',
|
|
131
|
-
};
|
|
132
|
-
for (const outputPath of groupOutput(builder, entry)) {
|
|
133
|
-
builder.create({ ...entry, path: outputPath });
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
};
|
|
1
|
+
import { isUrl } from "../url.js";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/pages/preset-auto.ts
|
|
5
|
+
function createAutoPreset(options) {
|
|
6
|
+
if (options.per === "custom") return options;
|
|
7
|
+
const { slugify = (s) => {
|
|
8
|
+
return s.replace(/\s+/g, "-").toLowerCase();
|
|
9
|
+
} } = options;
|
|
10
|
+
let nameFn;
|
|
11
|
+
if (typeof options.name === "function") nameFn = options.name;
|
|
12
|
+
else {
|
|
13
|
+
const { algorithm = "v2" } = options.name ?? {};
|
|
14
|
+
nameFn = function(result, document) {
|
|
15
|
+
if (result.type === "tag") return slugify(result.tag);
|
|
16
|
+
if (result.type === "group") {
|
|
17
|
+
const schemaId = result.schemaId;
|
|
18
|
+
return isUrl(schemaId) ? "index" : path.basename(schemaId, path.extname(schemaId));
|
|
19
|
+
}
|
|
20
|
+
if (result.type === "operation") {
|
|
21
|
+
const operation = document.paths[result.item.path][result.item.method];
|
|
22
|
+
if (algorithm === "v2" && operation.operationId) return operation.operationId;
|
|
23
|
+
return path.join(this.routePathToFilePath(result.item.path), result.item.method.toLowerCase());
|
|
24
|
+
}
|
|
25
|
+
const hook = document.webhooks[result.item.name][result.item.method];
|
|
26
|
+
if (algorithm === "v2" && hook.operationId) return hook.operationId;
|
|
27
|
+
return slugify(result.item.name);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function groupOutput(builder, entry) {
|
|
31
|
+
const { dereferenced } = builder.document;
|
|
32
|
+
const { groupBy = "none" } = options;
|
|
33
|
+
if (groupBy === "route") return [path.join(builder.routePathToFilePath(entry.type === "operation" ? entry.item.path : entry.item.name), `${entry.item.method.toLowerCase()}.mdx`)];
|
|
34
|
+
const file = nameFn.call(builder, entry, dereferenced);
|
|
35
|
+
if (groupBy === "tag") {
|
|
36
|
+
let tags = entry.type === "operation" ? dereferenced.paths[entry.item.path][entry.item.method].tags : dereferenced.webhooks[entry.item.name][entry.item.method].tags;
|
|
37
|
+
if (!tags || tags.length === 0) {
|
|
38
|
+
console.warn("When `groupBy` is set to `tag`, make sure a `tags` is defined for every operation schema.");
|
|
39
|
+
tags = ["unknown"];
|
|
40
|
+
}
|
|
41
|
+
return tags.map((tag) => path.join(slugify(tag), `${file}.mdx`));
|
|
42
|
+
}
|
|
43
|
+
if (typeof groupBy === "function") return [path.join(slugify(groupBy(entry)), `${file}.mdx`)];
|
|
44
|
+
return [`${file}.mdx`];
|
|
45
|
+
}
|
|
46
|
+
return { toPages(builder) {
|
|
47
|
+
const { dereferenced } = builder.document;
|
|
48
|
+
const items = builder.extract();
|
|
49
|
+
if (options.per === "file") {
|
|
50
|
+
const entry = {
|
|
51
|
+
type: "group",
|
|
52
|
+
schemaId: builder.id,
|
|
53
|
+
path: "",
|
|
54
|
+
info: {
|
|
55
|
+
title: dereferenced.info.title,
|
|
56
|
+
description: dereferenced.info.description
|
|
57
|
+
},
|
|
58
|
+
...items
|
|
59
|
+
};
|
|
60
|
+
entry.path = nameFn.call(builder, entry, dereferenced) + ".mdx";
|
|
61
|
+
builder.create(entry);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (options.per === "tag") {
|
|
65
|
+
const tags = dereferenced.tags ?? [];
|
|
66
|
+
for (const tag of tags) {
|
|
67
|
+
const { displayName } = builder.fromTag(tag);
|
|
68
|
+
const entry = {
|
|
69
|
+
type: "tag",
|
|
70
|
+
path: "",
|
|
71
|
+
schemaId: builder.id,
|
|
72
|
+
info: {
|
|
73
|
+
title: displayName,
|
|
74
|
+
description: tag.description
|
|
75
|
+
},
|
|
76
|
+
webhooks: items.webhooks.filter((webhook) => webhook.tags?.includes(tag.name)),
|
|
77
|
+
operations: items.operations.filter((op) => op.tags?.includes(tag.name)),
|
|
78
|
+
tag: tag.name,
|
|
79
|
+
rawTag: tag
|
|
80
|
+
};
|
|
81
|
+
entry.path = nameFn.call(builder, entry, dereferenced) + ".mdx";
|
|
82
|
+
builder.create(entry);
|
|
83
|
+
}
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
for (const op of items.operations) {
|
|
87
|
+
const { pathItem, operation, displayName } = builder.fromExtractedOperation(op);
|
|
88
|
+
const entry = {
|
|
89
|
+
type: "operation",
|
|
90
|
+
schemaId: builder.id,
|
|
91
|
+
item: op,
|
|
92
|
+
path: "",
|
|
93
|
+
info: {
|
|
94
|
+
title: displayName,
|
|
95
|
+
description: operation.description ?? pathItem.description
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
for (const outputPath of groupOutput(builder, entry)) builder.create({
|
|
99
|
+
...entry,
|
|
100
|
+
path: outputPath
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
for (const webhook of items.webhooks) {
|
|
104
|
+
const { pathItem, operation, displayName } = builder.fromExtractedWebhook(webhook);
|
|
105
|
+
const entry = {
|
|
106
|
+
type: "webhook",
|
|
107
|
+
schemaId: builder.id,
|
|
108
|
+
info: {
|
|
109
|
+
title: displayName,
|
|
110
|
+
description: operation.description ?? pathItem.description
|
|
111
|
+
},
|
|
112
|
+
item: webhook,
|
|
113
|
+
path: ""
|
|
114
|
+
};
|
|
115
|
+
for (const outputPath of groupOutput(builder, entry)) builder.create({
|
|
116
|
+
...entry,
|
|
117
|
+
path: outputPath
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
} };
|
|
138
121
|
}
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
export { createAutoPreset };
|
|
125
|
+
//# sourceMappingURL=preset-auto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset-auto.js","names":["nameFn: NameFn<OutputEntry>","entry: OutputGroup","entry: TagOutput","entry: OperationOutput","entry: WebhookOutput"],"sources":["../../../src/utils/pages/preset-auto.ts"],"sourcesContent":["import * as path from 'node:path';\nimport type { ProcessedDocument } from '@/utils/process-document';\nimport type {\n OperationOutput,\n OutputEntry,\n OutputGroup,\n PagesBuilder,\n PagesBuilderConfig,\n TagOutput,\n WebhookOutput,\n} from '@/utils/pages/builder';\nimport { isUrl } from '@/utils/url';\n\ninterface OperationConfig extends BaseConfig {\n /**\n * Generate a page for each API endpoint/operation (default).\n */\n per?: 'operation';\n\n /**\n * Group output using folders (Only works on `operation` mode)\n * - tag: `{tag}/{file}`\n * - route: `{endpoint}/{method}` (it will ignore the `name` option)\n * - none: `{file}` (default)\n * - a function that aligns group name (folder path) to each entry\n *\n * @defaultValue 'none'\n */\n groupBy?: 'tag' | 'route' | 'none' | ((entry: OperationOutput | WebhookOutput) => string);\n\n /**\n * Specify name for output file\n */\n name?: NameFn<OperationOutput | WebhookOutput> | NameFnOptions;\n}\n\ninterface TagConfig extends BaseConfig {\n /**\n * Generate a page for each tag.\n */\n per: 'tag';\n\n /**\n * Specify name for output file\n */\n name?: NameFn<TagOutput> | NameFnOptions;\n}\n\ninterface SchemaConfig extends BaseConfig {\n /**\n * Generate a page for each schema file.\n */\n per: 'file';\n\n /**\n * Specify name for output file\n */\n name?: NameFn<OutputGroup> | NameFnOptions;\n}\n\nexport type SchemaToPagesOptions =\n | SchemaConfig\n | TagConfig\n | OperationConfig\n | ({\n per: 'custom';\n } & PagesBuilderConfig);\n\ntype NameFn<Entry> = (\n this: PagesBuilder,\n output: Entry,\n document: ProcessedDocument['dereferenced'],\n) => string;\n\ninterface NameFnOptions {\n /**\n * The version of algorithm used to generate file paths.\n *\n * v1: Fumadocs OpenAPI v8\n * v2: Fumadocs OpenAPI v9\n *\n * @defaultValue v2\n */\n algorithm?: 'v2' | 'v1';\n}\n\ninterface BaseConfig {\n /**\n * Custom function to convert names into file names.\n *\n * By default, it only escapes whitespaces and upper case (English) characters\n */\n slugify?: (name: string) => string;\n}\n\nexport function createAutoPreset(options: SchemaToPagesOptions): PagesBuilderConfig {\n if (options.per === 'custom') return options;\n const {\n slugify = (s) => {\n return s.replace(/\\s+/g, '-').toLowerCase();\n },\n } = options;\n let nameFn: NameFn<OutputEntry>;\n\n if (typeof options.name === 'function') {\n nameFn = options.name as NameFn<OutputEntry>;\n } else {\n const { algorithm = 'v2' } = options.name ?? {};\n\n nameFn = function (result, document) {\n if (result.type === 'tag') {\n return slugify(result.tag);\n }\n\n if (result.type === 'group') {\n const schemaId = result.schemaId;\n\n return isUrl(schemaId) ? 'index' : path.basename(schemaId, path.extname(schemaId));\n }\n\n if (result.type === 'operation') {\n const operation = document.paths![result.item.path]![result.item.method]!;\n\n if (algorithm === 'v2' && operation.operationId) {\n return operation.operationId;\n }\n\n return path.join(\n this.routePathToFilePath(result.item.path),\n result.item.method.toLowerCase(),\n );\n }\n\n const hook = document.webhooks![result.item.name][result.item.method]!;\n\n if (algorithm === 'v2' && hook.operationId) {\n return hook.operationId;\n }\n\n return slugify(result.item.name);\n };\n }\n\n function groupOutput(builder: PagesBuilder, entry: OperationOutput | WebhookOutput): string[] {\n const { dereferenced } = builder.document;\n const { groupBy = 'none' } = options as OperationConfig;\n\n if (groupBy === 'route') {\n return [\n path.join(\n builder.routePathToFilePath(\n entry.type === 'operation' ? entry.item.path : entry.item.name,\n ),\n `${entry.item.method.toLowerCase()}.mdx`,\n ),\n ];\n }\n\n const file = nameFn.call(builder, entry, dereferenced);\n if (groupBy === 'tag') {\n let tags =\n entry.type === 'operation'\n ? dereferenced.paths![entry.item.path]![entry.item.method]!.tags\n : dereferenced.webhooks![entry.item.name][entry.item.method]!.tags;\n\n if (!tags || tags.length === 0) {\n console.warn(\n 'When `groupBy` is set to `tag`, make sure a `tags` is defined for every operation schema.',\n );\n\n tags = ['unknown'];\n }\n\n return tags.map((tag) => path.join(slugify(tag), `${file}.mdx`));\n }\n\n if (typeof groupBy === 'function') {\n return [path.join(slugify(groupBy(entry)), `${file}.mdx`)];\n }\n\n return [`${file}.mdx`];\n }\n\n return {\n toPages(builder) {\n const { dereferenced } = builder.document;\n const items = builder.extract();\n\n if (options.per === 'file') {\n const entry: OutputGroup = {\n type: 'group',\n schemaId: builder.id,\n path: '',\n info: {\n title: dereferenced.info.title,\n description: dereferenced.info.description,\n },\n ...items,\n };\n entry.path = nameFn.call(builder, entry, dereferenced) + '.mdx';\n builder.create(entry);\n return;\n }\n\n if (options.per === 'tag') {\n const tags = dereferenced.tags ?? [];\n for (const tag of tags) {\n const { displayName } = builder.fromTag(tag);\n const entry: TagOutput = {\n type: 'tag',\n path: '',\n schemaId: builder.id,\n info: {\n title: displayName,\n description: tag.description,\n },\n webhooks: items.webhooks.filter((webhook) => webhook.tags?.includes(tag.name)),\n operations: items.operations.filter((op) => op.tags?.includes(tag.name)),\n tag: tag.name,\n rawTag: tag,\n };\n\n entry.path = nameFn.call(builder, entry, dereferenced) + '.mdx';\n builder.create(entry);\n }\n\n return;\n }\n\n for (const op of items.operations) {\n const { pathItem, operation, displayName } = builder.fromExtractedOperation(op)!;\n\n const entry: OperationOutput = {\n type: 'operation',\n schemaId: builder.id,\n item: op,\n path: '',\n info: {\n title: displayName,\n description: operation.description ?? pathItem.description,\n },\n };\n\n for (const outputPath of groupOutput(builder, entry)) {\n builder.create({ ...entry, path: outputPath });\n }\n }\n\n for (const webhook of items.webhooks) {\n const { pathItem, operation, displayName } = builder.fromExtractedWebhook(webhook)!;\n\n const entry: WebhookOutput = {\n type: 'webhook',\n schemaId: builder.id,\n info: {\n title: displayName,\n description: operation.description ?? pathItem.description,\n },\n item: webhook,\n path: '',\n };\n\n for (const outputPath of groupOutput(builder, entry)) {\n builder.create({ ...entry, path: outputPath });\n }\n }\n },\n };\n}\n"],"mappings":"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"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
1
|
+
//#region src/utils/pages/to-body.tsx
|
|
2
|
+
function toBody(entry) {
|
|
3
|
+
if (entry.type === "operation") return {
|
|
4
|
+
document: entry.schemaId,
|
|
5
|
+
operations: [entry.item]
|
|
6
|
+
};
|
|
7
|
+
if (entry.type === "webhook") return {
|
|
8
|
+
document: entry.schemaId,
|
|
9
|
+
webhooks: [entry.item]
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
showTitle: true,
|
|
13
|
+
showDescription: true,
|
|
14
|
+
document: entry.schemaId,
|
|
15
|
+
operations: entry.operations,
|
|
16
|
+
webhooks: entry.webhooks
|
|
17
|
+
};
|
|
19
18
|
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { toBody };
|
|
22
|
+
//# sourceMappingURL=to-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-body.js","names":[],"sources":["../../../src/utils/pages/to-body.tsx"],"sourcesContent":["import type { ApiPageProps } from '@/ui/api-page';\nimport type { OutputEntry } from '@/utils/pages/builder';\n\nexport function toBody(entry: OutputEntry): ApiPageProps {\n if (entry.type === 'operation')\n return {\n document: entry.schemaId,\n operations: [entry.item],\n };\n if (entry.type === 'webhook')\n return {\n document: entry.schemaId,\n webhooks: [entry.item],\n };\n\n return {\n showTitle: true,\n showDescription: true,\n document: entry.schemaId,\n operations: entry.operations,\n webhooks: entry.webhooks,\n };\n}\n"],"mappings":";AAGA,SAAgB,OAAO,OAAkC;AACvD,KAAI,MAAM,SAAS,YACjB,QAAO;EACL,UAAU,MAAM;EAChB,YAAY,CAAC,MAAM,KAAK;EACzB;AACH,KAAI,MAAM,SAAS,UACjB,QAAO;EACL,UAAU,MAAM;EAChB,UAAU,CAAC,MAAM,KAAK;EACvB;AAEH,QAAO;EACL,WAAW;EACX,iBAAiB;EACjB,UAAU,MAAM;EAChB,YAAY,MAAM;EAClB,UAAU,MAAM;EACjB"}
|
|
@@ -1,41 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
import { idToTitle } from "../id-to-title.js";
|
|
2
|
+
import Slugger from "github-slugger";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/pages/to-static-data.ts
|
|
5
|
+
function toStaticData(page, dereferenced) {
|
|
6
|
+
const slugger = new Slugger();
|
|
7
|
+
const toc = [];
|
|
8
|
+
const structuredData = {
|
|
9
|
+
headings: [],
|
|
10
|
+
contents: []
|
|
11
|
+
};
|
|
12
|
+
function pathItem(item, defaultTitle) {
|
|
13
|
+
if (page.showTitle && item.operationId) {
|
|
14
|
+
const title = item.summary || (item.operationId ? idToTitle(item.operationId) : defaultTitle);
|
|
15
|
+
const id = slugger.slug(title);
|
|
16
|
+
toc.push({
|
|
17
|
+
depth: 2,
|
|
18
|
+
title,
|
|
19
|
+
url: `#${id}`
|
|
20
|
+
});
|
|
21
|
+
structuredData.headings.push({
|
|
22
|
+
content: title,
|
|
23
|
+
id
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (item.description) structuredData.contents.push({
|
|
27
|
+
content: item.description,
|
|
28
|
+
heading: structuredData.headings.at(-1)?.id
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
for (const item of page.operations ?? []) {
|
|
32
|
+
const operation = dereferenced.paths?.[item.path]?.[item.method];
|
|
33
|
+
if (!operation) continue;
|
|
34
|
+
pathItem(operation, item.path);
|
|
35
|
+
}
|
|
36
|
+
for (const item of page.webhooks ?? []) {
|
|
37
|
+
const webhook = dereferenced.webhooks?.[item.name]?.[item.method];
|
|
38
|
+
if (!webhook) continue;
|
|
39
|
+
pathItem(webhook, item.name);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
toc,
|
|
43
|
+
structuredData
|
|
44
|
+
};
|
|
41
45
|
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { toStaticData };
|
|
49
|
+
//# sourceMappingURL=to-static-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-static-data.js","names":["toc: TOCItemType[]","structuredData: StructuredData"],"sources":["../../../src/utils/pages/to-static-data.ts"],"sourcesContent":["import type { NoReference } from '@/utils/schema';\nimport type { Document, OperationObject } from '@/types';\nimport Slugger from 'github-slugger';\nimport { idToTitle } from '@/utils/id-to-title';\nimport type { TOCItemType } from 'fumadocs-core/toc';\nimport type { StructuredData } from 'fumadocs-core/mdx-plugins';\nimport type { ApiPageProps } from '@/ui';\n\nexport function toStaticData(\n page: ApiPageProps,\n dereferenced: NoReference<Document>,\n): {\n toc: TOCItemType[];\n structuredData: StructuredData;\n} {\n const slugger = new Slugger();\n const toc: TOCItemType[] = [];\n const structuredData: StructuredData = { headings: [], contents: [] };\n\n function pathItem(item: NoReference<OperationObject>, defaultTitle: string) {\n if (page.showTitle && item.operationId) {\n const title = item.summary || (item.operationId ? idToTitle(item.operationId) : defaultTitle);\n const id = slugger.slug(title);\n\n toc.push({\n depth: 2,\n title,\n url: `#${id}`,\n });\n structuredData.headings.push({\n content: title,\n id,\n });\n }\n\n if (item.description)\n structuredData.contents.push({\n content: item.description,\n heading: structuredData.headings.at(-1)?.id,\n });\n }\n\n for (const item of page.operations ?? []) {\n const operation = dereferenced.paths?.[item.path]?.[item.method];\n if (!operation) continue;\n\n pathItem(operation, item.path);\n }\n\n for (const item of page.webhooks ?? []) {\n const webhook = dereferenced.webhooks?.[item.name]?.[item.method];\n if (!webhook) continue;\n\n pathItem(webhook, item.name);\n }\n\n return { toc, structuredData };\n}\n"],"mappings":";;;;AAQA,SAAgB,aACd,MACA,cAIA;CACA,MAAM,UAAU,IAAI,SAAS;CAC7B,MAAMA,MAAqB,EAAE;CAC7B,MAAMC,iBAAiC;EAAE,UAAU,EAAE;EAAE,UAAU,EAAE;EAAE;CAErE,SAAS,SAAS,MAAoC,cAAsB;AAC1E,MAAI,KAAK,aAAa,KAAK,aAAa;GACtC,MAAM,QAAQ,KAAK,YAAY,KAAK,cAAc,UAAU,KAAK,YAAY,GAAG;GAChF,MAAM,KAAK,QAAQ,KAAK,MAAM;AAE9B,OAAI,KAAK;IACP,OAAO;IACP;IACA,KAAK,IAAI;IACV,CAAC;AACF,kBAAe,SAAS,KAAK;IAC3B,SAAS;IACT;IACD,CAAC;;AAGJ,MAAI,KAAK,YACP,gBAAe,SAAS,KAAK;GAC3B,SAAS,KAAK;GACd,SAAS,eAAe,SAAS,GAAG,GAAG,EAAE;GAC1C,CAAC;;AAGN,MAAK,MAAM,QAAQ,KAAK,cAAc,EAAE,EAAE;EACxC,MAAM,YAAY,aAAa,QAAQ,KAAK,QAAQ,KAAK;AACzD,MAAI,CAAC,UAAW;AAEhB,WAAS,WAAW,KAAK,KAAK;;AAGhC,MAAK,MAAM,QAAQ,KAAK,YAAY,EAAE,EAAE;EACtC,MAAM,UAAU,aAAa,WAAW,KAAK,QAAQ,KAAK;AAC1D,MAAI,CAAC,QAAS;AAEd,WAAS,SAAS,KAAK,KAAK;;AAG9B,QAAO;EAAE;EAAK;EAAgB"}
|
|
@@ -1,46 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
import "./builder.js";
|
|
2
|
+
import { TagObject } from "../../types.js";
|
|
3
|
+
import "../process-document.js";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/pages/to-text.d.ts
|
|
6
|
+
interface PagesToTextOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Additional imports of your MDX components.
|
|
9
|
+
*/
|
|
10
|
+
imports?: {
|
|
11
|
+
names: string[];
|
|
12
|
+
from: string;
|
|
13
|
+
}[];
|
|
14
|
+
/**
|
|
15
|
+
* Customise frontmatter.
|
|
16
|
+
*
|
|
17
|
+
* A `full: true` property will be added by default.
|
|
18
|
+
*/
|
|
19
|
+
frontmatter?: (title: string, description: string | undefined, context: DocumentContext) => Record<string, unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* Add description to document body.
|
|
22
|
+
*
|
|
23
|
+
* We recommend but don't enable it by default because some OpenAPI schemas have invalid description that breaks MDX syntax.
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue false
|
|
26
|
+
*/
|
|
27
|
+
includeDescription?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Add a comment to the top of generated files indicating they are auto-generated.
|
|
30
|
+
* - `true`: Adds a standardized comment
|
|
31
|
+
* - `false`: No comment is added
|
|
32
|
+
* - `string`: Adds the provided custom comment
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue true
|
|
35
|
+
*/
|
|
36
|
+
addGeneratedComment?: boolean | string;
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
type: 'tag';
|
|
40
|
-
tag: TagObject | undefined;
|
|
38
|
+
type DocumentContext = {
|
|
39
|
+
type: 'tag';
|
|
40
|
+
tag: TagObject | undefined;
|
|
41
41
|
} | {
|
|
42
|
-
|
|
42
|
+
type: 'operation';
|
|
43
43
|
} | {
|
|
44
|
-
|
|
44
|
+
type: 'file';
|
|
45
45
|
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { PagesToTextOptions };
|
|
46
48
|
//# sourceMappingURL=to-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-text.d.ts","
|
|
1
|
+
{"version":3,"file":"to-text.d.ts","names":[],"sources":["../../../src/utils/pages/to-text.ts"],"sourcesContent":[],"mappings":";;;;;UASiB,kBAAA;;AAAjB;AAoJA;;;;;;;;;;0EAnIa,oBACN;;;;;;;;;;;;;;;;;;;KAkIK,eAAA;;OAGD"}
|