zudoku 0.3.0-dev.10 → 0.3.0-dev.12
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/app/App.js +8 -6
- package/dist/app/App.js.map +1 -1
- package/dist/config/config.d.ts +5 -14
- package/dist/lib/authentication/authentication.d.ts +2 -2
- package/dist/lib/components/DevPortal.d.ts +2 -20
- package/dist/lib/components/DevPortal.js +13 -8
- package/dist/lib/components/DevPortal.js.map +1 -1
- package/dist/lib/components/Header.js +2 -2
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +9 -4
- package/dist/lib/components/Heading.js +17 -2
- package/dist/lib/components/Heading.js.map +1 -1
- package/dist/lib/components/Layout.js +1 -1
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/context/DevPortalProvider.d.ts +1 -1
- package/dist/lib/components/context/DevPortalProvider.js +2 -2
- package/dist/lib/components/context/DevPortalProvider.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +33 -3
- package/dist/lib/core/DevPortalContext.js +4 -2
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +7 -4
- package/dist/lib/core/plugins.js +1 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/oas/graphql/index.js +1 -1
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/index.js +3 -1
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/markdown/MdxPage.d.ts +3 -2
- package/dist/lib/plugins/markdown/MdxPage.js +5 -4
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.d.ts +2 -2
- package/dist/lib/plugins/markdown/generateRoutes.js +2 -2
- package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
- package/dist/lib/plugins/markdown/index.d.ts +4 -1
- package/dist/lib/plugins/markdown/index.js +2 -2
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +4 -3
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +8 -4
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterList.js +1 -1
- package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/{MakeRequest.d.ts → PlaygroundDialogWrapper.d.ts} +1 -1
- package/dist/lib/plugins/openapi/{MakeRequest.js → PlaygroundDialogWrapper.js} +4 -4
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -0
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +1 -9
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaListView.js +4 -26
- package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaListViewItem.d.ts +7 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js +16 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js.map +1 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.d.ts +8 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js +17 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js.map +1 -0
- package/dist/lib/plugins/openapi/Sidecar.js +2 -2
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js +8 -0
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +4 -4
- package/dist/lib/plugins/openapi/playground/Playground.js +7 -11
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.d.ts +3 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +10 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -0
- package/dist/lib/plugins/openapi/util/prose.d.ts +1 -0
- package/dist/lib/plugins/openapi/util/prose.js +4 -0
- package/dist/lib/plugins/openapi/util/prose.js.map +1 -0
- package/dist/lib/plugins/openapi/worker/worker.js +25 -1
- package/dist/lib/plugins/openapi/worker/worker.js.map +1 -1
- package/dist/lib/ui/button-variants.d.ts +1 -1
- package/dist/lib/util/MdxComponents.js +1 -1
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/lib/util/objectEntries.d.ts +4 -0
- package/dist/lib/util/objectEntries.js +2 -0
- package/dist/lib/util/objectEntries.js.map +1 -0
- package/dist/lib/util/renderIf.d.ts +1 -0
- package/dist/lib/util/renderIf.js +2 -0
- package/dist/lib/util/renderIf.js.map +1 -0
- package/dist/vite/plugin-docs.js +1 -1
- package/dist/vite/plugin-docs.js.map +1 -1
- package/lib/{Spinner-DCwVN24H.js → Spinner-CbtkR-Im.js} +3249 -3232
- package/lib/assets/{worker-BCcpCNJ7.js → worker-DGvzLstc.js} +9843 -9800
- package/lib/zudoku.components.js +174 -161
- package/lib/zudoku.openapi-worker.js +12 -12
- package/lib/zudoku.plugins.js +3722 -3712
- package/package.json +2 -1
- package/src/app/App.tsx +9 -7
- package/src/lib/authentication/authentication.ts +2 -5
- package/src/lib/components/DevPortal.tsx +12 -27
- package/src/lib/components/Header.tsx +4 -4
- package/src/lib/components/Heading.tsx +26 -7
- package/src/lib/components/Layout.tsx +1 -1
- package/src/lib/components/context/DevPortalProvider.ts +2 -2
- package/src/lib/core/DevPortalContext.ts +38 -10
- package/src/lib/core/plugins.ts +10 -5
- package/src/lib/oas/graphql/index.ts +2 -2
- package/src/lib/oas/parser/index.ts +3 -1
- package/src/lib/plugins/markdown/MdxPage.tsx +49 -32
- package/src/lib/plugins/markdown/generateRoutes.tsx +12 -2
- package/src/lib/plugins/markdown/index.tsx +8 -1
- package/src/lib/plugins/openapi/OperationList.tsx +9 -3
- package/src/lib/plugins/openapi/OperationListItem.tsx +39 -18
- package/src/lib/plugins/openapi/ParameterList.tsx +1 -1
- package/src/lib/plugins/openapi/ParameterListItem.tsx +3 -4
- package/src/lib/plugins/openapi/{MakeRequest.tsx → PlaygroundDialogWrapper.tsx} +3 -3
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -17
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +3 -1
- package/src/lib/plugins/openapi/SchemaListView.tsx +15 -182
- package/src/lib/plugins/openapi/SchemaListViewItem.tsx +110 -0
- package/src/lib/plugins/openapi/SchemaListViewItemGroup.tsx +63 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +2 -2
- package/src/lib/plugins/openapi/index.tsx +17 -4
- package/src/lib/plugins/openapi/playground/Playground.tsx +157 -187
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +34 -0
- package/src/lib/plugins/openapi/util/prose.ts +7 -0
- package/src/lib/plugins/openapi/worker/worker.ts +27 -1
- package/src/lib/util/MdxComponents.tsx +1 -1
- package/src/lib/util/objectEntries.ts +5 -0
- package/src/lib/util/renderIf.ts +4 -0
- package/dist/lib/plugins/openapi/MakeRequest.js.map +0 -1
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
2
1
|
import { useMutation } from "@tanstack/react-query";
|
|
3
|
-
import { CirclePlayIcon } from "lucide-react";
|
|
4
2
|
import { Fragment } from "react";
|
|
5
3
|
import { FormProvider, useForm } from "react-hook-form";
|
|
6
4
|
import { useApiIdentities } from "../../../components/context/DevPortalProvider.js";
|
|
7
|
-
import {
|
|
8
|
-
Dialog,
|
|
9
|
-
DialogContent,
|
|
10
|
-
DialogTitle,
|
|
11
|
-
DialogTrigger,
|
|
12
|
-
} from "../../../components/Dialog.js";
|
|
13
5
|
import {
|
|
14
6
|
Select,
|
|
15
7
|
SelectContent,
|
|
@@ -28,6 +20,8 @@ import { Headers } from "./Headers.js";
|
|
|
28
20
|
import { PathParams } from "./PathParams.js";
|
|
29
21
|
import { QueryParams } from "./QueryParams.js";
|
|
30
22
|
|
|
23
|
+
export const NO_IDENTITY = "__none";
|
|
24
|
+
|
|
31
25
|
function mimeTypeToLanguage(mimeType: string) {
|
|
32
26
|
const mimeTypeMapping = {
|
|
33
27
|
"application/json": "json",
|
|
@@ -81,17 +75,7 @@ export type PlaygroundForm = {
|
|
|
81
75
|
identity?: string;
|
|
82
76
|
};
|
|
83
77
|
|
|
84
|
-
export
|
|
85
|
-
|
|
86
|
-
const Playground = ({
|
|
87
|
-
url,
|
|
88
|
-
host,
|
|
89
|
-
method,
|
|
90
|
-
headers = [{ name: "", value: "" }],
|
|
91
|
-
queryParams = [],
|
|
92
|
-
pathParams = [],
|
|
93
|
-
hasParams,
|
|
94
|
-
}: {
|
|
78
|
+
export type PlaygroundContentProps = {
|
|
95
79
|
host: string;
|
|
96
80
|
url: string;
|
|
97
81
|
method: string;
|
|
@@ -99,7 +83,17 @@ const Playground = ({
|
|
|
99
83
|
queryParams?: QueryParam[];
|
|
100
84
|
pathParams?: PathParam[];
|
|
101
85
|
hasParams: boolean;
|
|
102
|
-
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const Playground = ({
|
|
89
|
+
host,
|
|
90
|
+
url,
|
|
91
|
+
method,
|
|
92
|
+
headers = [{ name: "", value: "" }],
|
|
93
|
+
queryParams = [],
|
|
94
|
+
pathParams = [],
|
|
95
|
+
hasParams,
|
|
96
|
+
}: PlaygroundContentProps) => {
|
|
103
97
|
const { register, control, handleSubmit, watch, ...form } =
|
|
104
98
|
useForm<PlaygroundForm>({
|
|
105
99
|
defaultValues: {
|
|
@@ -129,7 +123,7 @@ const Playground = ({
|
|
|
129
123
|
|
|
130
124
|
if (data.identity !== NO_IDENTITY) {
|
|
131
125
|
identities.data
|
|
132
|
-
|
|
126
|
+
?.find((i) => i.id === data.identity)
|
|
133
127
|
?.authorizeRequest(request);
|
|
134
128
|
}
|
|
135
129
|
const response = await fetch(request);
|
|
@@ -181,181 +175,157 @@ const Playground = ({
|
|
|
181
175
|
<wbr />
|
|
182
176
|
</Fragment>
|
|
183
177
|
));
|
|
184
|
-
|
|
185
178
|
return (
|
|
186
|
-
<
|
|
187
|
-
<
|
|
188
|
-
<
|
|
189
|
-
className="
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
<
|
|
206
|
-
<div className="flex
|
|
207
|
-
<
|
|
208
|
-
|
|
209
|
-
<
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
{
|
|
215
|
-
|
|
179
|
+
<FormProvider {...{ register, control, handleSubmit, watch, ...form }}>
|
|
180
|
+
<form onSubmit={handleSubmit((data) => queryMutation.mutateAsync(data))}>
|
|
181
|
+
<div className="grid grid-cols-2 text-sm h-full">
|
|
182
|
+
<div className="flex flex-col gap-4 p-8 bg-muted/50 after:bg-muted-foreground/20 relative after:absolute after:w-px after:inset-0 after:left-auto">
|
|
183
|
+
<div className="flex gap-2 items-stretch">
|
|
184
|
+
<div className="flex flex-1 items-center w-full border rounded-md border-border">
|
|
185
|
+
<div className="border-r border-border p-2 bg-muted rounded-l-md self-stretch font-semibold font-mono">
|
|
186
|
+
{method.toUpperCase()}
|
|
187
|
+
</div>
|
|
188
|
+
<div className="p-2 font-mono text-xs">
|
|
189
|
+
{path}
|
|
190
|
+
{urlQueryParams.length > 0 ? "?" : ""}
|
|
191
|
+
{urlQueryParams}
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
<Button type="submit" className="h-auto flex gap-1">
|
|
195
|
+
Send
|
|
196
|
+
</Button>
|
|
197
|
+
</div>
|
|
198
|
+
<Tabs defaultValue={hasParams ? "parameters" : "headers"}>
|
|
199
|
+
<div className="flex justify-between">
|
|
200
|
+
<TabsList>
|
|
201
|
+
{hasParams && (
|
|
202
|
+
<TabsTrigger value="parameters">Parameters</TabsTrigger>
|
|
203
|
+
)}
|
|
204
|
+
<TabsTrigger value="headers">
|
|
205
|
+
Headers{" "}
|
|
206
|
+
{formState.headers.length > 0 &&
|
|
207
|
+
`(${formState.headers.length})`}
|
|
208
|
+
</TabsTrigger>
|
|
209
|
+
<TabsTrigger
|
|
210
|
+
value="body"
|
|
211
|
+
disabled={["POST", "PUT", "PATCH", "DELETE"].includes(
|
|
212
|
+
method.toUpperCase(),
|
|
213
|
+
)}
|
|
214
|
+
>
|
|
215
|
+
Body
|
|
216
|
+
</TabsTrigger>
|
|
217
|
+
</TabsList>
|
|
218
|
+
<div className="flex gap-2 items-center">
|
|
219
|
+
Auth:
|
|
220
|
+
<Select
|
|
221
|
+
onValueChange={(value) => form.setValue("identity", value)}
|
|
222
|
+
defaultValue={formState.identity}
|
|
223
|
+
>
|
|
224
|
+
<SelectTrigger className="w-[180px] flex">
|
|
225
|
+
{identities.isPending ? <Spinner /> : <SelectValue />}
|
|
226
|
+
</SelectTrigger>
|
|
227
|
+
<SelectContent align="center">
|
|
228
|
+
<SelectItem value={NO_IDENTITY}>None</SelectItem>
|
|
229
|
+
{identities.data?.map((identity) => (
|
|
230
|
+
<SelectItem key={identity.id} value={identity.id}>
|
|
231
|
+
{identity.label}
|
|
232
|
+
</SelectItem>
|
|
233
|
+
))}
|
|
234
|
+
</SelectContent>
|
|
235
|
+
</Select>
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
<TabsContent value="headers">
|
|
239
|
+
<Headers control={control} register={register} />
|
|
240
|
+
</TabsContent>
|
|
241
|
+
<TabsContent value="parameters">
|
|
242
|
+
<div className="grid grid-cols-[min-content_1fr_1fr_auto]">
|
|
243
|
+
{pathParams.length > 0 && (
|
|
244
|
+
<div className="font-semibold my-3 col-span-3">
|
|
245
|
+
Path Parameters
|
|
216
246
|
</div>
|
|
217
|
-
|
|
218
|
-
<
|
|
219
|
-
|
|
220
|
-
|
|
247
|
+
)}
|
|
248
|
+
<PathParams control={control} register={register} />
|
|
249
|
+
{queryParams.length > 0 && (
|
|
250
|
+
<span className="font-semibold my-3 col-span-3">
|
|
251
|
+
Query Parameters
|
|
252
|
+
</span>
|
|
253
|
+
)}
|
|
254
|
+
<QueryParams control={control} />
|
|
221
255
|
</div>
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
</TabsList>
|
|
242
|
-
<div className="flex gap-2 items-center">
|
|
243
|
-
Auth:
|
|
244
|
-
<Select
|
|
245
|
-
onValueChange={(value) =>
|
|
246
|
-
form.setValue("identity", value)
|
|
247
|
-
}
|
|
248
|
-
defaultValue={formState.identity}
|
|
249
|
-
>
|
|
250
|
-
<SelectTrigger className="w-[180px]">
|
|
251
|
-
<SelectValue />
|
|
252
|
-
</SelectTrigger>
|
|
253
|
-
<SelectContent align="center">
|
|
254
|
-
<SelectItem value={NO_IDENTITY}>None</SelectItem>
|
|
255
|
-
{identities.data.map((identity) => (
|
|
256
|
-
<SelectItem key={identity.id} value={identity.id}>
|
|
257
|
-
{identity.label}
|
|
258
|
-
</SelectItem>
|
|
259
|
-
))}
|
|
260
|
-
</SelectContent>
|
|
261
|
-
</Select>
|
|
256
|
+
</TabsContent>
|
|
257
|
+
<TabsContent value="body">
|
|
258
|
+
<textarea
|
|
259
|
+
{...register("body")}
|
|
260
|
+
className="border border-border w-full rounded p-2 bg-muted h-40"
|
|
261
|
+
/>
|
|
262
|
+
</TabsContent>
|
|
263
|
+
</Tabs>
|
|
264
|
+
</div>
|
|
265
|
+
<div className="flex flex-col gap-4 p-8 bg-muted/70">
|
|
266
|
+
{queryMutation.error ? (
|
|
267
|
+
<div>{queryMutation.error.message}</div>
|
|
268
|
+
) : queryMutation.data ? (
|
|
269
|
+
<div className="flex flex-col gap-2">
|
|
270
|
+
<div className="flex gap-2">
|
|
271
|
+
<div className="flex text-xs gap-6">
|
|
272
|
+
<div>
|
|
273
|
+
Status: {queryMutation.data.status}{" "}
|
|
274
|
+
{statusCodeMap[queryMutation.data.status] ?? ""}
|
|
262
275
|
</div>
|
|
276
|
+
<div>Time: {queryMutation.data.time.toFixed(0)}ms</div>
|
|
277
|
+
<div>Size: {queryMutation.data.size} B</div>
|
|
263
278
|
</div>
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
<
|
|
268
|
-
<
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
</div>
|
|
280
|
+
{/*<UrlDisplay host={host} path={url} />*/}
|
|
281
|
+
<Tabs defaultValue="response">
|
|
282
|
+
<TabsList>
|
|
283
|
+
<TabsTrigger value="response">Response</TabsTrigger>
|
|
284
|
+
<TabsTrigger value="headers">
|
|
285
|
+
{headerEntries.length
|
|
286
|
+
? `Headers (${headerEntries.length})`
|
|
287
|
+
: "No headers"}
|
|
288
|
+
</TabsTrigger>
|
|
289
|
+
</TabsList>
|
|
290
|
+
|
|
291
|
+
<TabsContent value="response">
|
|
292
|
+
<Card className="shadow-none p-4">
|
|
293
|
+
<SyntaxHighlight
|
|
294
|
+
language={lang ?? "json"}
|
|
295
|
+
noBackground
|
|
296
|
+
className="overflow-x-auto "
|
|
297
|
+
code={queryMutation.data.body ?? JSON.stringify("")}
|
|
298
|
+
/>
|
|
299
|
+
</Card>
|
|
282
300
|
</TabsContent>
|
|
283
|
-
<TabsContent value="
|
|
284
|
-
<
|
|
285
|
-
|
|
286
|
-
className="
|
|
287
|
-
|
|
301
|
+
<TabsContent value="headers">
|
|
302
|
+
<Card className="grid grid-cols-2 w-full gap-2.5 font-mono text-xs shadow-none p-4">
|
|
303
|
+
<div className="font-semibold">Key</div>
|
|
304
|
+
<div className="font-semibold">Value</div>
|
|
305
|
+
{headerEntries.map(([key, value]) => (
|
|
306
|
+
<Fragment key={key}>
|
|
307
|
+
<div>{key}</div>
|
|
308
|
+
<div>{value}</div>
|
|
309
|
+
</Fragment>
|
|
310
|
+
))}
|
|
311
|
+
</Card>
|
|
288
312
|
</TabsContent>
|
|
289
313
|
</Tabs>
|
|
290
314
|
</div>
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
{statusCodeMap[queryMutation.data.status] ?? ""}
|
|
301
|
-
</div>
|
|
302
|
-
<div>Time: {queryMutation.data.time.toFixed(0)}ms</div>
|
|
303
|
-
<div>Size: {queryMutation.data.size} B</div>
|
|
304
|
-
</div>
|
|
305
|
-
</div>
|
|
306
|
-
{/*<UrlDisplay host={host} path={url} />*/}
|
|
307
|
-
<Tabs defaultValue="response">
|
|
308
|
-
<TabsList>
|
|
309
|
-
<TabsTrigger value="response">Response</TabsTrigger>
|
|
310
|
-
<TabsTrigger value="headers">
|
|
311
|
-
{headerEntries.length
|
|
312
|
-
? `Headers (${headerEntries.length})`
|
|
313
|
-
: "No headers"}
|
|
314
|
-
</TabsTrigger>
|
|
315
|
-
</TabsList>
|
|
316
|
-
|
|
317
|
-
<TabsContent value="response">
|
|
318
|
-
<Card className="shadow-none p-4">
|
|
319
|
-
<SyntaxHighlight
|
|
320
|
-
language={lang ?? "json"}
|
|
321
|
-
noBackground
|
|
322
|
-
className="overflow-x-auto "
|
|
323
|
-
code={queryMutation.data.body ?? JSON.stringify("")}
|
|
324
|
-
/>
|
|
325
|
-
</Card>
|
|
326
|
-
</TabsContent>
|
|
327
|
-
<TabsContent value="headers">
|
|
328
|
-
<Card className="grid grid-cols-2 w-full gap-2.5 font-mono text-xs shadow-none p-4">
|
|
329
|
-
<div className="font-semibold">Key</div>
|
|
330
|
-
<div className="font-semibold">Value</div>
|
|
331
|
-
{headerEntries.map(([key, value]) => (
|
|
332
|
-
<Fragment key={key}>
|
|
333
|
-
<div>{key}</div>
|
|
334
|
-
<div>{value}</div>
|
|
335
|
-
</Fragment>
|
|
336
|
-
))}
|
|
337
|
-
</Card>
|
|
338
|
-
</TabsContent>
|
|
339
|
-
</Tabs>
|
|
340
|
-
</div>
|
|
341
|
-
) : (
|
|
342
|
-
<div className="grid place-items-center h-full">
|
|
343
|
-
<span className="text-[16px] font-semibold text-muted-foreground">
|
|
344
|
-
{queryMutation.isPending ? (
|
|
345
|
-
<Spinner />
|
|
346
|
-
) : (
|
|
347
|
-
"Send a request first to see the response here"
|
|
348
|
-
)}
|
|
349
|
-
</span>
|
|
350
|
-
</div>
|
|
351
|
-
)}
|
|
315
|
+
) : (
|
|
316
|
+
<div className="grid place-items-center h-full">
|
|
317
|
+
<span className="text-[16px] font-semibold text-muted-foreground">
|
|
318
|
+
{queryMutation.isPending ? (
|
|
319
|
+
<Spinner />
|
|
320
|
+
) : (
|
|
321
|
+
"Send a request first to see the response here"
|
|
322
|
+
)}
|
|
323
|
+
</span>
|
|
352
324
|
</div>
|
|
353
|
-
|
|
354
|
-
</
|
|
355
|
-
</
|
|
356
|
-
</
|
|
357
|
-
</
|
|
325
|
+
)}
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
</form>
|
|
329
|
+
</FormProvider>
|
|
358
330
|
);
|
|
359
331
|
};
|
|
360
|
-
|
|
361
|
-
export { Playground };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
2
|
+
import { CirclePlayIcon } from "lucide-react";
|
|
3
|
+
import {
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogTitle,
|
|
7
|
+
DialogTrigger,
|
|
8
|
+
} from "../../../components/Dialog.js";
|
|
9
|
+
import { Playground, type PlaygroundContentProps } from "./Playground.js";
|
|
10
|
+
|
|
11
|
+
const PlaygroundDialog = (props: PlaygroundContentProps) => {
|
|
12
|
+
return (
|
|
13
|
+
<Dialog>
|
|
14
|
+
<DialogTrigger asChild>
|
|
15
|
+
<CirclePlayIcon
|
|
16
|
+
className="cursor-pointer text-primary hover:text-primary/80"
|
|
17
|
+
size={16}
|
|
18
|
+
/>
|
|
19
|
+
</DialogTrigger>
|
|
20
|
+
|
|
21
|
+
<DialogContent
|
|
22
|
+
className="max-w-screen-xl w-full h-5/6 overflow-auto p-0"
|
|
23
|
+
aria-describedby={undefined}
|
|
24
|
+
>
|
|
25
|
+
<VisuallyHidden>
|
|
26
|
+
<DialogTitle>Playground</DialogTitle>
|
|
27
|
+
</VisuallyHidden>
|
|
28
|
+
<Playground {...props} />
|
|
29
|
+
</DialogContent>
|
|
30
|
+
</Dialog>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { PlaygroundDialog };
|
|
@@ -1,7 +1,33 @@
|
|
|
1
|
+
import { useLogger } from "@envelop/core";
|
|
1
2
|
import { createGraphQLServer } from "../../../oas/graphql/index.js";
|
|
2
3
|
import { type WorkerGraphQLMessage } from "./createSharedWorkerClient.js";
|
|
3
4
|
|
|
4
|
-
const
|
|
5
|
+
const map = new Map<string, number>();
|
|
6
|
+
|
|
7
|
+
const localServer = createGraphQLServer({
|
|
8
|
+
plugins: [
|
|
9
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
10
|
+
useLogger({
|
|
11
|
+
logFn: (eventName, { args }) => {
|
|
12
|
+
if (import.meta.env.PROD) return;
|
|
13
|
+
|
|
14
|
+
if (eventName.endsWith("-start")) {
|
|
15
|
+
map.set(`${eventName}-${args.operationName}`, performance.now());
|
|
16
|
+
} else if (eventName.endsWith("-end")) {
|
|
17
|
+
const startEvent = eventName.replace("-end", "-start");
|
|
18
|
+
const start = map.get(`${startEvent}-${args.operationName}`);
|
|
19
|
+
if (start) {
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
console.log(
|
|
22
|
+
`${args.operationName} query took ${performance.now() - start}ms`,
|
|
23
|
+
);
|
|
24
|
+
map.delete(`${startEvent}-${args.operationName}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
});
|
|
5
31
|
|
|
6
32
|
const worker = self as unknown as SharedWorkerGlobalScope;
|
|
7
33
|
|
|
@@ -74,7 +74,7 @@ export const MdxComponents = {
|
|
|
74
74
|
return (
|
|
75
75
|
<SyntaxHighlight
|
|
76
76
|
language={match?.[1] ?? "markup"}
|
|
77
|
-
className="rounded-xl overflow-x-auto p-4 border border-border dark:!bg-foreground/10 dark:border-transparent"
|
|
77
|
+
className="rounded-xl overflow-x-auto p-4 border border-border dark:!bg-foreground/10 dark:border-transparent whitespace-nowrap"
|
|
78
78
|
showLanguageIndicator
|
|
79
79
|
code={String(children).trim()}
|
|
80
80
|
/>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MakeRequest.js","sourceRoot":"","sources":["../../../../src/lib/plugins/openapi/MakeRequest.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AA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