zudoku 0.1.1-dev.1 → 0.1.1-dev.11
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/cli.js +2 -0
- package/dist/app/App.js +20 -0
- package/dist/app/App.js.map +1 -0
- package/dist/app/DevPortal.d.ts +0 -1
- package/dist/app/authentication/openid.js +2 -2
- package/dist/app/authentication/openid.js.map +1 -1
- package/dist/app/components/Dialog.d.ts +19 -0
- package/dist/app/components/Dialog.js +23 -0
- package/dist/app/components/Dialog.js.map +1 -0
- package/dist/app/components/Header.d.ts +0 -1
- package/dist/app/components/Input.d.ts +5 -0
- package/dist/app/components/Input.js +9 -0
- package/dist/app/components/Input.js.map +1 -0
- package/dist/app/components/SyntaxHighlight.js +2 -0
- package/dist/app/components/SyntaxHighlight.js.map +1 -1
- package/dist/app/components/context/DevPortalProvider.d.ts +0 -1
- package/dist/app/components/navigation/SideNavigationWrapper.d.ts +1 -2
- package/dist/app/components/navigation/useNavigationCollapsibleState.d.ts +0 -1
- package/dist/app/main.js +3 -15
- package/dist/app/main.js.map +1 -1
- package/dist/app/plugins/markdown/index.d.ts +0 -1
- package/dist/app/plugins/openapi/ColorizedParam.d.ts +5 -1
- package/dist/app/plugins/openapi/ColorizedParam.js +10 -5
- package/dist/app/plugins/openapi/ColorizedParam.js.map +1 -1
- package/dist/app/plugins/openapi/MakeRequest.js +18 -6
- package/dist/app/plugins/openapi/MakeRequest.js.map +1 -1
- package/dist/app/plugins/openapi/OperationList.d.ts +2 -45
- package/dist/app/plugins/openapi/OperationList.js +16 -16
- package/dist/app/plugins/openapi/OperationList.js.map +1 -1
- package/dist/app/plugins/openapi/OperationListItem.d.ts +2 -2
- package/dist/app/plugins/openapi/OperationListItem.js +2 -2
- package/dist/app/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/app/plugins/openapi/RequestBodySidecarBox.js +8 -8
- package/dist/app/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/app/plugins/openapi/ResponsesSidecarBox.js +1 -1
- package/dist/app/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/app/plugins/openapi/Sidecar.js +73 -18
- package/dist/app/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/app/plugins/openapi/SidecarBox.d.ts +3 -5
- package/dist/app/plugins/openapi/SidecarBox.js +3 -5
- package/dist/app/plugins/openapi/SidecarBox.js.map +1 -1
- package/dist/app/plugins/openapi/graphql/fragment-masking.d.ts +19 -0
- package/dist/app/plugins/openapi/graphql/fragment-masking.js +16 -0
- package/dist/app/plugins/openapi/graphql/fragment-masking.js.map +1 -0
- package/dist/app/plugins/openapi/graphql/gql.d.ts +58 -0
- package/dist/app/plugins/openapi/graphql/gql.js +22 -0
- package/dist/app/plugins/openapi/graphql/gql.js.map +1 -0
- package/dist/app/plugins/openapi/graphql/graphql.d.ts +282 -0
- package/dist/app/plugins/openapi/graphql/graphql.js +526 -0
- package/dist/app/plugins/openapi/graphql/graphql.js.map +1 -0
- package/dist/app/plugins/openapi/graphql/index.d.ts +2 -836
- package/dist/app/plugins/openapi/graphql/index.js +2 -3
- package/dist/app/plugins/openapi/graphql/index.js.map +1 -1
- package/dist/app/plugins/openapi/index.d.ts +0 -1
- package/dist/app/plugins/openapi/playground/Playground.d.ts +8 -0
- package/dist/app/plugins/openapi/playground/Playground.js +98 -0
- package/dist/app/plugins/openapi/playground/Playground.js.map +1 -0
- package/dist/app/plugins/openapi/util/urql.d.ts +0 -1
- package/dist/app/ui/Button.d.ts +11 -0
- package/dist/app/ui/Button.js +34 -0
- package/dist/app/ui/Button.js.map +1 -0
- package/dist/app/ui/Card.js +1 -1
- package/dist/app/ui/Card.js.map +1 -1
- package/dist/app/ui/Tabs.d.ts +7 -0
- package/dist/app/ui/Tabs.js +13 -0
- package/dist/app/ui/Tabs.js.map +1 -0
- package/dist/app/util/MdxComponents.d.ts +2 -2
- package/dist/app/util/createVariantComponent.d.ts +15 -0
- package/dist/app/util/createVariantComponent.js +12 -0
- package/dist/app/util/createVariantComponent.js.map +1 -0
- package/dist/app/util/createWaitForNotify.d.ts +1 -1
- package/dist/app/util/slugify.d.ts +0 -1
- package/dist/cli/cmds/dev.js +0 -1
- package/dist/cli/cmds/dev.js.map +1 -1
- package/dist/cli/common/logger.d.ts +1 -2
- package/dist/cli/common/logger.js +2 -4
- package/dist/cli/common/logger.js.map +1 -1
- package/dist/cli/dev/handler.d.ts +1 -1
- package/dist/cli/dev/handler.js +11 -2
- package/dist/cli/dev/handler.js.map +1 -1
- package/dist/config/config.d.ts +11 -5
- package/dist/ts.d.ts +6 -0
- package/dist/ts.js +62 -0
- package/dist/ts.js.map +1 -0
- package/dist/vite/config.d.ts +1 -0
- package/dist/vite/config.js +80 -16
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/config.test.d.ts +1 -0
- package/dist/vite/config.test.js +10 -0
- package/dist/vite/config.test.js.map +1 -0
- package/dist/vite/dev-server.js +3 -2
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/html.d.ts +1 -1
- package/dist/vite/html.js +2 -3
- package/dist/vite/html.js.map +1 -1
- package/dist/vite/plugin-api.d.ts +4 -0
- package/dist/vite/plugin-api.js +47 -0
- package/dist/vite/plugin-api.js.map +1 -0
- package/dist/vite/plugin-auth.d.ts +4 -0
- package/dist/vite/plugin-auth.js +29 -0
- package/dist/vite/plugin-auth.js.map +1 -0
- package/dist/vite/plugin-config.d.ts +6 -0
- package/dist/vite/plugin-config.js +24 -0
- package/dist/vite/plugin-config.js.map +1 -0
- package/dist/vite/plugin-docs.d.ts +4 -0
- package/dist/vite/plugin-docs.js +43 -0
- package/dist/vite/plugin-docs.js.map +1 -0
- package/dist/vite/plugin-docs.test.d.ts +1 -0
- package/dist/vite/plugin-docs.test.js +31 -0
- package/dist/vite/plugin-docs.test.js.map +1 -0
- package/dist/vite/plugin-html.d.ts +3 -0
- package/dist/vite/plugin-html.js +50 -0
- package/dist/vite/plugin-html.js.map +1 -0
- package/dist/vite/plugin-mdx.d.ts +8 -0
- package/dist/vite/plugin-mdx.js +61 -0
- package/dist/vite/plugin-mdx.js.map +1 -0
- package/dist/vite/plugin-metadata.d.ts +6 -0
- package/dist/vite/plugin-metadata.js +24 -0
- package/dist/vite/plugin-metadata.js.map +1 -0
- package/dist/vite/plugin.d.ts +2 -6
- package/dist/vite/plugin.js +14 -104
- package/dist/vite/plugin.js.map +1 -1
- package/package.json +32 -22
- package/src/app/App.tsx +30 -0
- package/src/app/components/Dialog.tsx +119 -0
- package/src/app/components/Input.tsx +24 -0
- package/src/app/components/SyntaxHighlight.tsx +2 -0
- package/src/app/main.tsx +3 -16
- package/src/app/plugins/openapi/ColorizedParam.tsx +18 -9
- package/src/app/plugins/openapi/MakeRequest.tsx +19 -0
- package/src/app/plugins/openapi/OperationList.tsx +20 -22
- package/src/app/plugins/openapi/OperationListItem.tsx +3 -3
- package/src/app/plugins/openapi/RequestBodySidecarBox.tsx +31 -28
- package/src/app/plugins/openapi/ResponsesSidecarBox.tsx +1 -1
- package/src/app/plugins/openapi/Sidecar.tsx +81 -20
- package/src/app/plugins/openapi/SidecarBox.tsx +30 -29
- package/src/app/plugins/openapi/graphql/fragment-masking.ts +111 -0
- package/src/app/plugins/openapi/graphql/gql.ts +70 -0
- package/src/app/plugins/openapi/graphql/graphql.ts +795 -0
- package/src/app/plugins/openapi/graphql/index.ts +2 -13
- package/src/app/plugins/openapi/playground/Playground.tsx +309 -0
- package/src/app/plugins/openapi/queries.graphql +6 -0
- package/src/app/ui/Button.tsx +56 -0
- package/src/app/ui/Card.tsx +1 -1
- package/src/app/ui/Tabs.tsx +52 -0
- package/src/app/util/createVariantComponent.tsx +30 -0
- package/dist/app/app.js +0 -69
- package/dist/app/app.js.map +0 -1
- package/dist/app/config.d.ts +0 -3
- package/dist/app/config.js +0 -9
- package/dist/app/config.js.map +0 -1
- package/dist/app/markdowns.d.ts +0 -3
- package/dist/app/markdowns.js +0 -5
- package/dist/app/markdowns.js.map +0 -1
- package/dist/app/plugins/openapi/util/getCode.d.ts +0 -2
- package/dist/app/plugins/openapi/util/getCode.js +0 -54
- package/dist/app/plugins/openapi/util/getCode.js.map +0 -1
- package/src/app/app.tsx +0 -85
- package/src/app/config.ts +0 -20
- package/src/app/markdowns.ts +0 -7
- package/src/app/plugins/openapi/graphql/env.d.ts +0 -48
- package/src/app/plugins/openapi/util/getCode.tsx +0 -69
- /package/dist/app/{app.d.ts → App.d.ts} +0 -0
package/src/app/app.tsx
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import "./main.css";
|
|
2
|
-
|
|
3
|
-
import DevPortal from "./DevPortal.js";
|
|
4
|
-
import { markdownPlugin } from "./plugins/markdown/index.js";
|
|
5
|
-
import { openApiPlugin } from "./plugins/openapi/index.js";
|
|
6
|
-
|
|
7
|
-
import config from "./config.js";
|
|
8
|
-
|
|
9
|
-
// async function getAuthProvider(authConfig: AuthenticationConfig) {
|
|
10
|
-
// if (authConfig.type === "clerk") {
|
|
11
|
-
// const clerkProvider = await import("./authentication/clerk.js");
|
|
12
|
-
// return clerkProvider(authConfig);
|
|
13
|
-
// } else {
|
|
14
|
-
// throw new Error(
|
|
15
|
-
// `The authentication type "${authConfig.type}" is not supported.`,
|
|
16
|
-
// );
|
|
17
|
-
// }
|
|
18
|
-
// //openIdAuth({
|
|
19
|
-
// // clientId: oauth.client_id,
|
|
20
|
-
// // authorizationEndpoint: oauth.authorize_url,
|
|
21
|
-
// // tokenEndpoint: oauth.token_fetch_url,
|
|
22
|
-
// // })
|
|
23
|
-
// }
|
|
24
|
-
|
|
25
|
-
export default function App() {
|
|
26
|
-
return (
|
|
27
|
-
<DevPortal
|
|
28
|
-
meta={{
|
|
29
|
-
headerTitle: config?.ui?.headerTitle ?? "Developer Portal",
|
|
30
|
-
pageTitle: config?.ui?.pageTitle ?? "%s | Dev Portal",
|
|
31
|
-
logo: config?.ui?.logo ?? "https://cdn.zuplo.com/www/favicon.png",
|
|
32
|
-
favicon:
|
|
33
|
-
config?.ui?.metadata?.favicon ??
|
|
34
|
-
"https://cdn.zuplo.com/www/favicon.png",
|
|
35
|
-
}}
|
|
36
|
-
navigation={config.navigation ?? []}
|
|
37
|
-
// authentication={
|
|
38
|
-
// config.authentication
|
|
39
|
-
// ? getAuthProvider(config.authentication)
|
|
40
|
-
// : undefined
|
|
41
|
-
// }
|
|
42
|
-
plugins={[
|
|
43
|
-
...(config.docs
|
|
44
|
-
? Array.isArray(config.docs)
|
|
45
|
-
? config.docs
|
|
46
|
-
: [config.docs]
|
|
47
|
-
: []
|
|
48
|
-
).map((docs) =>
|
|
49
|
-
markdownPlugin({
|
|
50
|
-
markdownFiles: docs?.files ?? {},
|
|
51
|
-
}),
|
|
52
|
-
),
|
|
53
|
-
...(config.apis
|
|
54
|
-
? Array.isArray(config.apis)
|
|
55
|
-
? config.apis
|
|
56
|
-
: [config.apis]
|
|
57
|
-
: []
|
|
58
|
-
).map((api) => openApiPlugin(api)),
|
|
59
|
-
|
|
60
|
-
// apiKeyPlugin({
|
|
61
|
-
// // consumerEndpoint:
|
|
62
|
-
// // "https://zudoku-customer-main-b36fa2f.d2.zuplo.dev/v1/developer/api-keys",
|
|
63
|
-
// getConsumers: async (ctx) => {
|
|
64
|
-
// const accessToken = await ctx.authentication?.getToken?.(ctx);
|
|
65
|
-
|
|
66
|
-
// if (!accessToken) {
|
|
67
|
-
// return;
|
|
68
|
-
// }
|
|
69
|
-
|
|
70
|
-
// const consumers = await fetch(
|
|
71
|
-
// "https://zudoku-customer-main-b36fa2f.d2.zuplo.dev/v1/developer/api-keys",
|
|
72
|
-
// {
|
|
73
|
-
// headers: {
|
|
74
|
-
// Authorization: `Bearer ${accessToken}`,
|
|
75
|
-
// },
|
|
76
|
-
// },
|
|
77
|
-
// );
|
|
78
|
-
|
|
79
|
-
// return { consumers: [await consumers.json()] };
|
|
80
|
-
// },
|
|
81
|
-
// }),
|
|
82
|
-
]}
|
|
83
|
-
/>
|
|
84
|
-
);
|
|
85
|
-
}
|
package/src/app/config.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ZudokuConfig } from "../config/config.js";
|
|
2
|
-
|
|
3
|
-
interface ZuploConfigImport {
|
|
4
|
-
default: ZudokuConfig;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
// Search for config files
|
|
8
|
-
const configs = import.meta.glob<ZuploConfigImport>(
|
|
9
|
-
"/zudoku.config.{js,jsx,ts,tsx,mjs}",
|
|
10
|
-
{ eager: true },
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
let config: ZudokuConfig = {};
|
|
14
|
-
|
|
15
|
-
// If we found any, load the first one
|
|
16
|
-
if (Object.keys(configs).length > 0) {
|
|
17
|
-
config = configs[Object.keys(configs)[0]].default;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default config;
|
package/src/app/markdowns.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
|
|
4
|
-
/** An IntrospectionQuery representation of your schema.
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* This is an introspection of your schema saved as a file by GraphQLSP.
|
|
8
|
-
* It will automatically be used by `gql.tada` to infer the types of your GraphQL documents.
|
|
9
|
-
* If you need to reuse this data or update your `scalars`, update `tadaOutputLocation` to
|
|
10
|
-
* instead save to a .ts instead of a .d.ts file.
|
|
11
|
-
*/
|
|
12
|
-
export type introspection = {
|
|
13
|
-
name: never;
|
|
14
|
-
query: 'Query';
|
|
15
|
-
mutation: never;
|
|
16
|
-
subscription: never;
|
|
17
|
-
types: {
|
|
18
|
-
'Boolean': unknown;
|
|
19
|
-
'EncodingItem': { kind: 'OBJECT'; name: 'EncodingItem'; fields: { 'allowReserved': { name: 'allowReserved'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'contentType': { name: 'contentType'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'explode': { name: 'explode'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'headers': { name: 'headers'; type: { kind: 'SCALAR'; name: 'JSONObject'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'style': { name: 'style'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; };
|
|
20
|
-
'ExampleItem': { kind: 'OBJECT'; name: 'ExampleItem'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'externalValue': { name: 'externalValue'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'summary': { name: 'summary'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'value': { name: 'value'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; };
|
|
21
|
-
'Float': unknown;
|
|
22
|
-
'ID': unknown;
|
|
23
|
-
'Int': unknown;
|
|
24
|
-
'JSON': unknown;
|
|
25
|
-
'JSONObject': unknown;
|
|
26
|
-
'MediaTypeObject': { kind: 'OBJECT'; name: 'MediaTypeObject'; fields: { 'encoding': { name: 'encoding'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'EncodingItem'; ofType: null; }; }; } }; 'examples': { name: 'examples'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ExampleItem'; ofType: null; }; }; } }; 'mediaType': { name: 'mediaType'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'schema': { name: 'schema'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'JSON'; ofType: null; }; } }; }; };
|
|
27
|
-
'OperationItem': { kind: 'OBJECT'; name: 'OperationItem'; fields: { 'contentTypes': { name: 'contentTypes'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; }; } }; 'deprecated': { name: 'deprecated'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'method': { name: 'method'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'operationId': { name: 'operationId'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'parameters': { name: 'parameters'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ParameterItem'; ofType: null; }; }; } }; 'path': { name: 'path'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'requestBody': { name: 'requestBody'; type: { kind: 'OBJECT'; name: 'RequestBodyObject'; ofType: null; } }; 'responses': { name: 'responses'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ResponseItem'; ofType: null; }; }; }; } }; 'slug': { name: 'slug'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'summary': { name: 'summary'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'tags': { name: 'tags'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'TagItem'; ofType: null; }; }; } }; }; };
|
|
28
|
-
'ParameterIn': { name: 'ParameterIn'; enumValues: 'cookie' | 'header' | 'path' | 'query'; };
|
|
29
|
-
'ParameterItem': { kind: 'OBJECT'; name: 'ParameterItem'; fields: { 'allowEmptyValue': { name: 'allowEmptyValue'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'allowReserved': { name: 'allowReserved'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'deprecated': { name: 'deprecated'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'examples': { name: 'examples'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ExampleItem'; ofType: null; }; }; } }; 'explode': { name: 'explode'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'in': { name: 'in'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'ParameterIn'; ofType: null; }; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'required': { name: 'required'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'schema': { name: 'schema'; type: { kind: 'SCALAR'; name: 'JSON'; ofType: null; } }; 'style': { name: 'style'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; };
|
|
30
|
-
'PathItem': { kind: 'OBJECT'; name: 'PathItem'; fields: { 'methods': { name: 'methods'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; }; } }; 'path': { name: 'path'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
|
|
31
|
-
'Query': { kind: 'OBJECT'; name: 'Query'; fields: { 'schema': { name: 'schema'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Schema'; ofType: null; }; } }; }; };
|
|
32
|
-
'RequestBodyObject': { kind: 'OBJECT'; name: 'RequestBodyObject'; fields: { 'content': { name: 'content'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'MediaTypeObject'; ofType: null; }; }; } }; 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'required': { name: 'required'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; }; };
|
|
33
|
-
'ResponseItem': { kind: 'OBJECT'; name: 'ResponseItem'; fields: { 'content': { name: 'content'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'MediaTypeObject'; ofType: null; }; }; } }; 'description': { name: 'description'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'headers': { name: 'headers'; type: { kind: 'SCALAR'; name: 'JSON'; ofType: null; } }; 'links': { name: 'links'; type: { kind: 'SCALAR'; name: 'JSON'; ofType: null; } }; 'statusCode': { name: 'statusCode'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
|
|
34
|
-
'Schema': { kind: 'OBJECT'; name: 'Schema'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'openapi': { name: 'openapi'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'operations': { name: 'operations'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'OperationItem'; ofType: null; }; }; }; } }; 'paths': { name: 'paths'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PathItem'; ofType: null; }; }; }; } }; 'tags': { name: 'tags'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'SchemaTag'; ofType: null; }; }; }; } }; 'title': { name: 'title'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'url': { name: 'url'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'version': { name: 'version'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
|
|
35
|
-
'SchemaTag': { kind: 'OBJECT'; name: 'SchemaTag'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'operations': { name: 'operations'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'OperationItem'; ofType: null; }; }; }; } }; }; };
|
|
36
|
-
'SchemaType': { name: 'SchemaType'; enumValues: 'json' | 'url' | 'yaml'; };
|
|
37
|
-
'String': unknown;
|
|
38
|
-
'TagItem': { kind: 'OBJECT'; name: 'TagItem'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
import * as gqlTada from "gql.tada";
|
|
43
|
-
|
|
44
|
-
declare module "gql.tada" {
|
|
45
|
-
interface setupSchema {
|
|
46
|
-
introspection: introspection;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { OperationListItemResult } from "../OperationList.js";
|
|
2
|
-
|
|
3
|
-
export const getCode = (operation: OperationListItemResult, option: string) => {
|
|
4
|
-
switch (option) {
|
|
5
|
-
case "curl":
|
|
6
|
-
return (
|
|
7
|
-
`curl --request ${operation.method.toLocaleUpperCase()} \\\n` +
|
|
8
|
-
` --url ${operation.path} \\\n` +
|
|
9
|
-
` --header 'Content-Type: application/json'`
|
|
10
|
-
);
|
|
11
|
-
case "wget":
|
|
12
|
-
return (
|
|
13
|
-
`wget --method=${operation.method.toLocaleUpperCase()} \\\n` +
|
|
14
|
-
` --header='Content-Type: application/json' \\\n` +
|
|
15
|
-
` ${operation.path}`
|
|
16
|
-
);
|
|
17
|
-
case "js":
|
|
18
|
-
return (
|
|
19
|
-
`fetch('${operation.path}', {\n` +
|
|
20
|
-
` method: '${operation.method.toLocaleUpperCase()}',\n` +
|
|
21
|
-
` headers: { 'Content-Type': 'application/json' },\n` +
|
|
22
|
-
`});`
|
|
23
|
-
);
|
|
24
|
-
case "ruby":
|
|
25
|
-
return (
|
|
26
|
-
`require 'net/http'\n\n` +
|
|
27
|
-
`url = URI.parse('${operation.path}')\n` +
|
|
28
|
-
`http = Net::HTTP.new(url.host, url.port)\n` +
|
|
29
|
-
`request = Net::HTTP::${operation.method}.new(url)\n` +
|
|
30
|
-
`request['Content-Type'] = 'application/json'\n` +
|
|
31
|
-
`http.request(request)`
|
|
32
|
-
);
|
|
33
|
-
case "php":
|
|
34
|
-
return (
|
|
35
|
-
`$ch = curl_init('${operation.path}');\n` +
|
|
36
|
-
`curl_setopt($ch, CURLOPT_CUSTOMREQUEST, '${operation.method.toLocaleUpperCase()}');\n` +
|
|
37
|
-
`curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\n` +
|
|
38
|
-
`curl_exec($ch);\n` +
|
|
39
|
-
`curl_close($ch);`
|
|
40
|
-
);
|
|
41
|
-
case "go":
|
|
42
|
-
return (
|
|
43
|
-
`package main\n\n` +
|
|
44
|
-
`import (\n` +
|
|
45
|
-
` "net/http"\n` +
|
|
46
|
-
` "strings"\n` +
|
|
47
|
-
`)\n\n` +
|
|
48
|
-
`func main() {\n` +
|
|
49
|
-
` client := &http.Client{}\n` +
|
|
50
|
-
` req, _ := http.NewRequest("${operation.method.toLocaleUpperCase()}", "${operation.path}", strings.NewReader(""))\n` +
|
|
51
|
-
` req.Header.Set("Content-Type", "application/json")\n` +
|
|
52
|
-
` client.Do(req)\n` +
|
|
53
|
-
`}`
|
|
54
|
-
);
|
|
55
|
-
case "rust":
|
|
56
|
-
return (
|
|
57
|
-
`use reqwest::Client;\n\n` +
|
|
58
|
-
`fn main() {\n` +
|
|
59
|
-
` let client = Client::new();\n` +
|
|
60
|
-
` let res = client\n` +
|
|
61
|
-
` .${operation.method.toLocaleLowerCase()}("${operation.path}")\n` +
|
|
62
|
-
` .header("Content-Type", "application/json")\n` +
|
|
63
|
-
` .send();\n` +
|
|
64
|
-
`}`
|
|
65
|
-
);
|
|
66
|
-
default:
|
|
67
|
-
return "";
|
|
68
|
-
}
|
|
69
|
-
};
|
|
File without changes
|