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
package/dist/generate-file.d.ts
CHANGED
|
@@ -1,61 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { OpenAPIServer } from "./server/create.js";
|
|
2
|
+
import { OutputEntry } from "./utils/pages/builder.js";
|
|
3
|
+
import { SchemaToPagesOptions } from "./utils/pages/preset-auto.js";
|
|
4
|
+
import "./server/index.js";
|
|
5
|
+
import { ProcessedDocument } from "./utils/process-document.js";
|
|
6
|
+
import { PagesToTextOptions } from "./utils/pages/to-text.js";
|
|
7
|
+
|
|
8
|
+
//#region src/generate-file.d.ts
|
|
9
|
+
interface OutputFile {
|
|
10
|
+
path: string;
|
|
11
|
+
content: string;
|
|
9
12
|
}
|
|
10
13
|
interface IndexConfig {
|
|
11
|
-
|
|
14
|
+
items: IndexItem[] | ((ctx: BeforeWriteContext) => IndexItem[]);
|
|
15
|
+
/**
|
|
16
|
+
* Generate URLs for cards
|
|
17
|
+
*/
|
|
18
|
+
url: ((filePath: string) => string) | {
|
|
19
|
+
baseUrl: string;
|
|
12
20
|
/**
|
|
13
|
-
*
|
|
21
|
+
* Base content directory
|
|
14
22
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Base content directory
|
|
19
|
-
*/
|
|
20
|
-
contentDir: string;
|
|
21
|
-
};
|
|
23
|
+
contentDir: string;
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
interface IndexItem {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
path: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Specify linked pages:
|
|
32
|
+
* - items in `inputs` to include all generated pages of a specific schema.
|
|
33
|
+
* - specific Markdown/MDX files.
|
|
34
|
+
*/
|
|
35
|
+
only?: string[];
|
|
33
36
|
}
|
|
34
37
|
interface GenerateFilesConfig extends PagesToTextOptions {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
/**
|
|
39
|
+
* the OpenAPI server object
|
|
40
|
+
*/
|
|
41
|
+
input: OpenAPIServer;
|
|
42
|
+
/**
|
|
43
|
+
* Output directory
|
|
44
|
+
*/
|
|
45
|
+
output: string;
|
|
46
|
+
/**
|
|
47
|
+
* Generate index files with cards linking to generated pages.
|
|
48
|
+
*/
|
|
49
|
+
index?: IndexConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Can add/change/remove output files before writing to file system
|
|
52
|
+
**/
|
|
53
|
+
beforeWrite?: (this: BeforeWriteContext, files: OutputFile[]) => void | Promise<void>;
|
|
51
54
|
}
|
|
52
|
-
|
|
55
|
+
type Config = SchemaToPagesOptions & GenerateFilesConfig;
|
|
53
56
|
interface BeforeWriteContext {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
readonly generated: Record<string, OutputFile[]>;
|
|
58
|
+
readonly generatedEntries: Record<string, OutputEntry[]>;
|
|
59
|
+
readonly documents: Record<string, ProcessedDocument>;
|
|
57
60
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
declare function generateFiles(options: Config): Promise<void>;
|
|
62
|
+
declare function generateFilesOnly(options: SchemaToPagesOptions & Omit<GenerateFilesConfig, 'output'>): Promise<OutputFile[]>;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { Config, OutputFile, generateFiles, generateFilesOnly };
|
|
61
65
|
//# sourceMappingURL=generate-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-file.d.ts","
|
|
1
|
+
{"version":3,"file":"generate-file.d.ts","names":[],"sources":["../src/generate-file.ts"],"sourcesContent":[],"mappings":";;;;;;;;UASiB,UAAA;;;AAAjB;AAGC,UAES,WAAA,CAAW;EACZ,KAAA,EAAA,SAAA,EAAA,GAAA,CAAA,CAAA,GAAA,EAAqB,kBAArB,EAAA,GAA4C,SAA5C,EAAA,CAAA;EAAqB;;;EAgBpB,GAAA,EAAA,CAAA,CAAA,QAAS,EAAA,MAAA,EAAA,GAAA,MAAA,CAAA,GAAA;IAaT,OAAA,EAAA,MAAA;IAID;;;IAeyC,UAAA,EAAA,MAAA;EAAwB,CAAA;;UAhChE,SAAA,CAa8C;EAsB5C,IAAA,EAAA,MAAM;EAER,KAAA,CAAA,EAAA,MAAA;EAC2B,WAAA,CAAA,EAAA,MAAA;EAAf;;;;;EAEM,IAAA,CAAA,EAAA,MAAA,EAAA;AAG5B;AAeA,UA7CU,mBAAA,SAA4B,kBA6CC,CAAA;EAC5B;;;EACA,KAAA,EA3CF,aA2CE;EAAR;;;;;;;UAjCO;;;;uBAKa,2BAA2B,wBAAwB;;KAG9D,MAAA,GAAS,uBAAuB;UAElC,kBAAA;sBACY,eAAe;6BACR,eAAe;sBACtB,eAAe;;iBAGf,aAAA,UAAuB,SAAS;iBAehC,iBAAA,UACX,uBAAuB,KAAK,iCACpC,QAAQ"}
|
package/dist/generate-file.js
CHANGED
|
@@ -1,106 +1,92 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { generateDocument, toText } from "./utils/pages/to-text.js";
|
|
2
|
+
import { createAutoPreset } from "./utils/pages/preset-auto.js";
|
|
3
|
+
import { fromSchema } from "./utils/pages/builder.js";
|
|
4
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
5
|
+
import * as path from "node:path";
|
|
6
|
+
import { createGetUrl, getSlugs } from "fumadocs-core/source";
|
|
7
|
+
|
|
8
|
+
//#region src/generate-file.ts
|
|
9
|
+
async function generateFiles(options) {
|
|
10
|
+
const files = await generateFilesOnly(options);
|
|
11
|
+
const { output } = options;
|
|
12
|
+
await Promise.all(files.map(async (file) => {
|
|
13
|
+
const filePath = path.join(output, file.path);
|
|
14
|
+
await mkdir(path.dirname(filePath), { recursive: true });
|
|
15
|
+
await writeFile(filePath, file.content);
|
|
16
|
+
console.log(`Generated: ${filePath}`);
|
|
17
|
+
}));
|
|
16
18
|
}
|
|
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
|
-
writeIndexFiles(files, context, options);
|
|
47
|
-
}
|
|
48
|
-
await options.beforeWrite?.call(context, files);
|
|
49
|
-
return files;
|
|
19
|
+
async function generateFilesOnly(options) {
|
|
20
|
+
const schemas = await options.input.getSchemas();
|
|
21
|
+
const files = [];
|
|
22
|
+
const generated = {};
|
|
23
|
+
const generatedEntries = {};
|
|
24
|
+
const entries = Object.entries(schemas);
|
|
25
|
+
if (entries.length === 0) throw new Error("No input files found.");
|
|
26
|
+
const preset = createAutoPreset(options);
|
|
27
|
+
for (const [id, schema] of entries) {
|
|
28
|
+
const entries$1 = fromSchema(id, schema, preset);
|
|
29
|
+
const schemaFiles = generated[id] ??= [];
|
|
30
|
+
generatedEntries[id] = entries$1;
|
|
31
|
+
for (const entry of entries$1) {
|
|
32
|
+
const file = {
|
|
33
|
+
path: entry.path,
|
|
34
|
+
content: toText(entry, schema, options)
|
|
35
|
+
};
|
|
36
|
+
schemaFiles.push(file);
|
|
37
|
+
files.push(file);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const context = {
|
|
41
|
+
generated,
|
|
42
|
+
generatedEntries,
|
|
43
|
+
documents: schemas
|
|
44
|
+
};
|
|
45
|
+
if (options.index) writeIndexFiles(files, context, options);
|
|
46
|
+
await options.beforeWrite?.call(context, files);
|
|
47
|
+
return files;
|
|
50
48
|
}
|
|
51
49
|
function writeIndexFiles(files, context, options) {
|
|
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
|
-
? `description=${JSON.stringify(file.info.description)} `
|
|
91
|
-
: '';
|
|
92
|
-
content.push(`<Card href="${urlFn(file.path)}" title=${JSON.stringify(file.info.title)} ${descriptionAttr}/>`);
|
|
93
|
-
}
|
|
94
|
-
content.push('</Cards>');
|
|
95
|
-
return generateDocument({
|
|
96
|
-
title: index.title ?? 'Overview',
|
|
97
|
-
description: index.description,
|
|
98
|
-
}, content.join('\n'), options);
|
|
99
|
-
}
|
|
100
|
-
for (const item of typeof items === 'function' ? items(context) : items) {
|
|
101
|
-
files.push({
|
|
102
|
-
path: path.extname(item.path).length === 0 ? `${item.path}.mdx` : item.path,
|
|
103
|
-
content: fileContent(item),
|
|
104
|
-
});
|
|
105
|
-
}
|
|
50
|
+
const { generatedEntries } = context;
|
|
51
|
+
const { items, url } = options.index;
|
|
52
|
+
let urlFn;
|
|
53
|
+
if (typeof url === "object") {
|
|
54
|
+
const getUrl = createGetUrl(url.baseUrl);
|
|
55
|
+
urlFn = (file) => getUrl(getSlugs(path.relative(url.contentDir, file)));
|
|
56
|
+
} else urlFn = url;
|
|
57
|
+
function findEntryByPath(path$1) {
|
|
58
|
+
for (const entries of Object.values(generatedEntries)) {
|
|
59
|
+
const match = entries.find((entry) => entry.path === path$1);
|
|
60
|
+
if (match) return match;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function fileContent(index) {
|
|
64
|
+
const content = [];
|
|
65
|
+
content.push("<Cards>");
|
|
66
|
+
const pathToEntry = /* @__PURE__ */ new Map();
|
|
67
|
+
const only = index.only ?? Object.keys(context.generated);
|
|
68
|
+
for (const item of only) if (generatedEntries[item]) for (const entry of generatedEntries[item]) pathToEntry.set(entry.path, entry);
|
|
69
|
+
else {
|
|
70
|
+
const match = findEntryByPath(item);
|
|
71
|
+
if (!match) throw new Error(`${item} does not exist on "input", available: ${Object.keys(generatedEntries).join(", ")}.`);
|
|
72
|
+
pathToEntry.set(match.path, match);
|
|
73
|
+
}
|
|
74
|
+
for (const file of pathToEntry.values()) {
|
|
75
|
+
const descriptionAttr = file.info.description ? `description=${JSON.stringify(file.info.description)} ` : "";
|
|
76
|
+
content.push(`<Card href="${urlFn(file.path)}" title=${JSON.stringify(file.info.title)} ${descriptionAttr}/>`);
|
|
77
|
+
}
|
|
78
|
+
content.push("</Cards>");
|
|
79
|
+
return generateDocument({
|
|
80
|
+
title: index.title ?? "Overview",
|
|
81
|
+
description: index.description
|
|
82
|
+
}, content.join("\n"), options);
|
|
83
|
+
}
|
|
84
|
+
for (const item of typeof items === "function" ? items(context) : items) files.push({
|
|
85
|
+
path: path.extname(item.path).length === 0 ? `${item.path}.mdx` : item.path,
|
|
86
|
+
content: fileContent(item)
|
|
87
|
+
});
|
|
106
88
|
}
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
export { generateFiles, generateFilesOnly };
|
|
92
|
+
//# sourceMappingURL=generate-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-file.js","names":["files: OutputFile[]","generated: Record<string, OutputFile[]>","generatedEntries: Record<string, OutputEntry[]>","entries","file: OutputFile","context: BeforeWriteContext","urlFn: (path: string) => string","path","content: string[]"],"sources":["../src/generate-file.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { generateDocument, type PagesToTextOptions, toText } from './utils/pages/to-text';\nimport type { ProcessedDocument } from '@/utils/process-document';\nimport type { OpenAPIServer } from '@/server';\nimport { createGetUrl, getSlugs } from 'fumadocs-core/source';\nimport { createAutoPreset, type SchemaToPagesOptions } from '@/utils/pages/preset-auto';\nimport { fromSchema, type OutputEntry } from '@/utils/pages/builder';\n\nexport interface OutputFile {\n path: string;\n content: string;\n}\n\ninterface IndexConfig {\n items: IndexItem[] | ((ctx: BeforeWriteContext) => IndexItem[]);\n\n /**\n * Generate URLs for cards\n */\n url:\n | ((filePath: string) => string)\n | {\n baseUrl: string;\n /**\n * Base content directory\n */\n contentDir: string;\n };\n}\n\ninterface IndexItem {\n path: string;\n title?: string;\n description?: string;\n\n /**\n * Specify linked pages:\n * - items in `inputs` to include all generated pages of a specific schema.\n * - specific Markdown/MDX files.\n */\n only?: string[];\n}\n\ninterface GenerateFilesConfig extends PagesToTextOptions {\n /**\n * the OpenAPI server object\n */\n input: OpenAPIServer;\n\n /**\n * Output directory\n */\n output: string;\n\n /**\n * Generate index files with cards linking to generated pages.\n */\n index?: IndexConfig;\n\n /**\n * Can add/change/remove output files before writing to file system\n **/\n beforeWrite?: (this: BeforeWriteContext, files: OutputFile[]) => void | Promise<void>;\n}\n\nexport type Config = SchemaToPagesOptions & GenerateFilesConfig;\n\ninterface BeforeWriteContext {\n readonly generated: Record<string, OutputFile[]>;\n readonly generatedEntries: Record<string, OutputEntry[]>;\n readonly documents: Record<string, ProcessedDocument>;\n}\n\nexport async function generateFiles(options: Config): Promise<void> {\n const files = await generateFilesOnly(options);\n const { output } = options;\n\n await Promise.all(\n files.map(async (file) => {\n const filePath = path.join(output, file.path);\n\n await mkdir(path.dirname(filePath), { recursive: true });\n await writeFile(filePath, file.content);\n console.log(`Generated: ${filePath}`);\n }),\n );\n}\n\nexport async function generateFilesOnly(\n options: SchemaToPagesOptions & Omit<GenerateFilesConfig, 'output'>,\n): Promise<OutputFile[]> {\n const schemas = await options.input.getSchemas();\n\n const files: OutputFile[] = [];\n const generated: Record<string, OutputFile[]> = {};\n const generatedEntries: Record<string, OutputEntry[]> = {};\n\n const entries = Object.entries(schemas);\n if (entries.length === 0) {\n throw new Error('No input files found.');\n }\n const preset = createAutoPreset(options);\n for (const [id, schema] of entries) {\n const entries = fromSchema(id, schema, preset);\n const schemaFiles = (generated[id] ??= []);\n\n generatedEntries[id] = entries;\n for (const entry of entries) {\n const file: OutputFile = {\n path: entry.path,\n content: toText(entry, schema, options),\n };\n\n schemaFiles.push(file);\n files.push(file);\n }\n }\n\n const context: BeforeWriteContext = {\n generated,\n generatedEntries,\n documents: schemas,\n };\n\n if (options.index) {\n writeIndexFiles(files, context, options);\n }\n\n await options.beforeWrite?.call(context, files);\n return files;\n}\n\nfunction writeIndexFiles(\n files: OutputFile[],\n context: BeforeWriteContext,\n options: SchemaToPagesOptions & Omit<GenerateFilesConfig, 'output'>,\n) {\n const { generatedEntries } = context;\n const { items, url } = options.index!;\n\n let urlFn: (path: string) => string;\n if (typeof url === 'object') {\n const getUrl = createGetUrl(url.baseUrl);\n\n urlFn = (file) => getUrl(getSlugs(path.relative(url.contentDir, file)));\n } else {\n urlFn = url;\n }\n\n function findEntryByPath(path: string) {\n for (const entries of Object.values(generatedEntries)) {\n const match = entries.find((entry) => entry.path === path);\n\n if (match) return match;\n }\n }\n\n function fileContent(index: IndexItem): string {\n const content: string[] = [];\n content.push('<Cards>');\n const pathToEntry = new Map<string, OutputEntry>();\n const only = index.only ?? Object.keys(context.generated);\n\n for (const item of only) {\n if (generatedEntries[item]) {\n for (const entry of generatedEntries[item]) {\n pathToEntry.set(entry.path, entry);\n }\n } else {\n const match = findEntryByPath(item);\n if (!match) {\n throw new Error(\n `${item} does not exist on \"input\", available: ${Object.keys(generatedEntries).join(', ')}.`,\n );\n }\n\n pathToEntry.set(match.path, match);\n }\n }\n\n for (const file of pathToEntry.values()) {\n const descriptionAttr = file.info.description\n ? `description=${JSON.stringify(file.info.description)} `\n : '';\n content.push(\n `<Card href=\"${urlFn(file.path)}\" title=${JSON.stringify(file.info.title)} ${descriptionAttr}/>`,\n );\n }\n\n content.push('</Cards>');\n return generateDocument(\n {\n title: index.title ?? 'Overview',\n description: index.description,\n },\n content.join('\\n'),\n options,\n );\n }\n\n for (const item of typeof items === 'function' ? items(context) : items) {\n files.push({\n path: path.extname(item.path).length === 0 ? `${item.path}.mdx` : item.path,\n content: fileContent(item),\n });\n }\n}\n"],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { MediaAdapter } from "./requests/media/adapter.js";
|
|
2
|
+
import { OperationOutput, OutputEntry, OutputGroup, PagesBuilder, PagesBuilderConfig, TagOutput, WebhookOutput, fromSchema, fromServer } from "./utils/pages/builder.js";
|
|
3
|
+
import { SchemaToPagesOptions, createAutoPreset } from "./utils/pages/preset-auto.js";
|
|
4
|
+
import { CallbackObject, Document, MethodInformation, OperationObject, ParameterObject, PathItemObject, ReferenceObject, RenderContext, ResponseObject, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject } from "./types.js";
|
|
5
|
+
import { Config, OutputFile, generateFiles, generateFilesOnly } from "./generate-file.js";
|
|
6
|
+
export { CallbackObject, Config, Document, type MediaAdapter, MethodInformation, OperationObject, OperationOutput, OutputEntry, OutputFile, OutputGroup, PagesBuilder, PagesBuilderConfig, ParameterObject, PathItemObject, ReferenceObject, RenderContext, ResponseObject, SchemaToPagesOptions, SecuritySchemeObject, ServerObject, ServerVariableObject, TagObject, TagOutput, WebhookOutput, createAutoPreset, fromSchema, fromServer, generateFiles, generateFilesOnly };
|
package/dist/index.js
CHANGED
|
@@ -1,79 +1,95 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { SchemaScope } from
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { ParsedSchema } from "../utils/schema.js";
|
|
2
|
+
import { RequestData } from "../requests/types.js";
|
|
3
|
+
import { FetchResult } from "./fetcher.js";
|
|
4
|
+
import { ParameterField, SecurityEntry } from "./index.js";
|
|
5
|
+
import { SchemaScope } from "./schema.js";
|
|
6
|
+
import { ComponentProps, FC, ReactNode } from "react";
|
|
7
|
+
import { FieldPath, UseControllerProps, UseControllerReturn } from "react-hook-form";
|
|
8
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/playground/client.d.ts
|
|
11
|
+
interface FormValues {
|
|
12
|
+
path: Record<string, unknown>;
|
|
13
|
+
query: Record<string, unknown>;
|
|
14
|
+
header: Record<string, unknown>;
|
|
15
|
+
cookie: Record<string, unknown>;
|
|
16
|
+
body: unknown;
|
|
17
|
+
/**
|
|
18
|
+
* Store the cached encoded request data, do not modify it.
|
|
19
|
+
*/
|
|
20
|
+
_encoded?: RequestData;
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
interface PlaygroundClientProps extends ComponentProps<'form'>, SchemaScope {
|
|
23
|
+
route: string;
|
|
24
|
+
method: string;
|
|
25
|
+
parameters?: ParameterField[];
|
|
26
|
+
securities: SecurityEntry[][];
|
|
27
|
+
body?: {
|
|
28
|
+
schema: ParsedSchema;
|
|
29
|
+
mediaType: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Resolver for $ref schemas you've passed
|
|
33
|
+
*/
|
|
34
|
+
references: Record<string, ParsedSchema>;
|
|
35
|
+
proxyUrl?: string;
|
|
33
36
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}>;
|
|
37
|
+
interface PlaygroundClientOptions {
|
|
38
|
+
/**
|
|
39
|
+
* transform fields for auth-specific parameters (e.g. header)
|
|
40
|
+
*/
|
|
41
|
+
transformAuthInputs?: (fields: AuthField[]) => AuthField[];
|
|
42
|
+
/**
|
|
43
|
+
* Request timeout in seconds (default: 10s)
|
|
44
|
+
*/
|
|
45
|
+
requestTimeout?: number;
|
|
46
|
+
components?: Partial<{
|
|
47
|
+
ResultDisplay: FC<{
|
|
48
|
+
data: FetchResult;
|
|
47
49
|
}>;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* render the paremeter inputs of API endpoint.
|
|
53
|
+
*
|
|
54
|
+
* It uses `react-hook-form`, you can use either:
|
|
55
|
+
* - the library itself, with types from `fumadocs-openapi/playground/client`.
|
|
56
|
+
* - the `Custom.useController()` from `fumadocs-openapi/playground/client`.
|
|
57
|
+
*
|
|
58
|
+
* Recommended types packages: `json-schema-typed`, `openapi-types`.
|
|
59
|
+
*/
|
|
60
|
+
renderParameterField?: (fieldName: FieldPath<FormValues>, param: ParameterField) => ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* render the input for API endpoint body.
|
|
63
|
+
*
|
|
64
|
+
* @see renderParameterField for customisation tips
|
|
65
|
+
*/
|
|
66
|
+
renderBodyField?: (fieldName: 'body', info: {
|
|
67
|
+
schema: ParsedSchema;
|
|
68
|
+
mediaType: string;
|
|
69
|
+
}) => ReactNode;
|
|
67
70
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
declare function PlaygroundClient({
|
|
72
|
+
route,
|
|
73
|
+
method,
|
|
74
|
+
securities,
|
|
75
|
+
parameters,
|
|
76
|
+
body,
|
|
77
|
+
references,
|
|
78
|
+
proxyUrl,
|
|
79
|
+
writeOnly,
|
|
80
|
+
readOnly,
|
|
81
|
+
...rest
|
|
82
|
+
}: PlaygroundClientProps): react_jsx_runtime0.JSX.Element;
|
|
83
|
+
interface AuthField {
|
|
84
|
+
fieldName: string;
|
|
85
|
+
defaultValue: unknown;
|
|
86
|
+
original?: SecurityEntry;
|
|
87
|
+
children: ReactNode;
|
|
88
|
+
mapOutput?: (values: unknown) => unknown;
|
|
75
89
|
}
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
declare const Custom: {
|
|
91
|
+
useController<TName extends FieldPath<FormValues> = "path" | "query" | "header" | "cookie" | "body" | "_encoded" | `path.${string}` | `query.${string}` | `header.${string}` | `cookie.${string}` | "_encoded.path" | "_encoded.query" | "_encoded.header" | "_encoded.cookie" | "_encoded.body" | `_encoded.path.${string}` | `_encoded.query.${string}` | `_encoded.header.${string}` | `_encoded.cookie.${string}` | "_encoded.method" | "_encoded.bodyMediaType", TTransformedValues = FormValues>(props: UseControllerProps<FormValues, TName, TTransformedValues>): UseControllerReturn<FormValues, TName>;
|
|
78
92
|
};
|
|
93
|
+
//#endregion
|
|
94
|
+
export { AuthField, Custom, FormValues, PlaygroundClientOptions, PlaygroundClientProps, PlaygroundClient as default };
|
|
79
95
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/playground/client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;UAoDiB,UAAA;QACT;SACC;EAFQ,MAAA,EAGP,MAHiB,CAAA,MAAA,EAAA,OAAA,CAAA;EACnB,MAAA,EAGE,MAHF,CAAA,MAAA,EAAA,OAAA,CAAA;EACC,IAAA,EAAA,OAAA;EACC;;;EAOc,QAAA,CAAA,EAAX,WAAW;AAGxB;AAGe,UAHE,qBAAA,SAA8B,cAGhC,CAAA,MAAA,CAAA,EAHwD,WAGxD,CAAA;EACD,KAAA,EAAA,MAAA;EAEF,MAAA,EAAA,MAAA;EAMiB,UAAA,CAAA,EATd,cASc,EAAA;EAAf,UAAA,EARA,aAQA,EAAA,EAAA;EAZiC,IAAA,CAAA,EAAA;IAAwB,MAAA,EAM3D,YAN2D;IAAW,SAAA,EAAA,MAAA;EAgBjE,CAAA;EAIgB;;;EAQd,UAAA,EAhBL,MAgBK,CAAA,MAAA,EAhBU,YAgBV,CAAA;EADJ,QAAA,CAAA,EAAA,MAAA;;AAasB,UAxBpB,uBAAA,CAwBoB;EAA8B;;;EAa5D,mBAAA,CAAA,EAAA,CAAA,MAAA,EAjC0B,SAiC1B,EAAA,EAAA,GAjC0C,SAiC1C,EAAA;EAAS;AACf;;EAeC,cAAA,CAAA,EAAA,MAAA;EACA,UAAA,CAAA,EA3Ca,OA2Cb,CAAA;IACA,aAAA,EA3CiB,EA2CjB,CAAA;MACA,IAAA,EA5C4B,WA4C5B;IACA,CAAA,CAAA;EACA,CAAA,CAAA;EACA;;;;;AA6VF;AA8QA;;;EAGsB,oBAAA,CAAA,EAAA,CAAA,SAAA,EAjpBe,SAipBf,CAjpByB,UAipBzB,CAAA,EAAA,KAAA,EAjpB6C,cAipB7C,EAAA,GAjpBgE,SAipBhE;EAEQ;;;;;EACO,eAAA,CAAA,EAAA,CAAA,SAAA,EAAA,MAAA,EAAA,IAAA,EAAA;IAAhC,MAAA,EA1oBS,YA0oBT;IAAmB,SAAA,EAAA,MAAA;QAvoBjB;;iBAciB,gBAAA;;;;;;;;;;;GAWrB,wBAAqB,kBAAA,CAAA,GAAA,CAAA;UA0VP,SAAA;;;aAIJ;YACD;;;cAyQC;8BAEK,UAAU,qbACN,mBAEX,mBAAmB,YAAY,OAAO,sBAC5C,oBAAoB,YAAY"}
|