zudoku 0.1.1-dev.18 → 0.1.1-dev.19
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/lib/plugins/openapi/worker/createSharedWorkerClient.js +2 -3
- package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -1
- package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +1 -0
- package/dist/lib/plugins/openapi/worker/shared-worker.js +6 -0
- package/dist/lib/plugins/openapi/worker/shared-worker.js.map +1 -0
- package/dist/vite/config.d.ts +1 -1
- package/dist/vite/config.js +13 -13
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/dev-server.js +1 -1
- package/dist/vite/dev-server.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +12 -0
- package/lib/zudoku.plugins.js +1318 -1323
- package/package.json +5 -2
- package/src/cli/build/handler.ts +14 -0
- package/src/cli/cli.ts +77 -0
- package/src/cli/cmds/build.ts +24 -0
- package/src/cli/cmds/dev.ts +29 -0
- package/src/cli/common/analytics/lib.ts +89 -0
- package/src/cli/common/constants.ts +10 -0
- package/src/cli/common/logger.ts +5 -0
- package/src/cli/common/machine-id/lib.ts +85 -0
- package/src/cli/common/outdated.ts +102 -0
- package/src/cli/common/output.ts +86 -0
- package/src/cli/common/utils/box.license.txt +202 -0
- package/src/cli/common/utils/box.ts +116 -0
- package/src/cli/common/utils/ports.ts +21 -0
- package/src/cli/common/validators/lib.ts +43 -0
- package/src/cli/common/xdg/lib.ts +36 -0
- package/src/cli/dev/handler.ts +42 -0
- package/src/config/config.ts +56 -0
- package/src/index.ts +8 -0
- package/src/lib/DevPortal.tsx +93 -0
- package/src/lib/Heading.tsx +60 -0
- package/src/lib/Router.tsx +28 -0
- package/src/lib/auth.ts +1 -0
- package/src/lib/authentication/authentication.ts +18 -0
- package/src/lib/authentication/clerk.ts +45 -0
- package/src/lib/authentication/openid.ts +192 -0
- package/src/lib/components/AnchorLink.tsx +19 -0
- package/src/lib/components/CategoryHeading.tsx +16 -0
- package/src/lib/components/Dialog.tsx +119 -0
- package/src/lib/components/DynamicIcon.tsx +60 -0
- package/src/lib/components/Header.tsx +69 -0
- package/src/lib/components/Input.tsx +24 -0
- package/src/lib/components/Layout.tsx +56 -0
- package/src/lib/components/Markdown.tsx +37 -0
- package/src/lib/components/SyntaxHighlight.tsx +94 -0
- package/src/lib/components/TopNavigation.tsx +32 -0
- package/src/lib/components/context/ComponentsContext.tsx +24 -0
- package/src/lib/components/context/DevPortalProvider.ts +54 -0
- package/src/lib/components/context/PluginSystem.ts +0 -0
- package/src/lib/components/context/ThemeContext.tsx +46 -0
- package/src/lib/components/context/ViewportAnchorContext.tsx +139 -0
- package/src/lib/components/navigation/SideNavigation.tsx +18 -0
- package/src/lib/components/navigation/SideNavigationCategory.tsx +74 -0
- package/src/lib/components/navigation/SideNavigationItem.tsx +143 -0
- package/src/lib/components/navigation/SideNavigationWrapper.tsx +15 -0
- package/src/lib/components/navigation/useNavigationCollapsibleState.ts +27 -0
- package/src/lib/components/navigation/util.ts +38 -0
- package/src/lib/components.ts +3 -0
- package/src/lib/core/DevPortalContext.ts +164 -0
- package/src/lib/core/helmet.ts +5 -0
- package/src/lib/core/icons.tsx +1 -0
- package/src/lib/core/plugins.ts +43 -0
- package/src/lib/core/router.tsx +1 -0
- package/src/lib/core/types/combine.ts +16 -0
- package/src/lib/oas/graphql/index.ts +422 -0
- package/src/lib/oas/graphql/server.ts +10 -0
- package/src/lib/oas/parser/dereference/index.ts +59 -0
- package/src/lib/oas/parser/dereference/resolveRef.ts +32 -0
- package/src/lib/oas/parser/index.ts +94 -0
- package/src/lib/oas/parser/schemas/v3.0.json +1489 -0
- package/src/lib/oas/parser/schemas/v3.1.json +1298 -0
- package/src/lib/oas/parser/upgrade/index.ts +108 -0
- package/src/lib/plugins/api-key/SettingsApiKeys.tsx +22 -0
- package/src/lib/plugins/api-key/index.tsx +123 -0
- package/src/lib/plugins/markdown/MdxPage.tsx +128 -0
- package/src/lib/plugins/markdown/Toc.tsx +122 -0
- package/src/lib/plugins/markdown/generateRoutes.tsx +72 -0
- package/src/lib/plugins/markdown/index.tsx +31 -0
- package/src/lib/plugins/openapi/ColorizedParam.tsx +82 -0
- package/src/lib/plugins/openapi/MakeRequest.tsx +49 -0
- package/src/lib/plugins/openapi/MethodBadge.tsx +36 -0
- package/src/lib/plugins/openapi/OperationList.tsx +117 -0
- package/src/lib/plugins/openapi/OperationListItem.tsx +55 -0
- package/src/lib/plugins/openapi/ParameterList.tsx +32 -0
- package/src/lib/plugins/openapi/ParameterListItem.tsx +60 -0
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +51 -0
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +60 -0
- package/src/lib/plugins/openapi/Select.tsx +35 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +160 -0
- package/src/lib/plugins/openapi/SidecarBox.tsx +36 -0
- package/src/lib/plugins/openapi/graphql/fragment-masking.ts +111 -0
- package/src/lib/plugins/openapi/graphql/gql.ts +70 -0
- package/src/lib/plugins/openapi/graphql/graphql.ts +795 -0
- package/src/lib/plugins/openapi/graphql/index.ts +2 -0
- package/src/lib/plugins/openapi/index.tsx +142 -0
- package/src/lib/plugins/openapi/playground/Playground.tsx +309 -0
- package/src/lib/plugins/openapi/queries.graphql +6 -0
- package/src/lib/plugins/openapi/util/generateSchemaExample.ts +59 -0
- package/src/lib/plugins/openapi/util/urql.ts +8 -0
- package/src/lib/plugins/openapi/worker/createSharedWorkerClient.ts +60 -0
- package/src/lib/plugins/openapi/worker/shared-worker.ts +5 -0
- package/src/lib/plugins/openapi/worker/worker.ts +30 -0
- package/src/lib/plugins/redirect/index.tsx +20 -0
- package/src/lib/plugins.ts +5 -0
- package/src/lib/ui/Button.tsx +56 -0
- package/src/lib/ui/Callout.tsx +87 -0
- package/src/lib/ui/Card.tsx +82 -0
- package/src/lib/ui/Note.tsx +58 -0
- package/src/lib/ui/Tabs.tsx +52 -0
- package/src/lib/util/MdxComponents.tsx +70 -0
- package/src/lib/util/cn.ts +6 -0
- package/src/lib/util/createVariantComponent.tsx +30 -0
- package/src/lib/util/createWaitForNotify.ts +18 -0
- package/src/lib/util/groupBy.ts +24 -0
- package/src/lib/util/joinPath.tsx +10 -0
- package/src/lib/util/pastellize.ts +25 -0
- package/src/lib/util/slugify.ts +3 -0
- package/src/lib/util/traverseNavigation.ts +55 -0
- package/src/lib/util/useScrollToAnchor.ts +38 -0
- package/src/lib/util/useScrollToTop.ts +13 -0
- package/src/ts.ts +94 -0
- package/src/types.d.ts +24 -0
- package/src/vite/build.ts +33 -0
- package/src/vite/config.test.ts +10 -0
- package/src/vite/config.ts +183 -0
- package/src/vite/dev-server.ts +64 -0
- package/src/vite/html.ts +37 -0
- package/src/vite/plugin-api.ts +57 -0
- package/src/vite/plugin-auth.ts +32 -0
- package/src/vite/plugin-component.ts +26 -0
- package/src/vite/plugin-config.ts +31 -0
- package/src/vite/plugin-docs.test.ts +32 -0
- package/src/vite/plugin-docs.ts +52 -0
- package/src/vite/plugin-html.ts +50 -0
- package/src/vite/plugin-mdx.ts +74 -0
- package/src/vite/plugin-metadata.ts +30 -0
- package/src/vite/plugin.ts +23 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
import { cn } from "../../util/cn.js";
|
|
3
|
+
|
|
4
|
+
type BaseComponentProps<T = unknown> = PropsWithChildren<
|
|
5
|
+
T & { className?: string }
|
|
6
|
+
>;
|
|
7
|
+
|
|
8
|
+
export const Root = ({ children, className }: BaseComponentProps) => (
|
|
9
|
+
<div
|
|
10
|
+
className={cn(
|
|
11
|
+
"rounded-lg overflow-hidden border border-border dark:border-transparent",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const Head = ({ children, className }: BaseComponentProps) => (
|
|
20
|
+
<div
|
|
21
|
+
className={cn(
|
|
22
|
+
"border-b border-b-border dark:border-b-zinc-600 bg-zinc-100 dark:bg-zinc-700 p-2",
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export const Body = ({ children, className }: BaseComponentProps) => (
|
|
31
|
+
<div
|
|
32
|
+
className={cn("bg-zinc-50 dark:bg-zinc-800 overflow-auto p-2", className)}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type {
|
|
3
|
+
ResultOf,
|
|
4
|
+
DocumentTypeDecoration,
|
|
5
|
+
TypedDocumentNode,
|
|
6
|
+
} from "@graphql-typed-document-node/core";
|
|
7
|
+
import type { FragmentDefinitionNode } from "graphql";
|
|
8
|
+
import type { Incremental } from "./graphql.js";
|
|
9
|
+
|
|
10
|
+
export type FragmentType<
|
|
11
|
+
TDocumentType extends DocumentTypeDecoration<any, any>,
|
|
12
|
+
> =
|
|
13
|
+
TDocumentType extends DocumentTypeDecoration<infer TType, any>
|
|
14
|
+
? [TType] extends [{ " $fragmentName"?: infer TKey }]
|
|
15
|
+
? TKey extends string
|
|
16
|
+
? { " $fragmentRefs"?: { [key in TKey]: TType } }
|
|
17
|
+
: never
|
|
18
|
+
: never
|
|
19
|
+
: never;
|
|
20
|
+
|
|
21
|
+
// return non-nullable if `fragmentType` is non-nullable
|
|
22
|
+
export function useFragment<TType>(
|
|
23
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
24
|
+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>,
|
|
25
|
+
): TType;
|
|
26
|
+
// return nullable if `fragmentType` is undefined
|
|
27
|
+
export function useFragment<TType>(
|
|
28
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
29
|
+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined,
|
|
30
|
+
): TType | undefined;
|
|
31
|
+
// return nullable if `fragmentType` is nullable
|
|
32
|
+
export function useFragment<TType>(
|
|
33
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
34
|
+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null,
|
|
35
|
+
): TType | null;
|
|
36
|
+
// return nullable if `fragmentType` is nullable or undefined
|
|
37
|
+
export function useFragment<TType>(
|
|
38
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
39
|
+
fragmentType:
|
|
40
|
+
| FragmentType<DocumentTypeDecoration<TType, any>>
|
|
41
|
+
| null
|
|
42
|
+
| undefined,
|
|
43
|
+
): TType | null | undefined;
|
|
44
|
+
// return array of non-nullable if `fragmentType` is array of non-nullable
|
|
45
|
+
export function useFragment<TType>(
|
|
46
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
47
|
+
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>,
|
|
48
|
+
): Array<TType>;
|
|
49
|
+
// return array of nullable if `fragmentType` is array of nullable
|
|
50
|
+
export function useFragment<TType>(
|
|
51
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
52
|
+
fragmentType:
|
|
53
|
+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
|
|
54
|
+
| null
|
|
55
|
+
| undefined,
|
|
56
|
+
): Array<TType> | null | undefined;
|
|
57
|
+
// return readonly array of non-nullable if `fragmentType` is array of non-nullable
|
|
58
|
+
export function useFragment<TType>(
|
|
59
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
60
|
+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>,
|
|
61
|
+
): ReadonlyArray<TType>;
|
|
62
|
+
// return readonly array of nullable if `fragmentType` is array of nullable
|
|
63
|
+
export function useFragment<TType>(
|
|
64
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
65
|
+
fragmentType:
|
|
66
|
+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
|
|
67
|
+
| null
|
|
68
|
+
| undefined,
|
|
69
|
+
): ReadonlyArray<TType> | null | undefined;
|
|
70
|
+
export function useFragment<TType>(
|
|
71
|
+
_documentNode: DocumentTypeDecoration<TType, any>,
|
|
72
|
+
fragmentType:
|
|
73
|
+
| FragmentType<DocumentTypeDecoration<TType, any>>
|
|
74
|
+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
|
|
75
|
+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
|
|
76
|
+
| null
|
|
77
|
+
| undefined,
|
|
78
|
+
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
|
|
79
|
+
return fragmentType as any;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function makeFragmentData<
|
|
83
|
+
F extends DocumentTypeDecoration<any, any>,
|
|
84
|
+
FT extends ResultOf<F>,
|
|
85
|
+
>(data: FT, _fragment: F): FragmentType<F> {
|
|
86
|
+
return data as FragmentType<F>;
|
|
87
|
+
}
|
|
88
|
+
export function isFragmentReady<TQuery, TFrag>(
|
|
89
|
+
queryNode: DocumentTypeDecoration<TQuery, any>,
|
|
90
|
+
fragmentNode: TypedDocumentNode<TFrag>,
|
|
91
|
+
data:
|
|
92
|
+
| FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>
|
|
93
|
+
| null
|
|
94
|
+
| undefined,
|
|
95
|
+
): data is FragmentType<typeof fragmentNode> {
|
|
96
|
+
const deferredFields = (
|
|
97
|
+
queryNode as {
|
|
98
|
+
__meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };
|
|
99
|
+
}
|
|
100
|
+
).__meta__?.deferredFields;
|
|
101
|
+
|
|
102
|
+
if (!deferredFields) return true;
|
|
103
|
+
|
|
104
|
+
const fragDef = fragmentNode.definitions[0] as
|
|
105
|
+
| FragmentDefinitionNode
|
|
106
|
+
| undefined;
|
|
107
|
+
const fragName = fragDef?.name?.value;
|
|
108
|
+
|
|
109
|
+
const fields = (fragName && deferredFields[fragName]) || [];
|
|
110
|
+
return fields.length > 0 && fields.every((field) => data && field in data);
|
|
111
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import * as types from "./graphql.js";
|
|
3
|
+
import type { TypedDocumentNode as DocumentNode } from "@graphql-typed-document-node/core";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Map of all GraphQL operations in the project.
|
|
7
|
+
*
|
|
8
|
+
* This map has several performance disadvantages:
|
|
9
|
+
* 1. It is not tree-shakeable, so it will include all operations in the project.
|
|
10
|
+
* 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
|
|
11
|
+
* 3. It does not support dead code elimination, so it will add unused operations.
|
|
12
|
+
*
|
|
13
|
+
* Therefore it is highly recommended to use the babel or swc plugin for production.
|
|
14
|
+
*/
|
|
15
|
+
const documents = {
|
|
16
|
+
"\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n }\n }\n":
|
|
17
|
+
types.GetServerQueryDocument,
|
|
18
|
+
"\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n parameters {\n name\n in\n description\n required\n schema\n style\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n":
|
|
19
|
+
types.OperationsFragmentFragmentDoc,
|
|
20
|
+
"\n query AllOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n description\n title\n url\n version\n tags {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n }\n }\n }\n":
|
|
21
|
+
types.AllOperationsDocument,
|
|
22
|
+
"\n query GetCategories($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n __typename\n name\n operations {\n __typename\n slug\n method\n summary\n operationId\n path\n }\n }\n }\n }\n":
|
|
23
|
+
types.GetCategoriesDocument,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* The query argument is unknown!
|
|
36
|
+
* Please regenerate the types.
|
|
37
|
+
*/
|
|
38
|
+
export function graphql(source: string): unknown;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
42
|
+
*/
|
|
43
|
+
export function graphql(
|
|
44
|
+
source: "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n }\n }\n",
|
|
45
|
+
): (typeof documents)["\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n }\n }\n"];
|
|
46
|
+
/**
|
|
47
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
48
|
+
*/
|
|
49
|
+
export function graphql(
|
|
50
|
+
source: "\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n parameters {\n name\n in\n description\n required\n schema\n style\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n",
|
|
51
|
+
): (typeof documents)["\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n parameters {\n name\n in\n description\n required\n schema\n style\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n"];
|
|
52
|
+
/**
|
|
53
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
54
|
+
*/
|
|
55
|
+
export function graphql(
|
|
56
|
+
source: "\n query AllOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n description\n title\n url\n version\n tags {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n }\n }\n }\n",
|
|
57
|
+
): (typeof documents)["\n query AllOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n description\n title\n url\n version\n tags {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n }\n }\n }\n"];
|
|
58
|
+
/**
|
|
59
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
60
|
+
*/
|
|
61
|
+
export function graphql(
|
|
62
|
+
source: "\n query GetCategories($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n __typename\n name\n operations {\n __typename\n slug\n method\n summary\n operationId\n path\n }\n }\n }\n }\n",
|
|
63
|
+
): (typeof documents)["\n query GetCategories($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n __typename\n name\n operations {\n __typename\n slug\n method\n summary\n operationId\n path\n }\n }\n }\n }\n"];
|
|
64
|
+
|
|
65
|
+
export function graphql(source: string) {
|
|
66
|
+
return (documents as any)[source] ?? {};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> =
|
|
70
|
+
TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
|