nitro-graphql 1.4.3 → 1.5.0

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.
@@ -0,0 +1,449 @@
1
+ import { moduleConfig } from "#nitro-internal-virtual/module-config";
2
+ import { directives } from "#nitro-internal-virtual/server-directives";
3
+ import { resolvers } from "#nitro-internal-virtual/server-resolvers";
4
+ import { schemas } from "#nitro-internal-virtual/server-schemas";
5
+ import { defineEventHandler, getQuery, setResponseHeader } from "h3";
6
+ import { debugInfo } from "#nitro-internal-virtual/debug-info";
7
+
8
+ //#region src/routes/debug.ts
9
+ /**
10
+ * Debug endpoint for inspecting virtual modules and GraphQL setup
11
+ * Only available in development mode
12
+ *
13
+ * Routes:
14
+ * - /_nitro/graphql/debug - HTML dashboard
15
+ * - /_nitro/graphql/debug?format=json - JSON API
16
+ */
17
+ var debug_default = defineEventHandler(async (event) => {
18
+ if (!debugInfo.isDev) {
19
+ setResponseHeader(event, "Content-Type", "text/plain");
20
+ return "Debug endpoint is only available in development mode";
21
+ }
22
+ const format = getQuery(event).format || "html";
23
+ const processedResolverFiles = debugInfo.scanned.resolverFiles.map((r) => {
24
+ const parts = r.specifier.split("/");
25
+ return {
26
+ file: parts[parts.length - 1],
27
+ fullPath: r.specifier,
28
+ exports: r.imports.map((i) => ({
29
+ name: i.name,
30
+ type: i.type,
31
+ as: i.as
32
+ }))
33
+ };
34
+ });
35
+ const processedDirectiveFiles = debugInfo.scanned.directiveFiles.map((d) => {
36
+ const parts = d.specifier.split("/");
37
+ return {
38
+ file: parts[parts.length - 1],
39
+ fullPath: d.specifier,
40
+ exports: d.imports.map((i) => ({
41
+ name: i.name,
42
+ type: i.type,
43
+ as: i.as
44
+ }))
45
+ };
46
+ });
47
+ const fullDebugInfo = {
48
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
49
+ environment: {
50
+ dev: debugInfo.isDev,
51
+ framework: debugInfo.framework
52
+ },
53
+ graphql: {
54
+ framework: debugInfo.graphqlFramework,
55
+ federation: debugInfo.federation
56
+ },
57
+ scanned: {
58
+ schemas: debugInfo.scanned.schemas,
59
+ schemaFiles: debugInfo.scanned.schemaFiles.map((s) => {
60
+ return s.split("/").slice(-3).join("/");
61
+ }),
62
+ resolvers: debugInfo.scanned.resolvers,
63
+ resolverFiles: processedResolverFiles,
64
+ directives: debugInfo.scanned.directives,
65
+ directiveFiles: processedDirectiveFiles,
66
+ documents: debugInfo.scanned.documents,
67
+ documentFiles: debugInfo.scanned.documentFiles.map((d) => {
68
+ return d.split("/").slice(-3).join("/");
69
+ })
70
+ },
71
+ runtime: {
72
+ loadedResolvers: resolvers.length,
73
+ loadedSchemas: schemas.length,
74
+ loadedDirectives: directives.length
75
+ },
76
+ virtualModules: debugInfo.virtualModules || {},
77
+ virtualModuleSamples: {
78
+ "server-resolvers": {
79
+ resolverCount: resolvers.length,
80
+ sample: resolvers.slice(0, 3).map((r) => ({
81
+ hasResolver: !!r.resolver,
82
+ resolverKeys: r.resolver ? Object.keys(r.resolver) : []
83
+ }))
84
+ },
85
+ "server-schemas": {
86
+ schemaCount: schemas.length,
87
+ sample: schemas.slice(0, 2).map((s) => ({
88
+ defLength: s.def?.length || 0,
89
+ defPreview: s.def?.substring(0, 100) || "Empty"
90
+ }))
91
+ },
92
+ "server-directives": { directiveCount: directives.length },
93
+ "module-config": moduleConfig
94
+ }
95
+ };
96
+ if (format === "json") {
97
+ setResponseHeader(event, "Content-Type", "application/json");
98
+ return fullDebugInfo;
99
+ }
100
+ setResponseHeader(event, "Content-Type", "text/html");
101
+ return generateHtmlDashboard(fullDebugInfo);
102
+ });
103
+ function generateHtmlDashboard(debugInfo$1) {
104
+ return `<!DOCTYPE html>
105
+ <html lang="en">
106
+ <head>
107
+ <meta charset="UTF-8">
108
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
109
+ <title>Nitro GraphQL Debug Dashboard</title>
110
+ <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"><\/script>
111
+ <style>
112
+ @keyframes fadeIn {
113
+ from { opacity: 0; transform: translateY(10px); }
114
+ to { opacity: 1; transform: translateY(0); }
115
+ }
116
+ .animate-fade-in {
117
+ animation: fadeIn 0.3s ease-out;
118
+ }
119
+ /* Custom Scrollbar */
120
+ ::-webkit-scrollbar {
121
+ width: 8px;
122
+ height: 8px;
123
+ }
124
+ ::-webkit-scrollbar-track {
125
+ background: #0f172a;
126
+ border-radius: 4px;
127
+ }
128
+ ::-webkit-scrollbar-thumb {
129
+ background: #334155;
130
+ border-radius: 4px;
131
+ }
132
+ ::-webkit-scrollbar-thumb:hover {
133
+ background: #475569;
134
+ }
135
+ </style>
136
+ </head>
137
+ <body class="bg-slate-950 text-slate-200 min-h-screen">
138
+ <div class="container mx-auto max-w-7xl p-6 space-y-6 animate-fade-in">
139
+ <!-- Header -->
140
+ <div class="mb-8 border-b border-slate-800 pb-6">
141
+ <div class="flex items-center gap-3 mb-2">
142
+ <svg class="w-10 h-10" viewBox="0 0 400 400" fill="none">
143
+ <path d="M57.468 302.66l-14.376-8.3 160.15-277.38 14.376 8.3z" fill="#E535AB"/>
144
+ <path d="M39.8 272.2h320.3v16.6H39.8z" fill="#E535AB"/>
145
+ <path d="M206.348 374.026l-160.21-92.5 8.3-14.376 160.21 92.5z" fill="#E535AB"/>
146
+ <path d="M345.522 132.947l-160.21-92.5 8.3-14.376 160.21 92.5z" fill="#E535AB"/>
147
+ <path d="M54.482 132.883l-8.3-14.375 160.21-92.5 8.3 14.376z" fill="#E535AB"/>
148
+ <path d="M342.568 302.663l-160.15-277.38 14.376-8.3 160.15 277.38z" fill="#E535AB"/>
149
+ <path d="M52.5 107.5h16.6v185H52.5z" fill="#E535AB"/>
150
+ <path d="M330.9 107.5h16.6v185h-16.6z" fill="#E535AB"/>
151
+ <path d="M203.522 367l-7.25-12.558 139.34-80.45 7.25 12.557z" fill="#E535AB"/>
152
+ <path d="M369.5 297.9c-9.6 16.7-31 22.4-47.7 12.8-16.7-9.6-22.4-31-12.8-47.7 9.6-16.7 31-22.4 47.7-12.8 16.8 9.7 22.5 31 12.8 47.7M90.9 137c-9.6 16.7-31 22.4-47.7 12.8-16.7-9.6-22.4-31-12.8-47.7 9.6-16.7 31-22.4 47.7-12.8 16.7 9.7 22.4 31 12.8 47.7M30.5 297.9c-9.6-16.7-3.9-38 12.8-47.7 16.7-9.6 38-3.9 47.7 12.8 9.6 16.7 3.9 38-12.8 47.7-16.8 9.6-38.1 3.9-47.7-12.8M309.1 137c-9.6-16.7-3.9-38 12.8-47.7 16.7-9.6 38-3.9 47.7 12.8 9.6 16.7 3.9 38-12.8 47.7-16.7 9.6-38.1 3.9-47.7-12.8M200 395.8c-19.3 0-34.9-15.6-34.9-34.9 0-19.3 15.6-34.9 34.9-34.9 19.3 0 34.9 15.6 34.9 34.9 0 19.2-15.6 34.9-34.9 34.9M200 74c-19.3 0-34.9-15.6-34.9-34.9 0-19.3 15.6-34.9 34.9-34.9 19.3 0 34.9 15.6 34.9 34.9 0 19.3-15.6 34.9-34.9 34.9" fill="#E535AB"/>
153
+ </svg>
154
+ <div>
155
+ <h1 class="text-3xl font-bold text-slate-100">
156
+ Nitro GraphQL Debug
157
+ </h1>
158
+ <p class="text-sm text-slate-500">Development Diagnostics Dashboard</p>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <!-- Top Stats Grid -->
164
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
165
+ <!-- Environment Card -->
166
+ <div class="bg-slate-900/50 border border-slate-700/50 rounded-lg p-6 hover:border-[#E535AB]/30 transition-all">
167
+ <h2 class="text-lg font-semibold mb-4 text-slate-200 flex items-center gap-2">
168
+ <span class="text-[#E535AB]">●</span> Environment
169
+ </h2>
170
+ <div class="space-y-3">
171
+ <div class="flex justify-between items-center py-2 border-b border-slate-800/50">
172
+ <span class="text-slate-400 text-sm">Mode</span>
173
+ <span class="text-slate-200 font-medium text-sm">${debugInfo$1.environment.dev ? "Development" : "Production"}</span>
174
+ </div>
175
+ <div class="flex justify-between items-center py-2 border-b border-slate-800/50">
176
+ <span class="text-slate-400 text-sm">Framework</span>
177
+ <span class="text-slate-200 font-medium text-sm">${debugInfo$1.environment.framework}</span>
178
+ </div>
179
+ <div class="flex justify-between items-center py-2">
180
+ <span class="text-slate-400 text-sm">GraphQL Server</span>
181
+ <span class="text-slate-200 font-medium text-sm">${debugInfo$1.graphql.framework || "Not configured"}</span>
182
+ </div>
183
+ </div>
184
+ </div>
185
+
186
+ <!-- Scanned Files Card -->
187
+ <div class="bg-slate-900/50 border border-slate-700/50 rounded-lg p-6 hover:border-[#E535AB]/30 transition-all">
188
+ <h2 class="text-lg font-semibold mb-4 text-slate-200 flex items-center gap-2">
189
+ <span class="text-[#E535AB]">●</span> Scanned Files
190
+ </h2>
191
+ <div class="space-y-3">
192
+ <div class="flex justify-between items-center py-2 border-b border-slate-800/50">
193
+ <span class="text-slate-400 text-sm">Schemas</span>
194
+ <span class="text-[#E535AB] font-semibold text-sm">${debugInfo$1.scanned.schemas}</span>
195
+ </div>
196
+ <div class="flex justify-between items-center py-2 border-b border-slate-800/50">
197
+ <span class="text-slate-400 text-sm">Resolvers</span>
198
+ <span class="text-[#E535AB] font-semibold text-sm">${debugInfo$1.scanned.resolvers}</span>
199
+ </div>
200
+ <div class="flex justify-between items-center py-2 border-b border-slate-800/50">
201
+ <span class="text-slate-400 text-sm">Directives</span>
202
+ <span class="text-[#E535AB] font-semibold text-sm">${debugInfo$1.scanned.directives}</span>
203
+ </div>
204
+ <div class="flex justify-between items-center py-2">
205
+ <span class="text-slate-400 text-sm">Documents</span>
206
+ <span class="text-[#E535AB] font-semibold text-sm">${debugInfo$1.scanned.documents}</span>
207
+ </div>
208
+ </div>
209
+ </div>
210
+
211
+ <!-- Runtime Info Card -->
212
+ <div class="bg-slate-900/50 border border-slate-700/50 rounded-lg p-6 hover:border-[#E535AB]/30 transition-all">
213
+ <h2 class="text-lg font-semibold mb-4 text-slate-200 flex items-center gap-2">
214
+ <span class="text-[#E535AB]">●</span> Runtime Loaded
215
+ </h2>
216
+ <div class="space-y-3">
217
+ <div class="flex justify-between items-center py-2 border-b border-slate-800/50">
218
+ <span class="text-slate-400 text-sm">Resolvers</span>
219
+ <span class="text-[#E535AB] font-semibold text-sm">${debugInfo$1.runtime.loadedResolvers}</span>
220
+ </div>
221
+ <div class="flex justify-between items-center py-2 border-b border-slate-800/50">
222
+ <span class="text-slate-400 text-sm">Schemas</span>
223
+ <span class="text-[#E535AB] font-semibold text-sm">${debugInfo$1.runtime.loadedSchemas}</span>
224
+ </div>
225
+ <div class="flex justify-between items-center py-2">
226
+ <span class="text-slate-400 text-sm">Directives</span>
227
+ <span class="text-[#E535AB] font-semibold text-sm">${debugInfo$1.runtime.loadedDirectives}</span>
228
+ </div>
229
+ </div>
230
+ </div>
231
+ </div>
232
+
233
+ <!-- Resolver Exports -->
234
+ <div class="bg-slate-900/50 border border-slate-700/50 rounded-lg p-6">
235
+ <div class="flex justify-between items-center mb-4">
236
+ <h2 class="text-xl font-semibold text-slate-200 flex items-center gap-2">
237
+ <span class="text-[#E535AB]">●</span> Resolver Exports
238
+ </h2>
239
+ ${debugInfo$1.scanned.resolverFiles.length > 0 ? `<span class="text-xs text-slate-500 bg-slate-800/50 px-2 py-1 rounded">${debugInfo$1.scanned.resolverFiles.length} files</span>` : ""}
240
+ </div>
241
+ ${debugInfo$1.scanned.resolverFiles.length > 0 ? `
242
+ <div class="max-h-96 overflow-y-auto space-y-2 pr-2">
243
+ ${debugInfo$1.scanned.resolverFiles.map((r) => {
244
+ const totalExports = r.exports.length;
245
+ return `
246
+ <div class="border border-slate-700/50 rounded-lg p-4 hover:border-[#E535AB]/20 hover:bg-slate-800/30 transition-all">
247
+ <div class="flex justify-between items-center mb-3">
248
+ <span class="text-slate-300 font-mono text-xs truncate pr-2">${r.file}</span>
249
+ <span class="bg-slate-800/80 px-2.5 py-0.5 rounded text-[#E535AB] text-[10px] font-semibold whitespace-nowrap">
250
+ ${totalExports} export${totalExports !== 1 ? "s" : ""}
251
+ </span>
252
+ </div>
253
+ <div class="flex flex-wrap gap-1.5">
254
+ ${r.exports.map((e) => {
255
+ const typeConfig = {
256
+ query: {
257
+ bg: "bg-blue-500/10",
258
+ text: "text-blue-400",
259
+ border: "border-blue-500/30",
260
+ symbol: "◆",
261
+ label: "query"
262
+ },
263
+ mutation: {
264
+ bg: "bg-[#E535AB]/10",
265
+ text: "text-[#E535AB]",
266
+ border: "border-[#E535AB]/30",
267
+ symbol: "●",
268
+ label: "mutation"
269
+ },
270
+ type: {
271
+ bg: "bg-purple-500/10",
272
+ text: "text-purple-400",
273
+ border: "border-purple-500/30",
274
+ symbol: "▲",
275
+ label: "type"
276
+ },
277
+ directive: {
278
+ bg: "bg-amber-500/10",
279
+ text: "text-amber-400",
280
+ border: "border-amber-500/30",
281
+ symbol: "@",
282
+ label: "directive"
283
+ },
284
+ resolver: {
285
+ bg: "bg-emerald-500/10",
286
+ text: "text-emerald-400",
287
+ border: "border-emerald-500/30",
288
+ symbol: "◉",
289
+ label: "resolver"
290
+ },
291
+ subscription: {
292
+ bg: "bg-teal-500/10",
293
+ text: "text-teal-400",
294
+ border: "border-teal-500/30",
295
+ symbol: "↻",
296
+ label: "subscription"
297
+ }
298
+ };
299
+ const config = typeConfig[e.type] || typeConfig.resolver;
300
+ return `<span class="px-2.5 py-1 rounded border text-[11px] font-mono ${config.bg} ${config.text} ${config.border} hover:scale-105 transition-transform inline-flex items-center gap-1.5">
301
+ <span class="font-bold">${config.symbol}</span>
302
+ <span class="font-medium">${e.name}</span>
303
+ <span class="opacity-60 text-[9px] uppercase tracking-wide">${config.label}</span>
304
+ </span>`;
305
+ }).join("")}
306
+ </div>
307
+ </div>
308
+ `;
309
+ }).join("")}
310
+ </div>
311
+ ` : "<p class=\"text-slate-500 text-sm\">No resolvers found</p>"}
312
+ </div>
313
+
314
+ <!-- Generated Virtual Modules -->
315
+ <div class="bg-slate-900/50 border border-slate-700/50 rounded-lg p-6">
316
+ <div class="flex justify-between items-center mb-4">
317
+ <h2 class="text-xl font-semibold text-slate-200 flex items-center gap-2">
318
+ <span class="text-[#E535AB]">●</span> Generated Virtual Modules
319
+ </h2>
320
+ <span class="text-xs text-slate-500 bg-slate-800/50 px-2 py-1 rounded">
321
+ ${Object.keys(debugInfo$1.virtualModules).length} modules
322
+ </span>
323
+ </div>
324
+ <div class="space-y-3">
325
+ ${Object.entries(debugInfo$1.virtualModules).map(([moduleName, codeContent]) => {
326
+ const code = String(codeContent);
327
+ const moduleColors = {
328
+ "server-schemas": {
329
+ bg: "bg-blue-500/5",
330
+ border: "border-blue-500/20",
331
+ text: "text-blue-400"
332
+ },
333
+ "server-resolvers": {
334
+ bg: "bg-[#E535AB]/5",
335
+ border: "border-[#E535AB]/20",
336
+ text: "text-[#E535AB]"
337
+ },
338
+ "server-directives": {
339
+ bg: "bg-amber-500/5",
340
+ border: "border-amber-500/20",
341
+ text: "text-amber-400"
342
+ },
343
+ "module-config": {
344
+ bg: "bg-purple-500/5",
345
+ border: "border-purple-500/20",
346
+ text: "text-purple-400"
347
+ },
348
+ "graphql-config": {
349
+ bg: "bg-emerald-500/5",
350
+ border: "border-emerald-500/20",
351
+ text: "text-emerald-400"
352
+ }
353
+ };
354
+ const colorConfig = moduleColors[moduleName] || moduleColors["module-config"];
355
+ const lineCount = code.split("\\n").length;
356
+ const byteSize = new TextEncoder().encode(code).length;
357
+ return `
358
+ <details class="border ${colorConfig.border} ${colorConfig.bg} rounded-lg overflow-hidden group">
359
+ <summary class="cursor-pointer p-4 hover:bg-slate-800/30 transition-all flex justify-between items-center">
360
+ <div class="flex items-center gap-3">
361
+ <span class="${colorConfig.text} text-lg">▸</span>
362
+ <div>
363
+ <span class="font-mono text-sm ${colorConfig.text} font-semibold">#nitro-internal-virtual/${moduleName}</span>
364
+ <div class="text-[10px] text-slate-500 mt-0.5">
365
+ ${lineCount} lines · ${(byteSize / 1024).toFixed(2)} KB
366
+ </div>
367
+ </div>
368
+ </div>
369
+ <button
370
+ onclick="event.stopPropagation(); navigator.clipboard.writeText(this.getAttribute('data-code')); this.textContent = '✓ Copied!'; setTimeout(() => this.textContent = 'Copy', 1000)"
371
+ data-code="${escapeHtml(code).replace(/"/g, "&quot;")}"
372
+ class="text-xs px-3 py-1.5 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded border border-slate-600/50 transition-colors"
373
+ >
374
+ Copy
375
+ </button>
376
+ </summary>
377
+ <div class="border-t ${colorConfig.border}">
378
+ <div class="bg-slate-950/80 p-4 max-h-96 overflow-auto">
379
+ <pre class="text-xs font-mono text-slate-300 leading-relaxed"><code>${escapeHtml(code)}</code></pre>
380
+ </div>
381
+ </div>
382
+ </details>
383
+ `;
384
+ }).join("")}
385
+ </div>
386
+ </div>
387
+
388
+ <!-- Files Grid -->
389
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
390
+ <!-- Schema Files -->
391
+ <div class="bg-slate-900/50 border border-slate-700/50 rounded-lg p-6 hover:border-[#E535AB]/30 transition-all">
392
+ <div class="flex justify-between items-center mb-4">
393
+ <h2 class="text-lg font-semibold text-slate-200 flex items-center gap-2">
394
+ <span class="text-[#E535AB]">●</span> Schema Files
395
+ </h2>
396
+ ${debugInfo$1.scanned.schemaFiles.length > 0 ? `<span class="text-xs text-slate-500 bg-slate-800/50 px-2 py-1 rounded">${debugInfo$1.scanned.schemaFiles.length} file${debugInfo$1.scanned.schemaFiles.length !== 1 ? "s" : ""}</span>` : ""}
397
+ </div>
398
+ <ul class="space-y-2 max-h-64 overflow-y-auto pr-2">
399
+ ${debugInfo$1.scanned.schemaFiles.length > 0 ? debugInfo$1.scanned.schemaFiles.map((f) => `<li class="text-slate-400 font-mono text-xs flex items-start gap-2 py-1.5 px-2 rounded hover:bg-slate-800/50 transition-colors group">
400
+ <span class="text-[#E535AB] text-[10px] mt-0.5 group-hover:scale-110 transition-transform">▸</span>
401
+ <span class="truncate group-hover:text-slate-300">${f}</span>
402
+ </li>`).join("") : "<li class=\"text-slate-500 text-sm\">No schemas found</li>"}
403
+ </ul>
404
+ </div>
405
+
406
+ <!-- Document Files -->
407
+ <div class="bg-slate-900/50 border border-slate-700/50 rounded-lg p-6 hover:border-[#E535AB]/30 transition-all">
408
+ <div class="flex justify-between items-center mb-4">
409
+ <h2 class="text-lg font-semibold text-slate-200 flex items-center gap-2">
410
+ <span class="text-[#E535AB]">●</span> Document Files
411
+ </h2>
412
+ ${debugInfo$1.scanned.documentFiles.length > 0 ? `<span class="text-xs text-slate-500 bg-slate-800/50 px-2 py-1 rounded">${debugInfo$1.scanned.documentFiles.length} file${debugInfo$1.scanned.documentFiles.length !== 1 ? "s" : ""}</span>` : ""}
413
+ </div>
414
+ <ul class="space-y-2 max-h-64 overflow-y-auto pr-2">
415
+ ${debugInfo$1.scanned.documentFiles.length > 0 ? debugInfo$1.scanned.documentFiles.map((f) => `<li class="text-slate-400 font-mono text-xs flex items-start gap-2 py-1.5 px-2 rounded hover:bg-slate-800/50 transition-colors group">
416
+ <span class="text-[#E535AB] text-[10px] mt-0.5 group-hover:scale-110 transition-transform">▸</span>
417
+ <span class="truncate group-hover:text-slate-300">${f}</span>
418
+ </li>`).join("") : "<li class=\"text-slate-500 text-sm\">No documents found</li>"}
419
+ </ul>
420
+ </div>
421
+ </div>
422
+
423
+ <!-- Reload Button -->
424
+ <button
425
+ onclick="location.reload()"
426
+ class="fixed bottom-8 right-8 bg-[#E535AB] hover:bg-[#d12a99] text-white font-semibold px-6 py-3 rounded-lg shadow-lg hover:shadow-xl hover:shadow-[#E535AB]/20 transform hover:-translate-y-1 transition-all duration-200 flex items-center gap-2 border border-[#E535AB]/20"
427
+ >
428
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
429
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
430
+ </svg>
431
+ Reload
432
+ </button>
433
+ </div>
434
+ </body>
435
+ </html>`;
436
+ }
437
+ function escapeHtml(text) {
438
+ const map = {
439
+ "&": "&amp;",
440
+ "<": "&lt;",
441
+ ">": "&gt;",
442
+ "\"": "&quot;",
443
+ "'": "&#039;"
444
+ };
445
+ return text.replace(/[&<>"']/g, (m) => map[m] || m);
446
+ }
447
+
448
+ //#endregion
449
+ export { debug_default as default };
@@ -1,6 +1,6 @@
1
- import * as h31 from "h3";
1
+ import * as h30 from "h3";
2
2
 
3
3
  //#region src/routes/graphql-yoga.d.ts
4
- declare const _default: h31.EventHandler<h31.EventHandlerRequest, Promise<Response>>;
4
+ declare const _default: h30.EventHandler<h30.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -16,8 +16,7 @@ let buildSubgraphSchema = null;
16
16
  async function loadFederationSupport() {
17
17
  if (buildSubgraphSchema !== null) return buildSubgraphSchema;
18
18
  try {
19
- const apolloSubgraph = await import("@apollo/subgraph");
20
- buildSubgraphSchema = apolloSubgraph.buildSubgraphSchema;
19
+ buildSubgraphSchema = (await import("@apollo/subgraph")).buildSubgraphSchema;
21
20
  } catch {
22
21
  buildSubgraphSchema = false;
23
22
  }
@@ -42,8 +41,7 @@ new window.EmbeddedSandbox({
42
41
  </html>`;
43
42
  async function createMergedSchema() {
44
43
  try {
45
- const mergedSchemas = schemas.map((schema$1) => schema$1.def).join("\n\n");
46
- const typeDefs = mergeTypeDefs([mergedSchemas], {
44
+ const typeDefs = mergeTypeDefs([schemas.map((schema$1) => schema$1.def).join("\n\n")], {
47
45
  throwOnConflict: true,
48
46
  commentDescriptions: true,
49
47
  sort: true
@@ -53,13 +51,11 @@ async function createMergedSchema() {
53
51
  let schema;
54
52
  if (federationEnabled) {
55
53
  const buildSubgraph = await loadFederationSupport();
56
- if (buildSubgraph) {
57
- const typeDefsDoc = typeof typeDefs === "string" ? parse(typeDefs) : typeDefs;
58
- schema = buildSubgraph({
59
- typeDefs: typeDefsDoc,
60
- resolvers: mergedResolvers
61
- });
62
- } else {
54
+ if (buildSubgraph) schema = buildSubgraph({
55
+ typeDefs: typeof typeDefs === "string" ? parse(typeDefs) : typeDefs,
56
+ resolvers: mergedResolvers
57
+ });
58
+ else {
63
59
  console.warn("Federation enabled but @apollo/subgraph not available, falling back to regular schema");
64
60
  schema = makeExecutableSchema({
65
61
  typeDefs,
@@ -81,15 +77,12 @@ async function createMergedSchema() {
81
77
  }
82
78
  let yoga;
83
79
  var graphql_yoga_default = defineEventHandler(async (event) => {
84
- if (!yoga) {
85
- const schema = await createMergedSchema();
86
- yoga = createYoga(defu({
87
- schema,
88
- graphqlEndpoint: "/api/graphql",
89
- landingPage: false,
90
- renderGraphiQL: () => apolloSandboxHtml
91
- }, importedConfig));
92
- }
80
+ if (!yoga) yoga = createYoga(defu({
81
+ schema: await createMergedSchema(),
82
+ graphqlEndpoint: "/api/graphql",
83
+ landingPage: false,
84
+ renderGraphiQL: () => apolloSandboxHtml
85
+ }, importedConfig));
93
86
  const request = toWebRequest(event);
94
87
  const response = await yoga.handleRequest(request, event);
95
88
  return new Response(response.body, response);
@@ -1,7 +1,7 @@
1
- import * as h33 from "h3";
1
+ import * as h35 from "h3";
2
2
 
3
3
  //#region src/routes/health.d.ts
4
- declare const _default: h33.EventHandler<h33.EventHandlerRequest, Promise<{
4
+ declare const _default: h35.EventHandler<h35.EventHandlerRequest, Promise<{
5
5
  status: string;
6
6
  message: string;
7
7
  timestamp: string;
@@ -1,8 +1,8 @@
1
1
  //#region src/types/standard-schema.d.ts
2
2
  /** The Standard Schema interface. */
3
- interface StandardSchemaV1<Input = unknown, Output = Input> {
3
+ interface StandardSchemaV1<Input$1 = unknown, Output$1 = Input$1> {
4
4
  /** The Standard Schema properties. */
5
- readonly '~standard': StandardSchemaV1.Props<Input, Output>;
5
+ readonly '~standard': StandardSchemaV1.Props<Input$1, Output$1>;
6
6
  }
7
7
  declare namespace StandardSchemaV1 {
8
8
  /** The Standard Schema properties interface. */
@@ -49,13 +49,12 @@ function normalizeQueryString(url) {
49
49
  return url.split("?")[1] || "";
50
50
  }
51
51
  async function normalizeBody(event) {
52
- const PayloadMethods = [
52
+ if (isMethod(event, [
53
53
  "PATCH",
54
54
  "POST",
55
55
  "PUT",
56
56
  "DELETE"
57
- ];
58
- if (isMethod(event, PayloadMethods)) return await readBody(event);
57
+ ])) return await readBody(event);
59
58
  }
60
59
 
61
60
  //#endregion