nuxt-graphql-middleware 5.2.3 → 5.3.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.
Files changed (133) hide show
  1. package/README.md +2 -0
  2. package/dist/client/200.html +1 -1
  3. package/dist/client/404.html +1 -1
  4. package/dist/client/_nuxt/CqRv5mwS.js +2 -0
  5. package/dist/client/_nuxt/{gyQx9VSj.js → D95LLO0l.js} +1 -1
  6. package/dist/client/_nuxt/{DyBqp5hr.js → DZ-uq6Vd.js} +1 -1
  7. package/dist/client/_nuxt/DrXVleME.js +4 -0
  8. package/dist/client/_nuxt/{BPB7Y782.js → Dx-h1-qv.js} +1 -1
  9. package/dist/client/_nuxt/builds/latest.json +1 -1
  10. package/dist/client/_nuxt/builds/meta/f3f3372e-493e-4c8e-9dbd-18d4c5406f44.json +1 -0
  11. package/dist/client/index.html +1 -1
  12. package/dist/module.d.mts +1 -1
  13. package/dist/module.json +3 -3
  14. package/dist/module.mjs +1526 -70
  15. package/dist/runtime/components/CodeFrame.d.vue.ts +8 -0
  16. package/dist/runtime/components/CodeFrame.vue.d.ts +2 -1
  17. package/dist/runtime/components/DevModeOverlay.d.vue.ts +4 -0
  18. package/dist/runtime/components/DevModeOverlay.vue.d.ts +2 -1
  19. package/dist/runtime/components/ErrorExtensions.d.vue.ts +6 -0
  20. package/dist/runtime/components/ErrorExtensions.vue.d.ts +2 -1
  21. package/dist/runtime/components/ErrorGroup.d.vue.ts +10 -0
  22. package/dist/runtime/components/ErrorGroup.vue.d.ts +2 -1
  23. package/dist/runtime/helpers/composables.d.ts +1 -40
  24. package/dist/runtime/helpers/composables.js +3 -12
  25. package/dist/runtime/helpers/shared-types.d.ts +40 -0
  26. package/dist/runtime/helpers/shared-types.js +12 -0
  27. package/dist/runtime/server/api/doRequest.d.ts +2 -0
  28. package/dist/runtime/server/api/doRequest.js +18 -0
  29. package/dist/runtime/server/helpers/index.js +1 -1
  30. package/dist/runtime/server/mcp/index.d.ts +2 -0
  31. package/dist/runtime/server/mcp/index.js +63 -0
  32. package/dist/runtime/server/mcp/resources/docs.d.ts +2 -0
  33. package/dist/runtime/server/mcp/resources/docs.js +36 -0
  34. package/dist/runtime/server/mcp/tools/fragments-get/index.d.ts +1 -0
  35. package/dist/runtime/server/mcp/tools/fragments-get/index.js +35 -0
  36. package/dist/runtime/server/mcp/tools/fragments-get/types.d.ts +20 -0
  37. package/dist/runtime/server/mcp/tools/fragments-get/types.js +13 -0
  38. package/dist/runtime/server/mcp/tools/fragments-get-source/index.d.ts +1 -0
  39. package/dist/runtime/server/mcp/tools/fragments-get-source/index.js +34 -0
  40. package/dist/runtime/server/mcp/tools/fragments-get-source/types.d.ts +10 -0
  41. package/dist/runtime/server/mcp/tools/fragments-get-source/types.js +9 -0
  42. package/dist/runtime/server/mcp/tools/fragments-list/index.d.ts +1 -0
  43. package/dist/runtime/server/mcp/tools/fragments-list/index.js +36 -0
  44. package/dist/runtime/server/mcp/tools/fragments-list/types.d.ts +20 -0
  45. package/dist/runtime/server/mcp/tools/fragments-list/types.js +14 -0
  46. package/dist/runtime/server/mcp/tools/fragments-list-for-type/index.d.ts +1 -0
  47. package/dist/runtime/server/mcp/tools/fragments-list-for-type/index.js +39 -0
  48. package/dist/runtime/server/mcp/tools/fragments-list-for-type/types.d.ts +31 -0
  49. package/dist/runtime/server/mcp/tools/fragments-list-for-type/types.js +23 -0
  50. package/dist/runtime/server/mcp/tools/graphql-execute/index.d.ts +1 -0
  51. package/dist/runtime/server/mcp/tools/graphql-execute/index.js +59 -0
  52. package/dist/runtime/server/mcp/tools/module-get-config/index.d.ts +1 -0
  53. package/dist/runtime/server/mcp/tools/module-get-config/index.js +23 -0
  54. package/dist/runtime/server/mcp/tools/module-get-config/types.d.ts +39 -0
  55. package/dist/runtime/server/mcp/tools/module-get-config/types.js +26 -0
  56. package/dist/runtime/server/mcp/tools/nitro-graphql-server-utils-example/index.d.ts +1 -0
  57. package/dist/runtime/server/mcp/tools/nitro-graphql-server-utils-example/index.js +36 -0
  58. package/dist/runtime/server/mcp/tools/nitro-graphql-server-utils-example/types.d.ts +49 -0
  59. package/dist/runtime/server/mcp/tools/nitro-graphql-server-utils-example/types.js +24 -0
  60. package/dist/runtime/server/mcp/tools/operations-execute/index.d.ts +1 -0
  61. package/dist/runtime/server/mcp/tools/operations-execute/index.js +63 -0
  62. package/dist/runtime/server/mcp/tools/operations-get/index.d.ts +1 -0
  63. package/dist/runtime/server/mcp/tools/operations-get/index.js +40 -0
  64. package/dist/runtime/server/mcp/tools/operations-get/types.d.ts +32 -0
  65. package/dist/runtime/server/mcp/tools/operations-get/types.js +18 -0
  66. package/dist/runtime/server/mcp/tools/operations-get-field-usage/index.d.ts +1 -0
  67. package/dist/runtime/server/mcp/tools/operations-get-field-usage/index.js +39 -0
  68. package/dist/runtime/server/mcp/tools/operations-get-field-usage/types.d.ts +38 -0
  69. package/dist/runtime/server/mcp/tools/operations-get-field-usage/types.js +19 -0
  70. package/dist/runtime/server/mcp/tools/operations-get-source/index.d.ts +1 -0
  71. package/dist/runtime/server/mcp/tools/operations-get-source/index.js +39 -0
  72. package/dist/runtime/server/mcp/tools/operations-get-source/types.d.ts +10 -0
  73. package/dist/runtime/server/mcp/tools/operations-get-source/types.js +9 -0
  74. package/dist/runtime/server/mcp/tools/operations-list/index.d.ts +1 -0
  75. package/dist/runtime/server/mcp/tools/operations-list/index.js +46 -0
  76. package/dist/runtime/server/mcp/tools/operations-list/types.d.ts +53 -0
  77. package/dist/runtime/server/mcp/tools/operations-list/types.js +33 -0
  78. package/dist/runtime/server/mcp/tools/schema-get-interface-implementors/index.d.ts +1 -0
  79. package/dist/runtime/server/mcp/tools/schema-get-interface-implementors/index.js +37 -0
  80. package/dist/runtime/server/mcp/tools/schema-get-interface-implementors/types.d.ts +24 -0
  81. package/dist/runtime/server/mcp/tools/schema-get-interface-implementors/types.js +16 -0
  82. package/dist/runtime/server/mcp/tools/schema-get-type/index.d.ts +1 -0
  83. package/dist/runtime/server/mcp/tools/schema-get-type/index.js +31 -0
  84. package/dist/runtime/server/mcp/tools/schema-get-type/types.d.ts +112 -0
  85. package/dist/runtime/server/mcp/tools/schema-get-type/types.js +45 -0
  86. package/dist/runtime/server/mcp/tools/schema-get-type-definition/index.d.ts +1 -0
  87. package/dist/runtime/server/mcp/tools/schema-get-type-definition/index.js +33 -0
  88. package/dist/runtime/server/mcp/tools/schema-get-type-definition/types.d.ts +10 -0
  89. package/dist/runtime/server/mcp/tools/schema-get-type-definition/types.js +9 -0
  90. package/dist/runtime/server/mcp/tools/schema-get-type-usage/index.d.ts +1 -0
  91. package/dist/runtime/server/mcp/tools/schema-get-type-usage/index.js +35 -0
  92. package/dist/runtime/server/mcp/tools/schema-get-type-usage/types.d.ts +39 -0
  93. package/dist/runtime/server/mcp/tools/schema-get-type-usage/types.js +17 -0
  94. package/dist/runtime/server/mcp/tools/schema-get-union-members/index.d.ts +1 -0
  95. package/dist/runtime/server/mcp/tools/schema-get-union-members/index.js +35 -0
  96. package/dist/runtime/server/mcp/tools/schema-get-union-members/types.d.ts +24 -0
  97. package/dist/runtime/server/mcp/tools/schema-get-union-members/types.js +16 -0
  98. package/dist/runtime/server/mcp/tools/schema-list-types/index.d.ts +1 -0
  99. package/dist/runtime/server/mcp/tools/schema-list-types/index.js +37 -0
  100. package/dist/runtime/server/mcp/tools/schema-list-types/types.d.ts +53 -0
  101. package/dist/runtime/server/mcp/tools/schema-list-types/types.js +21 -0
  102. package/dist/runtime/server/mcp/tools/schema-validate-document/index.d.ts +1 -0
  103. package/dist/runtime/server/mcp/tools/schema-validate-document/index.js +31 -0
  104. package/dist/runtime/server/mcp/tools/schema-validate-document/types.d.ts +26 -0
  105. package/dist/runtime/server/mcp/tools/schema-validate-document/types.js +21 -0
  106. package/dist/runtime/server/mcp/tools/vue-graphql-composable-example/index.d.ts +1 -0
  107. package/dist/runtime/server/mcp/tools/vue-graphql-composable-example/index.js +36 -0
  108. package/dist/runtime/server/mcp/tools/vue-graphql-composable-example/types.d.ts +49 -0
  109. package/dist/runtime/server/mcp/tools/vue-graphql-composable-example/types.js +24 -0
  110. package/dist/runtime/server/mcp/utils/index.d.ts +48 -0
  111. package/dist/runtime/server/mcp/utils/index.js +35 -0
  112. package/dist/runtime/server/utils/useGraphqlMutation.d.ts +1 -1
  113. package/dist/runtime/server/utils/useGraphqlMutation.js +1 -1
  114. package/dist/runtime/server/utils/useGraphqlQuery.d.ts +1 -1
  115. package/dist/runtime/server/utils/useGraphqlQuery.js +1 -1
  116. package/dist/shared/{nuxt-graphql-middleware.ct2xvPoD.d.mts → nuxt-graphql-middleware.COufMnWs.d.mts} +119 -2
  117. package/dist/utils.d.mts +1 -1
  118. package/docs/composables/useAsyncGraphqlQuery.md +313 -0
  119. package/docs/composables/useGraphqlMutation.md +29 -0
  120. package/docs/composables/useGraphqlQuery.md +73 -0
  121. package/docs/composables/useGraphqlState.md +58 -0
  122. package/docs/composables/useGraphqlUploadMutation.md +57 -0
  123. package/docs/configuration/client-options.md +121 -0
  124. package/docs/configuration/module-hooks.md +112 -0
  125. package/docs/configuration/module-utils.md +53 -0
  126. package/docs/configuration/module.md +415 -0
  127. package/docs/configuration/runtime-config.md +23 -0
  128. package/docs/configuration/server-options.md +230 -0
  129. package/package.json +101 -44
  130. package/dist/client/_nuxt/Bkyil6hz.js +0 -2
  131. package/dist/client/_nuxt/C9p-Va5c.js +0 -29
  132. package/dist/client/_nuxt/builds/meta/77b9a31d-6d5c-4e28-9320-cbd287a46883.json +0 -1
  133. package/dist/runtime/server/tsconfig.json +0 -3
@@ -0,0 +1,230 @@
1
+ # Server Options
2
+
3
+ All dynamic configuration that deals with the server-side requests made to the
4
+ GraphQL server is located in a special runtime file located at
5
+ `~/server/graphqlMiddleware.serverOptions.ts`. This file is bundled together
6
+ with the nitro build in the .output folder.
7
+
8
+ Create a file called `graphqlMiddleware.serverOptions.ts` inside the `serverDir`
9
+ of your Nuxt project. If you didn't specifically override this in your Nuxt
10
+ config this will be `./server`.
11
+
12
+ ::: code-group
13
+
14
+ ```typescript [~/server/graphqlMiddleware.serverOptions.ts]
15
+ import { defineGraphqlServerOptions } from 'nuxt-graphql-middleware/server-options'
16
+
17
+ export default defineGraphqlServerOptions({
18
+ // ...
19
+ })
20
+ ```
21
+
22
+ :::
23
+
24
+ ## doGraphqlRequest
25
+
26
+ Provide a custom method that performs the request to the GraphQL server. It
27
+ receives a single `context` object argument that contains everything required to
28
+ perform the request.
29
+
30
+ The method is called in the /api/graphql server handler. It can do the request
31
+ using `fetch`, `graphql-request` or even a full-fledged library like
32
+ `@apollo/client`.
33
+
34
+ If a custom method is provided all other options (such as graphqlEndpoint,
35
+ serverFetchOptions or onServerResponse) are ignored. The return value of the
36
+ method is directly returned as the response in the server route.
37
+
38
+ ### Example: Custom fetch with retry
39
+
40
+ This example assumes some kind of cookie based token authentication. If the
41
+ request fails because of an expired token it will refresh the token and then
42
+ retry the request.
43
+
44
+ ```typescript
45
+ import { defineGraphqlServerOptions } from 'nuxt-graphql-middleware/server-options'
46
+ import { refreshToken } from './../helpers'
47
+
48
+ export default defineGraphqlServerOptions({
49
+ async doGraphqlRequest({
50
+ event,
51
+ operationName,
52
+ operationDocument,
53
+ variables,
54
+ }) {
55
+ function doRequest(token: string) {
56
+ return $fetch.raw('https://example.com/graphql', {
57
+ method: 'POST',
58
+ ignoreResponseError: true,
59
+ body: {
60
+ query: operationDocument,
61
+ variables,
62
+ operationName,
63
+ },
64
+ headers: {
65
+ token,
66
+ },
67
+ })
68
+ }
69
+
70
+ // Do the first request.
71
+ const incomingToken = getHeader(event, 'cookie')
72
+ let result = await doRequest(incomingToken)
73
+
74
+ // If the status is 401 refresh the token.
75
+ if (result.status === 401) {
76
+ const newToken = await refreshToken(incomingToken)
77
+ // Retry the request.
78
+ result = await doRequest(newToken)
79
+ }
80
+
81
+ // Return the GraphQL response.
82
+ return result._data
83
+ },
84
+ })
85
+ ```
86
+
87
+ ## graphqlEndpoint
88
+
89
+ Dynamically set the GraphQL endpoint URL during runtime per request.
90
+
91
+ ```typescript
92
+ type GraphqlMiddlewareGraphqlEndpointMethod = (
93
+ event?: H3Event,
94
+ operation?: string,
95
+ operationName?: string,
96
+ ) => string | Promise<string> | void
97
+ ```
98
+
99
+ ### Example: Endpoint based on language
100
+
101
+ Here we determine the current language from the incoming `Accept-Language`
102
+ header and use it to target a specific language-prefixed GraphQL endpoint.
103
+
104
+ ```typescript
105
+ import { defineGraphqlServerOptions } from 'nuxt-graphql-middleware/server-options'
106
+ import { getHeader } from 'h3'
107
+ import acceptLanguageParser from 'accept-language-parser'
108
+
109
+ export default defineGraphqlServerOptions({
110
+ graphqlEndpoint(event, operation, operationName) {
111
+ // Get accepted languages.
112
+ const acceptLanguage = getHeader('accept-language')
113
+ const languages = acceptLanguageParser.parse(acceptLanguage)
114
+
115
+ // Use first match or fallback to English.
116
+ const language = languages[0]?.code || 'en'
117
+ return `https://api.example.com/${language}/graphql`
118
+ },
119
+ })
120
+ ```
121
+
122
+ ## serverFetchOptions
123
+
124
+ Provide the options for the ofetch request to the GraphQL server.
125
+
126
+ ```typescript
127
+ type GraphqlMiddlewareServerFetchOptionsMethod = (
128
+ event?: H3Event,
129
+ operation?: string,
130
+ operationName?: string,
131
+ ) => FetchOptions | Promise<FetchOptions>
132
+ ```
133
+
134
+ ### Example: Pass cookie from client to GraphQL server
135
+
136
+ ```typescript
137
+ import { defineGraphqlServerOptions } from 'nuxt-graphql-middleware/server-options'
138
+ import { getHeader } from 'h3'
139
+
140
+ // Pass the cookie from the client request to the GraphQL request.
141
+ export default defineGraphqlServerOptions({
142
+ serverFetchOptions(event, operation, operationName) {
143
+ return {
144
+ headers: {
145
+ Cookie: getHeader(event, 'cookie'),
146
+ },
147
+ }
148
+ },
149
+ })
150
+ ```
151
+
152
+ ## onServerResponse
153
+
154
+ Handle the response from the GraphQL server.
155
+
156
+ You can alter the response, add additional properties to the data, get and set
157
+ headers, etc.
158
+
159
+ ```typescript
160
+ type GraphqlMiddlewareOnServerResponseMethod = (
161
+ event: H3Event,
162
+ response: FetchResponse<any>,
163
+ operation?: string,
164
+ operationName?: string,
165
+ ) => any | Promise<any>
166
+ ```
167
+
168
+ ### Example: Pass cookie from client to GraphQL server and add custom property
169
+
170
+ You can provide a generic argument (object) to define custom properties added to
171
+ the response.
172
+
173
+ ```typescript
174
+ import { defineGraphqlServerOptions } from 'nuxt-graphql-middleware/server-options'
175
+ import type { H3Event } from 'h3'
176
+ import type { FetchResponse } from 'ofetch'
177
+
178
+ export default defineGraphqlServerOptions<{ __customProperty: string[] }>({
179
+ onServerResponse(event, graphqlResponse) {
180
+ // Set a static header.
181
+ event.node.res.setHeader('x-nuxt-custom-header', 'A custom header value')
182
+
183
+ // Pass the set-cookie header from the GraphQL response to the client.
184
+ const setCookie = graphqlResponse.headers.get('set-cookie')
185
+ if (setCookie) {
186
+ event.node.res.setHeader('set-cookie', setCookie)
187
+ }
188
+
189
+ // Add additional properties to the response.
190
+ graphqlResponse._data.__customProperty = ['My', 'values']
191
+
192
+ // Return the GraphQL response.
193
+ return graphqlResponse._data
194
+ },
195
+ })
196
+ ```
197
+
198
+ ## onServerError
199
+
200
+ Handle a fetch error from the GraphQL request.
201
+
202
+ Note that errors are only thrown for responses that are not status 200-299. See
203
+ https://github.com/unjs/ofetch#%EF%B8%8F-handling-errors for more information.
204
+
205
+ ```typescript
206
+ type GraphqlMiddlewareOnServerErrorMethod = (
207
+ event: H3Event,
208
+ error: FetchError,
209
+ operation?: string,
210
+ operationName?: string,
211
+ ) => any | Promise<any>
212
+ ```
213
+
214
+ ### Example: Always return a 200 status to the clients
215
+
216
+ ```typescript
217
+ import { defineGraphqlServerOptions } from 'nuxt-graphql-middleware/server-options'
218
+ import type { H3Event } from 'h3'
219
+ import type { FetchError } from 'ofetch'
220
+
221
+ export default defineGraphqlServerOptions({
222
+ onServerError(event, error, operation, operationName) {
223
+ event.setHeader('cache-control', 'no-cache')
224
+ return {
225
+ data: {},
226
+ errors: [error.message],
227
+ }
228
+ },
229
+ })
230
+ ```
package/package.json CHANGED
@@ -1,22 +1,47 @@
1
1
  {
2
2
  "name": "nuxt-graphql-middleware",
3
- "version": "5.2.3",
3
+ "version": "5.3.0",
4
4
  "description": "Module to perform GraphQL requests as a server middleware.",
5
+ "author": "Jan Hug <me@dulnan.net>",
6
+ "license": "MIT",
5
7
  "repository": {
6
8
  "type": "git",
7
9
  "url": "git+https://github.com/dulnan/nuxt-graphql-middleware.git"
8
10
  },
11
+ "homepage": "https://nuxt-graphql-middleware.dulnan.net",
12
+ "bugs": {
13
+ "url": "https://github.com/dulnan/nuxt-graphql-middleware/issues"
14
+ },
15
+ "keywords": [
16
+ "nuxt",
17
+ "nuxt-module",
18
+ "graphql",
19
+ "middleware",
20
+ "typescript",
21
+ "codegen",
22
+ "ssr"
23
+ ],
9
24
  "type": "module",
10
25
  "exports": {
11
26
  ".": {
12
27
  "types": "./dist/types.d.mts",
13
28
  "import": "./dist/module.mjs"
14
29
  },
15
- "./utils": "./dist/utils.mjs",
16
- "./client-options": "./dist/client-options.mjs",
17
- "./server-options": "./dist/server-options.mjs"
30
+ "./utils": {
31
+ "types": "./dist/utils.d.mts",
32
+ "import": "./dist/utils.mjs"
33
+ },
34
+ "./client-options": {
35
+ "types": "./dist/client-options.d.mts",
36
+ "import": "./dist/client-options.mjs"
37
+ },
38
+ "./server-options": {
39
+ "types": "./dist/server-options.d.mts",
40
+ "import": "./dist/server-options.mjs"
41
+ }
18
42
  },
19
43
  "main": "./dist/module.mjs",
44
+ "types": "./dist/types.d.mts",
20
45
  "typesVersions": {
21
46
  "*": {
22
47
  ".": [
@@ -34,15 +59,19 @@
34
59
  }
35
60
  },
36
61
  "files": [
37
- "dist"
62
+ "dist",
63
+ "docs/composables",
64
+ "docs/configuration"
38
65
  ],
39
- "license": "MIT",
66
+ "engines": {
67
+ "node": ">=18.0.0"
68
+ },
40
69
  "scripts": {
41
70
  "prepack": "npm run styles:build && nuxt-module-build build && npm run client:build",
42
- "dev": "nuxi dev playground --trace-warnings",
43
- "dev:layers": "nuxi dev playground-layers --trace-warnings",
44
- "debug": "nuxi dev playground --inspect",
45
- "dev:build": "nuxi build playground",
71
+ "dev": "PLAYGROUND_MODULE_BUILD=true nuxi dev playground --trace-warnings",
72
+ "dev:layers": "PLAYGROUND_MODULE_BUILD=true nuxi dev playground-layers --trace-warnings",
73
+ "debug": "PLAYGROUND_MODULE_BUILD=true nuxi dev playground --inspect",
74
+ "dev:build": "PLAYGROUND_MODULE_BUILD=true nuxi build playground",
46
75
  "dev:layers:build": "nuxi build playground-layers",
47
76
  "dev:prepare": "PLAYGROUND_MODULE_BUILD=true nuxt-module-build build --stub && PLAYGROUND_MODULE_BUILD=true nuxt-module-build prepare && nuxi prepare playground-layers && nuxi prepare playground",
48
77
  "dev:start": "node ./playground/.output/server/index.mjs",
@@ -58,57 +87,85 @@
58
87
  "cypress:open": "cypress open --e2e",
59
88
  "lint": "eslint ./src",
60
89
  "lint:fix": "eslint ./src --fix",
61
- "test": "vitest",
90
+ "test": "vitest --no-file-parallelism",
62
91
  "test:debug": "vitest --inspect --no-file-parallelism",
63
- "test:ci": "vitest run",
64
- "test:coverage": "vitest run --coverage",
92
+ "test:ci": "vitest run --no-file-parallelism",
93
+ "test:coverage": "vitest run --coverage --no-file-parallelism",
65
94
  "prettier": "prettier --check .",
66
95
  "prettier:fix": "prettier --write .",
67
96
  "styles:build": "postcss ./css/index.css -o ./src/runtime/css/output.css",
68
97
  "styles:watch": "postcss ./css/index.css -o ./src/runtime/css/output.css --watch"
69
98
  },
70
99
  "dependencies": {
71
- "@clack/prompts": "^0.10.0",
72
- "@graphql-codegen/cli": "^5.0.5",
73
- "@graphql-codegen/schema-ast": "^4.1.0",
74
- "@graphql-tools/utils": "^10.8.6",
75
- "@nuxt/devtools-kit": "^2.6.2",
76
- "graphql-typescript-deluxe": "^0.0.15",
77
- "minisearch": "^7.1.2",
78
- "picocolors": "^1.1.1"
100
+ "@clack/core": "^0.4.2",
101
+ "@clack/prompts": "^0.11.0",
102
+ "@graphql-codegen/cli": "^6.1.0",
103
+ "@graphql-codegen/schema-ast": "^5.0.0",
104
+ "@graphql-tools/load": "^8.1.0",
105
+ "@graphql-tools/utils": "^10.11.0",
106
+ "@nuxt/devtools-kit": "^3.1.1",
107
+ "graphql-typescript-deluxe": "^0.1.0",
108
+ "is-unicode-supported": "^2.1.0",
109
+ "micromatch": "^4.0.8",
110
+ "picocolors": "^1.1.1",
111
+ "sirv": "^3.0.2"
112
+ },
113
+ "peerDependencies": {
114
+ "@modelcontextprotocol/sdk": "^1.24.0",
115
+ "@nuxtjs/mcp-toolkit": "^0.5.2",
116
+ "graphql": "^16.0.0",
117
+ "zod": "^3.0.0 || ^4.0.0"
118
+ },
119
+ "peerDependenciesMeta": {
120
+ "@modelcontextprotocol/sdk": {
121
+ "optional": true
122
+ },
123
+ "@nuxtjs/mcp-toolkit": {
124
+ "optional": true
125
+ },
126
+ "zod": {
127
+ "optional": true
128
+ }
79
129
  },
80
130
  "devDependencies": {
81
- "@iconify-json/carbon": "^1.2.8",
82
- "@nuxt/devtools": "^2.4.0",
83
- "@nuxt/devtools-ui-kit": "^2.6.2",
84
- "@nuxt/eslint": "^1.2.0",
85
- "@nuxt/kit": "^4.2.0",
86
- "@nuxt/module-builder": "^1.0.1",
87
- "@nuxt/schema": "^4.2.0",
88
- "@types/micromatch": "^4.0.9",
89
- "cypress": "^13.12.0",
131
+ "commander": "^13.1.0",
132
+ "@iconify-json/carbon": "^1.2.15",
133
+ "@modelcontextprotocol/sdk": "^1.24.3",
134
+ "@nuxt/devtools": "^3.1.1",
135
+ "@nuxt/devtools-ui-kit": "^3.1.1",
136
+ "@nuxt/eslint": "^1.12.1",
137
+ "@nuxt/kit": "^4.2.2",
138
+ "@nuxt/module-builder": "^1.0.2",
139
+ "@nuxt/schema": "^4.2.2",
140
+ "@nuxt/test-utils": "^3.21.0",
141
+ "@nuxtjs/mcp-toolkit": "^0.5.2",
142
+ "@types/micromatch": "^4.0.10",
143
+ "cypress": "^15.7.1",
90
144
  "cypress-wait-until": "^3.0.2",
91
- "eslint": "^9.23.0",
92
- "eslint-config-prettier": "^10.1.1",
93
- "eslint-plugin-prettier": "^5.2.3",
94
- "mermaid": "^11.5.0",
95
- "nuxt": "^4.2.0",
96
- "postcss": "^8.5.3",
145
+ "eslint": "^9.39.2",
146
+ "eslint-config-prettier": "^10.1.8",
147
+ "eslint-plugin-import-x": "^4.16.1",
148
+ "eslint-plugin-prettier": "^5.5.4",
149
+ "mermaid": "^11.12.2",
150
+ "minisearch": "^7.2.0",
151
+ "nuxt": "^4.2.2",
152
+ "postcss": "^8.5.6",
97
153
  "postcss-cli": "^11.0.1",
98
- "postcss-import": "^16.1.0",
154
+ "postcss-import": "^16.1.1",
99
155
  "postcss-nested-import": "^1.3.0",
100
156
  "postcss-prefix-selector": "^2.1.1",
101
157
  "postcss-replace": "^2.0.1",
102
158
  "postcss-url": "^10.1.3",
103
- "prettier": "^3.5.3",
159
+ "prettier": "^3.7.4",
104
160
  "tailwindcss": "^3.4.17",
105
- "tailwindcss-scoped-preflight": "^3.4.10",
106
- "typedoc": "^0.28.1",
107
- "typedoc-plugin-markdown": "^4.6.1",
161
+ "tailwindcss-scoped-preflight": "^3.5.4",
162
+ "typedoc": "^0.28.15",
163
+ "typedoc-plugin-markdown": "^4.9.0",
108
164
  "typedoc-vitepress-theme": "^1.1.2",
109
- "vitepress": "^1.6.3",
165
+ "vitepress": "^1.6.4",
110
166
  "vitepress-plugin-mermaid": "^2.0.17",
111
- "vitest": "^1.6.0",
112
- "vue-tsc": "^2.2.12"
167
+ "vitest": "^3.2.4",
168
+ "vue-tsc": "^3.1.8",
169
+ "zod": "^4.0.0"
113
170
  }
114
171
  }
@@ -1,2 +0,0 @@
1
- import{x,y as _,I as z,J as Ie,r as R,K as ie,k as M,L as ae,M as T,N as he,O as A,P as F,Q as ze,R as w,z as v,S as fe,T as me,d as te,A as V,s as Fe,U as Ve,V as q,W as ne,_ as Te,B as E,C as H,D as re,X as Oe}from"./C9p-Va5c.js";const pe={__name:"NIcon",props:{icon:{type:String,required:!1}},setup(s){return(e,t)=>(_(),x("div",{class:z(["n-icon",s.icon])},null,2))}};typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Me=s=>typeof s<"u";function Le(s){return JSON.parse(JSON.stringify(s))}function ge(s,e,t,n={}){var o,i,r;const{clone:c=!1,passive:l=!1,eventName:u,deep:d=!1,defaultValue:a,shouldEmit:f}=n,m=Ie(),p=t||m?.emit||((o=m?.$emit)==null?void 0:o.bind(m))||((r=(i=m?.proxy)==null?void 0:i.$emit)==null?void 0:r.bind(m?.proxy));let h=u;e||(e="modelValue"),h=h||`update:${e.toString()}`;const g=S=>c?typeof c=="function"?c(S):Le(S):S,k=()=>Me(s[e])?g(s[e]):a,b=S=>{f?f(S)&&p(h,S):p(h,S)};if(l){const S=k(),L=R(S);let I=!1;return ie(()=>s[e],C=>{I||(I=!0,L.value=g(C),ae(()=>I=!1))}),ie(L,C=>{!I&&(C!==s[e]||d)&&b(C)},{deep:d}),L}else return M({get(){return k()},set(S){b(S)}})}const $e={class:"n-text-input flex flex items-center border n-border-base rounded n-bg-base py-1 pl-1 pr-2 focus-within:border-context focus-within:n-focus-base"},De={__name:"NTextInput",props:{modelValue:{type:[String,Number],required:!1,default:""},icon:{type:String,required:!1},placeholder:{type:String,required:!1},disabled:{type:Boolean,required:!1},autofocus:{type:Boolean,required:!1},autocomplete:{type:String,required:!1},readonly:{type:Boolean,required:!1},type:{type:String,required:!1,default:"text"}},emits:["keydown","keyup","change"],setup(s,{emit:e}){const o=ge(s,"modelValue",e,{passive:!0});return(i,r)=>{const c=pe;return _(),x("div",$e,[T(i.$slots,"icon",{},()=>[s.icon?(_(),A(c,{key:0,icon:s.icon,class:"ml-0.3em mr-0.1em text-1.1em op50"},null,8,["icon"])):F("",!0)]),he(v("input",fe({"onUpdate:modelValue":r[0]||(r[0]=l=>me(o)?o.value=l:null)},i.$props,{class:"ml-0.4em w-full flex-auto n-bg-base !outline-none"}),null,16),[[ze,w(o)]])])}}},Ee=te({__name:"Tag",props:{green:{type:Boolean},orange:{type:Boolean},text:{}},setup(s){const e=s,t=M(()=>e.green?"bg-green-400:10 text-green-400":e.orange?"bg-orange-400:10 text-orange-400":"bg-gray-400:10 text-gray");return(n,o)=>(_(),x("span",{class:z(["mx-0.5 select-none whitespace-nowrap rounded px-1.5 py-0.5 text-xs inline-block",w(t)])},V(s.text),3))}}),_e=Object.assign(Ee,{__name:"Tag"});let $;const B=[];function ve(s){if(B.push(s),!(typeof window>"u"))return window.__NUXT_DEVTOOLS__&&B.forEach(e=>e(window.__NUXT_DEVTOOLS__)),Object.defineProperty(window,"__NUXT_DEVTOOLS__",{set(e){e&&B.forEach(t=>t(e))},get(){return $.value},configurable:!0}),()=>{B.splice(B.indexOf(s),1)}}function Ne(){$||($=Fe(),ve(e));function s(){$&&Ve($)}function e(t){$.value=t,t.host&&t.host.hooks.hook("host:update:reactivity",s)}return $}const Ae=Ne(),qe=["innerHTML"],Pe=["textContent"],Be={__name:"NCodeBlock",props:{code:{type:String,required:!0},lang:{type:null,required:!1},lines:{type:Boolean,required:!1,default:!0},inline:{type:Boolean,required:!1},grammarContextCode:{type:String,required:!1},transformRendered:{type:Function,required:!1}},emits:["loaded"],setup(s,{emit:e}){const t=s,n=e,o=M(()=>{const r=t.lang==="text"?{code:t.code,supported:!1}:Ae.value?.devtools.renderCodeHighlight(t.code,t.lang,{grammarContextCode:t.grammarContextCode})||{code:t.code,supported:!1};return r.supported&&t.transformRendered&&(r.code=t.transformRendered(r.code)),r.supported&&ae(()=>n("loaded")),r}),i=M(()=>["n-code-block shiki",t.lines&&!t.inline?"n-code-block-lines":""]);return(r,c)=>s.lang&&o.value.supported?(_(),x("pre",{key:0,class:z(i.value)},[v("code",{innerHTML:o.value.code},null,8,qe)],2)):(_(),x("pre",{key:1,class:z(i.value)},[v("code",null,[(_(!0),x(q,null,ne(s.code.split(`
2
- `),(l,u)=>(_(),x(q,{key:u},[v("span",{class:"line",textContent:V(l)},null,8,Pe),c[0]||(c[0]=v("br",null,null,-1))],64))),128))])],2))}},Re={flex:"~ gap-3","items-center":""},je={__name:"NIconTitle",props:{icon:{type:String,required:!1},text:{type:String,required:!1}},setup(s){return(e,t)=>(_(),x("div",Re,[s.icon?(_(),x("div",{key:0,class:z(s.icon)},null,2)):F("",!0),T(e.$slots,"default",{},()=>[v("div",null,V(s.text),1)])]))}},We=["open"],Ue={"text-base":""},Je={key:0,"text-sm":"",op50:""},Qe={__name:"NSectionBlock",props:{icon:{type:String,required:!1},text:{type:String,required:!1},description:{type:String,required:!1},containerClass:{type:String,required:!1,default:""},headerClass:{type:String,required:!1},collapse:{type:Boolean,required:!1,default:!0},open:{type:Boolean,required:!1,default:!0},padding:{type:[Boolean,String],required:!1,default:!0}},setup(s){const t=ge(s,"open",void 0,{passive:!0});function n(o){t.value=o.target.open}return(o,i)=>{const r=pe,c=je;return _(),x(q,null,[v("details",{open:w(t),onToggle:n},[v("summary",{class:z(["cursor-pointer select-none p4 hover:bg-active",s.collapse?"":"pointer-events-none"])},[E(c,{icon:s.icon,text:s.text,"text-xl":"",transition:"",class:z([w(t)?"op100":"op60",s.headerClass])},{default:H(()=>[v("div",null,[v("div",Ue,[T(o.$slots,"text",{},()=>[re(V(s.text),1)],!0)]),s.description||o.$slots.description?(_(),x("div",Je,[T(o.$slots,"description",{},()=>[re(V(s.description),1)],!0)])):F("",!0)]),i[0]||(i[0]=v("div",{class:"flex-auto"},null,-1)),T(o.$slots,"actions",{},void 0,!0),s.collapse?(_(),A(r,{key:0,icon:"carbon-chevron-down",class:"chevron","cursor-pointer":"","place-self-start":"","text-base":"",op75:"",transition:"","duration-500":""})):F("",!0)]),_:3},8,["icon","text","class"])],2),i._lazyshow1||w(t)?(i._lazyshow1=!0,_(),x(q,null,[he(v("div",{class:z(["flex flex-col flex-gap2 pb6 pt2",typeof s.padding=="string"?s.padding:s.padding?"px4":""])},[T(o.$slots,"details",{},void 0,!0),v("div",{class:z([s.containerClass,"mt1"])},[T(o.$slots,"default",{},void 0,!0)],2),T(o.$slots,"footer",{},void 0,!0)],2),[[Oe,w(t)]])],64)):F("v-show-if",!0)],40,We),i[1]||(i[1]=v("div",{class:"x-divider"},null,-1))],64)}}},Ge=Te(Qe,[["__scopeId","data-v-45092635"]]),Ke={class:"h-full of-auto p2"},Xe={class:"p5"},He={class:"font-mono mb4 font-bold text-3xl"},Ye={key:0,class:"mb3"},Ze=["href"],et={key:0,class:"font-mono bg-red-900 text-red-100 p2"},tt=te({__name:"DocumentDetail",props:{id:{},timestamp:{},source:{},name:{},identifier:{},filePath:{},serverApiPrefix:{}},setup(s){const e=s,t=M(()=>[]),n=M(()=>e.identifier!=="fragment"?`${e.serverApiPrefix}/${e.identifier}/${e.name}`:null);return(o,i)=>{const r=_e,c=Be,l=Ge;return _(),x("div",Ke,[v("div",Xe,[v("h2",He,V(s.name),1),w(n)?(_(),x("div",Ye,[s.identifier==="query"?(_(),A(r,{key:0,green:"",text:"GET"})):(_(),A(r,{key:1,orange:"",text:"POST"})),v("a",{class:"n-transition n-link n-link-base hover:n-link-hover ml2",target:"_blank",href:w(n)},V(w(n)),9,Ze)])):F("",!0)]),E(l,{text:"Document",description:s.filePath,padding:"px4"},{default:H(()=>[E(c,{code:s.source,lang:"graphql"},null,8,["code"])]),_:1},8,["description"]),E(l,{text:"Errors",description:w(t).length+" errors",padding:"px4"},{default:H(()=>[w(t).length?(_(),x("div",et,[(_(!0),x(q,null,ne(w(t),(u,d)=>(_(),x("div",{key:d},V(u),1))),128))])):F("",!0)]),_:1},8,["description"])])}}}),nt=Object.assign(tt,{__name:"DocumentDetail"}),st="ENTRIES",xe="KEYS",ye="VALUES",y="";class J{constructor(e,t){const n=e._tree,o=Array.from(n.keys());this.set=e,this._type=t,this._path=o.length>0?[{node:n,keys:o}]:[]}next(){const e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:e,keys:t}=D(this._path);if(D(t)===y)return{done:!1,value:this.result()};const n=e.get(D(t));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const e=D(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>D(e)).filter(e=>e!==y).join("")}value(){return D(this._path).node.get(y)}result(){switch(this._type){case ye:return this.value();case xe:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const D=s=>s[s.length-1],ot=(s,e,t)=>{const n=new Map;if(e===void 0)return n;const o=e.length+1,i=o+t,r=new Uint8Array(i*o).fill(t+1);for(let c=0;c<o;++c)r[c]=c;for(let c=1;c<i;++c)r[c*o]=c;return we(s,e,t,n,r,1,o,""),n},we=(s,e,t,n,o,i,r,c)=>{const l=i*r;e:for(const u of s.keys())if(u===y){const d=o[l-1];d<=t&&n.set(c,[s.get(u),d])}else{let d=i;for(let a=0;a<u.length;++a,++d){const f=u[a],m=r*d,p=m-r;let h=o[m];const g=Math.max(0,d-t-1),k=Math.min(r-1,d+t);for(let b=g;b<k;++b){const S=f!==e[b],L=o[p+b]+ +S,I=o[p+b+1]+1,C=o[m+b]+1,P=o[m+b+1]=Math.min(L,I,C);P<h&&(h=P)}if(h>t)continue e}we(s.get(u),e,t,n,o,d,r,c+u)}};class O{constructor(e=new Map,t=""){this._size=void 0,this._tree=e,this._prefix=t}atPrefix(e){if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");const[t,n]=U(this._tree,e.slice(this._prefix.length));if(t===void 0){const[o,i]=se(n);for(const r of o.keys())if(r!==y&&r.startsWith(i)){const c=new Map;return c.set(r.slice(i.length),o.get(r)),new O(c,e)}}return new O(t,e)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,it(this._tree,e)}entries(){return new J(this,st)}forEach(e){for(const[t,n]of this)e(t,n,this)}fuzzyGet(e,t){return ot(this._tree,e,t)}get(e){const t=Y(this._tree,e);return t!==void 0?t.get(y):void 0}has(e){const t=Y(this._tree,e);return t!==void 0&&t.has(y)}keys(){return new J(this,xe)}set(e,t){if(typeof e!="string")throw new Error("key must be a string");return this._size=void 0,Q(this._tree,e).set(y,t),this}get size(){if(this._size)return this._size;this._size=0;const e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;const n=Q(this._tree,e);return n.set(y,t(n.get(y))),this}fetch(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;const n=Q(this._tree,e);let o=n.get(y);return o===void 0&&n.set(y,o=t()),o}values(){return new J(this,ye)}[Symbol.iterator](){return this.entries()}static from(e){const t=new O;for(const[n,o]of e)t.set(n,o);return t}static fromObject(e){return O.from(Object.entries(e))}}const U=(s,e,t=[])=>{if(e.length===0||s==null)return[s,t];for(const n of s.keys())if(n!==y&&e.startsWith(n))return t.push([s,n]),U(s.get(n),e.slice(n.length),t);return t.push([s,e]),U(void 0,"",t)},Y=(s,e)=>{if(e.length===0||s==null)return s;for(const t of s.keys())if(t!==y&&e.startsWith(t))return Y(s.get(t),e.slice(t.length))},Q=(s,e)=>{const t=e.length;e:for(let n=0;s&&n<t;){for(const i of s.keys())if(i!==y&&e[n]===i[0]){const r=Math.min(t-n,i.length);let c=1;for(;c<r&&e[n+c]===i[c];)++c;const l=s.get(i);if(c===i.length)s=l;else{const u=new Map;u.set(i.slice(c),l),s.set(e.slice(n,n+c),u),s.delete(i),s=u}n+=c;continue e}const o=new Map;return s.set(e.slice(n),o),o}return s},it=(s,e)=>{const[t,n]=U(s,e);if(t!==void 0){if(t.delete(y),t.size===0)be(n);else if(t.size===1){const[o,i]=t.entries().next().value;Se(n,o,i)}}},be=s=>{if(s.length===0)return;const[e,t]=se(s);if(e.delete(t),e.size===0)be(s.slice(0,-1));else if(e.size===1){const[n,o]=e.entries().next().value;n!==y&&Se(s.slice(0,-1),n,o)}},Se=(s,e,t)=>{if(s.length===0)return;const[n,o]=se(s);n.set(o+e,t),n.delete(o)},se=s=>s[s.length-1],oe="or",ke="and",rt="and_not";class N{constructor(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');const t=e.autoVacuum==null||e.autoVacuum===!0?X:e.autoVacuum;this._options={...K,...e,autoVacuum:t,searchOptions:{...ce,...e.searchOptions||{}},autoSuggestOptions:{...at,...e.autoSuggestOptions||{}}},this._index=new O,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=ee,this.addFields(this._options.fields)}add(e){const{extractField:t,tokenize:n,processTerm:o,fields:i,idField:r}=this._options,c=t(e,r);if(c==null)throw new Error(`MiniSearch: document does not have ID field "${r}"`);if(this._idToShortId.has(c))throw new Error(`MiniSearch: duplicate ID ${c}`);const l=this.addDocumentId(c);this.saveStoredFields(l,e);for(const u of i){const d=t(e,u);if(d==null)continue;const a=n(d.toString(),u),f=this._fieldIds[u],m=new Set(a).size;this.addFieldLength(l,f,this._documentCount-1,m);for(const p of a){const h=o(p,u);if(Array.isArray(h))for(const g of h)this.addTerm(f,l,g);else h&&this.addTerm(f,l,h)}}}addAll(e){for(const t of e)this.add(t)}addAllAsync(e,t={}){const{chunkSize:n=10}=t,o={chunk:[],promise:Promise.resolve()},{chunk:i,promise:r}=e.reduce(({chunk:c,promise:l},u,d)=>(c.push(u),(d+1)%n===0?{chunk:[],promise:l.then(()=>new Promise(a=>setTimeout(a,0))).then(()=>this.addAll(c))}:{chunk:c,promise:l}),o);return r.then(()=>this.addAll(i))}remove(e){const{tokenize:t,processTerm:n,extractField:o,fields:i,idField:r}=this._options,c=o(e,r);if(c==null)throw new Error(`MiniSearch: document does not have ID field "${r}"`);const l=this._idToShortId.get(c);if(l==null)throw new Error(`MiniSearch: cannot remove document with ID ${c}: it is not in the index`);for(const u of i){const d=o(e,u);if(d==null)continue;const a=t(d.toString(),u),f=this._fieldIds[u],m=new Set(a).size;this.removeFieldLength(l,f,this._documentCount,m);for(const p of a){const h=n(p,u);if(Array.isArray(h))for(const g of h)this.removeTerm(f,l,g);else h&&this.removeTerm(f,l,h)}}this._storedFields.delete(l),this._documentIds.delete(l),this._idToShortId.delete(c),this._fieldLength.delete(l),this._documentCount-=1}removeAll(e){if(e)for(const t of e)this.remove(t);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new O,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(e){const t=this._idToShortId.get(e);if(t==null)throw new Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(t),this._storedFields.delete(t),(this._fieldLength.get(t)||[]).forEach((n,o)=>{this.removeFieldLength(t,o,this._documentCount,n)}),this._fieldLength.delete(t),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:e,minDirtCount:t,batchSize:n,batchWait:o}=this._options.autoVacuum;this.conditionalVacuum({batchSize:n,batchWait:o},{minDirtCount:t,minDirtFactor:e})}discardAll(e){const t=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const n of e)this.discard(n)}finally{this._options.autoVacuum=t}this.maybeAutoVacuum()}replace(e){const{idField:t,extractField:n}=this._options,o=n(e,t);this.discard(o),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,t){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const n=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=ee,this.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,t){const n=this._dirtCount;if(this.vacuumConditionsMet(t)){const o=e.batchSize||Z.batchSize,i=e.batchWait||Z.batchWait;let r=1;for(const[c,l]of this._index){for(const[u,d]of l)for(const[a]of d)this._documentIds.has(a)||(d.size<=1?l.delete(u):d.delete(a));this._index.get(c).size===0&&this._index.delete(c),r%o===0&&await new Promise(u=>setTimeout(u,i)),r+=1}this._dirtCount-=n}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:t,minDirtFactor:n}=e;return t=t||X.minDirtCount,n=n||X.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=n}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){const t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)}search(e,t={}){const{searchOptions:n}=this._options,o={...n,...t},i=this.executeQuery(e,t),r=[];for(const[c,{score:l,terms:u,match:d}]of i){const a=u.length||1,f={id:this._documentIds.get(c),score:l*a,terms:Object.keys(d),queryTerms:u,match:d};Object.assign(f,this._storedFields.get(c)),(o.filter==null||o.filter(f))&&r.push(f)}return e===N.wildcard&&o.boostDocument==null||r.sort(ue),r}autoSuggest(e,t={}){t={...this._options.autoSuggestOptions,...t};const n=new Map;for(const{score:i,terms:r}of this.search(e,t)){const c=r.join(" "),l=n.get(c);l!=null?(l.score+=i,l.count+=1):n.set(c,{score:i,terms:r,count:1})}const o=[];for(const[i,{score:r,terms:c,count:l}]of n)o.push({suggestion:i,terms:c,score:r/l});return o.sort(ue),o}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),t)}static async loadJSONAsync(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(e),t)}static getDefault(e){if(K.hasOwnProperty(e))return G(K,e);throw new Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,t){const{index:n,documentIds:o,fieldLength:i,storedFields:r,serializationVersion:c}=e,l=this.instantiateMiniSearch(e,t);l._documentIds=j(o),l._fieldLength=j(i),l._storedFields=j(r);for(const[u,d]of l._documentIds)l._idToShortId.set(d,u);for(const[u,d]of n){const a=new Map;for(const f of Object.keys(d)){let m=d[f];c===1&&(m=m.ds),a.set(parseInt(f,10),j(m))}l._index.set(u,a)}return l}static async loadJSAsync(e,t){const{index:n,documentIds:o,fieldLength:i,storedFields:r,serializationVersion:c}=e,l=this.instantiateMiniSearch(e,t);l._documentIds=await W(o),l._fieldLength=await W(i),l._storedFields=await W(r);for(const[d,a]of l._documentIds)l._idToShortId.set(a,d);let u=0;for(const[d,a]of n){const f=new Map;for(const m of Object.keys(a)){let p=a[m];c===1&&(p=p.ds),f.set(parseInt(m,10),await W(p))}++u%1e3===0&&await Ce(0),l._index.set(d,f)}return l}static instantiateMiniSearch(e,t){const{documentCount:n,nextId:o,fieldIds:i,averageFieldLength:r,dirtCount:c,serializationVersion:l}=e;if(l!==1&&l!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const u=new N(t);return u._documentCount=n,u._nextId=o,u._idToShortId=new Map,u._fieldIds=i,u._avgFieldLength=r,u._dirtCount=c||0,u._index=new O,u}executeQuery(e,t={}){if(e===N.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){const f={...t,...e,queries:void 0},m=e.queries.map(p=>this.executeQuery(p,f));return this.combineResults(m,f.combineWith)}const{tokenize:n,processTerm:o,searchOptions:i}=this._options,r={tokenize:n,processTerm:o,...i,...t},{tokenize:c,processTerm:l}=r,a=c(e).flatMap(f=>l(f)).filter(f=>!!f).map(dt(r)).map(f=>this.executeQuerySpec(f,r));return this.combineResults(a,r.combineWith)}executeQuerySpec(e,t){const n={...this._options.searchOptions,...t},o=(n.fields||this._options.fields).reduce((h,g)=>({...h,[g]:G(n.boost,g)||1}),{}),{boostDocument:i,weights:r,maxFuzzy:c,bm25:l}=n,{fuzzy:u,prefix:d}={...ce.weights,...r},a=this._index.get(e.term),f=this.termResults(e.term,e.term,1,e.termBoost,a,o,i,l);let m,p;if(e.prefix&&(m=this._index.atPrefix(e.term)),e.fuzzy){const h=e.fuzzy===!0?.2:e.fuzzy,g=h<1?Math.min(c,Math.round(e.term.length*h)):h;g&&(p=this._index.fuzzyGet(e.term,g))}if(m)for(const[h,g]of m){const k=h.length-e.term.length;if(!k)continue;p?.delete(h);const b=d*h.length/(h.length+.3*k);this.termResults(e.term,h,b,e.termBoost,g,o,i,l,f)}if(p)for(const h of p.keys()){const[g,k]=p.get(h);if(!k)continue;const b=u*h.length/(h.length+k);this.termResults(e.term,h,b,e.termBoost,g,o,i,l,f)}return f}executeWildcardQuery(e){const t=new Map,n={...this._options.searchOptions,...e};for(const[o,i]of this._documentIds){const r=n.boostDocument?n.boostDocument(i,"",this._storedFields.get(o)):1;t.set(o,{score:r,terms:[],match:{}})}return t}combineResults(e,t=oe){if(e.length===0)return new Map;const n=t.toLowerCase(),o=ct[n];if(!o)throw new Error(`Invalid combination operator: ${t}`);return e.reduce(o)||new Map}toJSON(){const e=[];for(const[t,n]of this._index){const o={};for(const[i,r]of n)o[i]=Object.fromEntries(r);e.push([t,o])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:e,serializationVersion:2}}termResults(e,t,n,o,i,r,c,l,u=new Map){if(i==null)return u;for(const d of Object.keys(r)){const a=r[d],f=this._fieldIds[d],m=i.get(f);if(m==null)continue;let p=m.size;const h=this._avgFieldLength[f];for(const g of m.keys()){if(!this._documentIds.has(g)){this.removeTerm(f,g,t),p-=1;continue}const k=c?c(this._documentIds.get(g),t,this._storedFields.get(g)):1;if(!k)continue;const b=m.get(g),S=this._fieldLength.get(g)[f],L=ut(b,p,this._documentCount,S,h,l),I=n*o*a*k*L,C=u.get(g);if(C){C.score+=I,ht(C.terms,e);const P=G(C.match,t);P?P.push(d):C.match[t]=[d]}else u.set(g,{score:I,terms:[e],match:{[t]:[d]}})}}return u}addTerm(e,t,n){const o=this._index.fetch(n,de);let i=o.get(e);if(i==null)i=new Map,i.set(t,1),o.set(e,i);else{const r=i.get(t);i.set(t,(r||0)+1)}}removeTerm(e,t,n){if(!this._index.has(n)){this.warnDocumentChanged(t,e,n);return}const o=this._index.fetch(n,de),i=o.get(e);i==null||i.get(t)==null?this.warnDocumentChanged(t,e,n):i.get(t)<=1?i.size<=1?o.delete(e):i.delete(t):i.set(t,i.get(t)-1),this._index.get(n).size===0&&this._index.delete(n)}warnDocumentChanged(e,t,n){for(const o of Object.keys(this._fieldIds))if(this._fieldIds[o]===t){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${n}" was not present in field "${o}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(e){const t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t}addFields(e){for(let t=0;t<e.length;t++)this._fieldIds[e[t]]=t}addFieldLength(e,t,n,o){let i=this._fieldLength.get(e);i==null&&this._fieldLength.set(e,i=[]),i[t]=o;const c=(this._avgFieldLength[t]||0)*n+o;this._avgFieldLength[t]=c/(n+1)}removeFieldLength(e,t,n,o){if(n===1){this._avgFieldLength[t]=0;return}const i=this._avgFieldLength[t]*n-o;this._avgFieldLength[t]=i/(n-1)}saveStoredFields(e,t){const{storeFields:n,extractField:o}=this._options;if(n==null||n.length===0)return;let i=this._storedFields.get(e);i==null&&this._storedFields.set(e,i={});for(const r of n){const c=o(t,r);c!==void 0&&(i[r]=c)}}}N.wildcard=Symbol("*");const G=(s,e)=>Object.prototype.hasOwnProperty.call(s,e)?s[e]:void 0,ct={[oe]:(s,e)=>{for(const t of e.keys()){const n=s.get(t);if(n==null)s.set(t,e.get(t));else{const{score:o,terms:i,match:r}=e.get(t);n.score=n.score+o,n.match=Object.assign(n.match,r),le(n.terms,i)}}return s},[ke]:(s,e)=>{const t=new Map;for(const n of e.keys()){const o=s.get(n);if(o==null)continue;const{score:i,terms:r,match:c}=e.get(n);le(o.terms,r),t.set(n,{score:o.score+i,terms:o.terms,match:Object.assign(o.match,c)})}return t},[rt]:(s,e)=>{for(const t of e.keys())s.delete(t);return s}},lt={k:1.2,b:.7,d:.5},ut=(s,e,t,n,o,i)=>{const{k:r,b:c,d:l}=i;return Math.log(1+(t-e+.5)/(e+.5))*(l+s*(r+1)/(s+r*(1-c+c*n/o)))},dt=s=>(e,t,n)=>{const o=typeof s.fuzzy=="function"?s.fuzzy(e,t,n):s.fuzzy||!1,i=typeof s.prefix=="function"?s.prefix(e,t,n):s.prefix===!0,r=typeof s.boostTerm=="function"?s.boostTerm(e,t,n):1;return{term:e,fuzzy:o,prefix:i,termBoost:r}},K={idField:"id",extractField:(s,e)=>s[e],tokenize:s=>s.split(ft),processTerm:s=>s.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(s,e)=>{typeof console?.[s]=="function"&&console[s](e)},autoVacuum:!0},ce={combineWith:oe,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:lt},at={combineWith:ke,prefix:(s,e,t)=>e===t.length-1},Z={batchSize:1e3,batchWait:10},ee={minDirtFactor:.1,minDirtCount:20},X={...Z,...ee},ht=(s,e)=>{s.includes(e)||s.push(e)},le=(s,e)=>{for(const t of e)s.includes(t)||s.push(t)},ue=({score:s},{score:e})=>e-s,de=()=>new Map,j=s=>{const e=new Map;for(const t of Object.keys(s))e.set(parseInt(t,10),s[t]);return e},W=async s=>{const e=new Map;let t=0;for(const n of Object.keys(s))e.set(parseInt(n,10),s[n]),++t%1e3===0&&await Ce(0);return e},Ce=s=>new Promise(e=>setTimeout(e,s)),ft=/[\n\r\p{Z}\p{P}]+/u,mt={class:"relative",style:{height:"100vh"}},pt={class:"flex h-full"},gt={class:"h-full border-r border-r-gray-800 of-auto","h-full":"",style:{width:"22rem","min-width":"0",flex:"0 0 auto"}},_t={flex:"~ col gap2",border:"b base",class:"border-b-gray-800 p3 flex-1"},vt=["onClick"],xt={style:{width:"6rem"},class:"text-left"},yt=["onClick"],wt={key:0,class:"h-full relative w-full of-auto"},bt="nuxt-graphql-middleware",kt=te({__name:"index",setup(s){const e=new N({fields:["id","source","name","filePath","identifier"],storeFields:["id","source","name","identifier","filePath"],searchOptions:{fuzzy:.7}}),t=R(""),n=R([]),o=R(""),i=R(""),r=M(()=>{if(t.value)return n.value.find(d=>d.id===t.value)});async function c(d){e.removeAll(),n.value=d,e.addAll(d)}ve(async d=>{const a=d.devtools.extendClientRpc(bt,{showNotification(){},documentsUpdated(p){c(p)}}),f=await a.getDocuments();c(f);const m=await a.getModuleOptions();i.value=m.serverApiPrefix});function l(d){const a=document.createElement("textarea");a.value=d.source,a.style.top="0",a.style.left="0",a.style.position="fixed",document.body.appendChild(a),a.focus(),a.select();try{document.execCommand("copy")}catch{}document.body.removeChild(a)}const u=M(()=>o.value?e.search(o.value):n.value);return(d,a)=>{const f=De,m=_e,p=nt;return _(),x("div",mt,[v("div",pt,[v("div",gt,[v("div",_t,[E(f,{modelValue:w(o),"onUpdate:modelValue":a[0]||(a[0]=h=>me(o)?o.value=h:null),placeholder:"Search documents...",icon:"carbon-search",class:"w-full"},null,8,["modelValue"])]),(_(!0),x(q,null,ne(w(u),h=>(_(),x("div",{key:h.id,class:"relative group"},[v("button",{class:"text-secondary hover:n-bg-hover flex select-none truncate px2 py2 font-mono text-sm w-full",onClick:g=>t.value=h.id},[v("div",xt,[h.identifier==="query"?(_(),A(m,{key:0,green:"",text:"Query"})):h.identifier==="mutation"?(_(),A(m,{key:1,orange:"",text:"Mutation"})):F("",!0)]),v("div",null,V(h.name),1)],8,vt),v("button",{class:"absolute right-0 top-0 text-sm h-full flex items-center opacity-0 group-hover:opacity-100 pr2",onClick:g=>l(h)},[...a[1]||(a[1]=[v("span",null,"Copy",-1)])],8,yt)]))),128))]),a[2]||(a[2]=v("div",{class:"splitpanes__splitter"},null,-1)),w(r)?(_(),x("div",wt,[E(p,fe(w(r),{"server-api-prefix":w(i)}),null,16,["server-api-prefix"])])):F("",!0)])])}}});export{kt as default};