nuxt-graphql-middleware 5.0.0-alpha.1 → 5.0.0-alpha.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.
Files changed (65) hide show
  1. package/dist/client/200.html +11 -0
  2. package/dist/client/404.html +11 -0
  3. package/dist/client/_nuxt/AZpplOcD.js +1 -0
  4. package/dist/client/_nuxt/B2Rg1ezw.js +1 -0
  5. package/dist/client/_nuxt/Bt6N0bOg.js +2 -0
  6. package/dist/client/_nuxt/M311G39J.js +25 -0
  7. package/dist/client/_nuxt/builds/latest.json +1 -0
  8. package/dist/client/_nuxt/builds/meta/88c25798-8ea2-4139-90f2-506f3146e7b3.json +1 -0
  9. package/dist/client/_nuxt/entry.Cn9qfNGa.css +1 -0
  10. package/dist/client/_nuxt/error-404.ehK72JOs.css +1 -0
  11. package/dist/client/_nuxt/error-500._g0akJim.css +1 -0
  12. package/dist/client/_nuxt/index.DGEN-H8t.css +1 -0
  13. package/dist/client/_nuxt/u9er1db2.js +1 -0
  14. package/dist/client/index.html +11 -0
  15. package/dist/module.d.mts +57 -205
  16. package/dist/module.d.ts +57 -205
  17. package/dist/module.json +2 -2
  18. package/dist/module.mjs +1138 -563
  19. package/dist/runtime/components/CodeFrame.vue +61 -0
  20. package/dist/runtime/components/DevModeOverlay.vue +60 -0
  21. package/dist/runtime/components/ErrorExtensions.vue +23 -0
  22. package/dist/runtime/components/ErrorGroup.vue +89 -0
  23. package/dist/runtime/composables/nuxtApp.d.ts +2 -2
  24. package/dist/runtime/composables/nuxtApp.js +21 -1
  25. package/dist/runtime/composables/useAsyncGraphqlQuery.d.ts +7 -7
  26. package/dist/runtime/composables/useAsyncGraphqlQuery.js +10 -2
  27. package/dist/runtime/composables/useGraphqlMutation.d.ts +4 -4
  28. package/dist/runtime/composables/useGraphqlMutation.js +1 -1
  29. package/dist/runtime/composables/useGraphqlQuery.d.ts +4 -4
  30. package/dist/runtime/composables/useGraphqlQuery.js +1 -1
  31. package/dist/runtime/composables/useGraphqlState.d.ts +1 -1
  32. package/dist/runtime/composables/useGraphqlState.js +1 -1
  33. package/dist/runtime/composables/useGraphqlUploadMutation.d.ts +4 -4
  34. package/dist/runtime/composables/useGraphqlUploadMutation.js +2 -2
  35. package/dist/runtime/css/output.css +1 -0
  36. package/dist/runtime/helpers/composables.d.ts +17 -20
  37. package/dist/runtime/helpers/composables.js +0 -5
  38. package/dist/runtime/plugins/devMode.d.ts +2 -0
  39. package/dist/runtime/plugins/devMode.js +23 -0
  40. package/dist/runtime/plugins/provideState.d.ts +1 -1
  41. package/dist/runtime/{serverHandler → server/api}/debug.js +3 -7
  42. package/dist/runtime/server/api/mutation.js +28 -0
  43. package/dist/runtime/server/api/query.js +29 -0
  44. package/dist/runtime/server/api/upload.d.ts +2 -0
  45. package/dist/runtime/{serverHandler → server/api}/upload.js +13 -11
  46. package/dist/runtime/{serverHandler → server}/helpers/index.d.ts +10 -12
  47. package/dist/runtime/{serverHandler → server}/helpers/index.js +9 -26
  48. package/dist/runtime/server/utils/doGraphqlRequest.d.ts +18 -0
  49. package/dist/runtime/server/utils/doGraphqlRequest.js +67 -0
  50. package/dist/runtime/server/utils/index.d.ts +1 -1
  51. package/dist/runtime/server/utils/index.js +1 -1
  52. package/dist/runtime/server/utils/useGraphqlMutation.d.ts +4 -4
  53. package/dist/runtime/server/utils/useGraphqlQuery.d.ts +4 -4
  54. package/dist/runtime/serverOptions/defineGraphqlServerOptions.d.ts +4 -3
  55. package/dist/runtime/settings/index.d.ts +0 -14
  56. package/dist/runtime/settings/index.js +0 -6
  57. package/dist/runtime/types.d.ts +204 -3
  58. package/dist/types.d.mts +5 -5
  59. package/dist/types.d.ts +5 -5
  60. package/package.json +39 -36
  61. package/dist/runtime/serverHandler/index.js +0 -78
  62. package/dist/runtime/serverHandler/tsconfig.json +0 -3
  63. /package/dist/runtime/{serverHandler → server/api}/debug.d.ts +0 -0
  64. /package/dist/runtime/{serverHandler/index.d.ts → server/api/mutation.d.ts} +0 -0
  65. /package/dist/runtime/{serverHandler/upload.d.ts → server/api/query.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-graphql-middleware",
3
- "version": "5.0.0-alpha.1",
3
+ "version": "5.0.0-alpha.12",
4
4
  "description": "Module to perform GraphQL requests as a server middleware.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,19 +35,18 @@
35
35
  "dist"
36
36
  ],
37
37
  "scripts": {
38
- "prepack": "nuxt-module-build build",
39
- "prepack_": "nuxt-module-build build && npm run client:build",
38
+ "prepack": "npm run styles:build && nuxt-module-build build && npm run client:build",
40
39
  "dev": "nuxi dev playground --trace-warnings",
41
40
  "dev:layers": "nuxi dev playground-layers --trace-warnings",
42
41
  "debug": "nuxi dev playground --inspect",
43
42
  "dev:build": "nuxi build playground",
44
43
  "dev:layers:build": "nuxi build playground-layers",
45
- "dev:prepare": "MODULE_BUILD=true nuxt-module-build build --stub && MODULE_BUILD=true nuxt-module-build prepare && nuxi prepare playground && nuxi prepare playground-layers",
44
+ "dev:prepare": "MODULE_BUILD=true nuxt-module-build build --stub && MODULE_BUILD=true nuxt-module-build prepare && nuxi prepare playground-layers && nuxi prepare playground",
46
45
  "dev:start": "node ./playground/.output/server/index.mjs",
47
46
  "client:build": "nuxi generate client",
48
47
  "client:dev": "nuxi dev client --port 3300",
49
48
  "typedoc": "typedoc --plugin typedoc-plugin-markdown --out foobar",
50
- "typecheck": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
49
+ "typecheck": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit && cd ../playground-layers && vue-tsc --noEmit",
51
50
  "docs:dev": "vitepress dev docs --port 5000",
52
51
  "docs:build": "vitepress build docs",
53
52
  "docs:serve": "vitepress serve docs --port 5000",
@@ -60,45 +59,49 @@
60
59
  "test:ci": "vitest run",
61
60
  "test:coverage": "vitest run --coverage",
62
61
  "prettier": "prettier --check .",
63
- "prettier:fix": "prettier --write ."
62
+ "prettier:fix": "prettier --write .",
63
+ "styles:build": "postcss ./css/index.css -o ./src/runtime/css/output.css",
64
+ "styles:watch": "postcss ./css/index.css -o ./src/runtime/css/output.css --watch"
64
65
  },
65
66
  "dependencies": {
67
+ "@clack/prompts": "^0.10.0",
66
68
  "@graphql-codegen/cli": "^5.0.5",
67
69
  "@graphql-codegen/schema-ast": "^4.1.0",
68
- "@graphql-codegen/typescript": "^4.1.3",
69
- "@graphql-codegen/typescript-generic-sdk": "^4.0.1",
70
- "@graphql-codegen/typescript-operations": "^4.4.1",
71
- "@graphql-tools/utils": "^10.2.2",
72
- "@nuxt/devtools-kit": "1.3.7",
73
- "dependency-graph": "^1.0.0",
74
- "graphql-typescript-deluxe": "^0.0.1",
75
- "inquirer": "^9.3.2",
76
- "minisearch": "^6.3.0",
77
- "picocolors": "^1.0.1"
70
+ "@graphql-tools/utils": "^10.8.6",
71
+ "@nuxt/devtools-kit": "^2.3.1",
72
+ "graphql-typescript-deluxe": "^0.0.11",
73
+ "minisearch": "^7.1.2",
74
+ "picocolors": "^1.1.1"
78
75
  },
79
76
  "devDependencies": {
80
- "@iconify-json/carbon": "^1.1.36",
81
- "@nuxt/devtools": "^1.3.7",
82
- "@nuxt/devtools-ui-kit": "1.3.7",
83
- "@nuxt/eslint": "^0.3.13",
84
- "@nuxt/kit": "^3.15.4",
77
+ "@iconify-json/carbon": "^1.2.8",
78
+ "@nuxt/devtools": "^2.3.1",
79
+ "@nuxt/devtools-ui-kit": "^2.3.1",
80
+ "@nuxt/eslint": "^1.2.0",
81
+ "@nuxt/kit": "^3.16.2",
85
82
  "@nuxt/module-builder": "^0.8.4",
86
- "@nuxt/schema": "^3.15.4",
87
- "@types/capture-console": "^1.0.5",
88
- "@types/cli-table": "^0.3.4",
89
- "@types/inquirer": "^9.0.7",
83
+ "@nuxt/schema": "^3.16.2",
84
+ "@types/micromatch": "^4.0.9",
90
85
  "cypress": "^13.12.0",
91
- "eslint": "^8.57.0",
92
- "eslint-config-prettier": "^9.1.0",
93
- "eslint-plugin-prettier": "^5.1.3",
94
- "jsdoc-to-markdown": "^8.0.1",
95
- "nuxt": "^3.15.4",
96
- "prettier": "^3.3.2",
97
- "strip-ansi": "^7.1.0",
98
- "typedoc": "^0.26.3",
99
- "typedoc-plugin-markdown": "^4.1.1",
100
- "vitepress": "^1.5.0",
86
+ "eslint": "^9.23.0",
87
+ "eslint-config-prettier": "^10.1.1",
88
+ "eslint-plugin-prettier": "^5.2.3",
89
+ "mermaid": "^11.5.0",
90
+ "nuxt": "^3.16.2",
91
+ "postcss": "^8.5.3",
92
+ "postcss-cli": "^11.0.1",
93
+ "postcss-import": "^16.1.0",
94
+ "postcss-nested-import": "^1.3.0",
95
+ "postcss-replace": "^2.0.1",
96
+ "postcss-url": "^10.1.3",
97
+ "prettier": "^3.5.3",
98
+ "tailwindcss": "^3.4.17",
99
+ "tailwindcss-scoped-preflight": "^3.4.10",
100
+ "typedoc": "^0.28.1",
101
+ "typedoc-plugin-markdown": "^4.5.2",
102
+ "vitepress": "^1.6.3",
103
+ "vitepress-plugin-mermaid": "^2.0.17",
101
104
  "vitest": "^1.6.0",
102
- "vue-tsc": "^2.1.6"
105
+ "vue-tsc": "^2.2.8"
103
106
  }
104
107
  }
@@ -1,78 +0,0 @@
1
- import { defineEventHandler, getQuery, readBody } from "h3";
2
- import {
3
- queryParamToVariables,
4
- getEndpoint,
5
- getFetchOptions,
6
- validateRequest,
7
- onServerResponse,
8
- onServerError,
9
- extractRequestContext
10
- } from "./helpers/index.js";
11
- import { GraphqlMiddlewareOperation } from "./../settings/index.js";
12
- import { operations } from "#graphql-documents";
13
- import { serverOptions } from "#graphql-middleware-server-options-build";
14
- import { useRuntimeConfig } from "#imports";
15
- export default defineEventHandler(async (event) => {
16
- const method = event.method;
17
- const operation = event.context?.params?.operation;
18
- const operationName = event.context?.params?.name;
19
- validateRequest(method, operation, operationName, operations);
20
- const operationDocument = operations[operation][operationName];
21
- const queryParams = getQuery(event);
22
- const context = extractRequestContext(queryParams);
23
- const variables = operation === GraphqlMiddlewareOperation.Query ? queryParamToVariables(queryParams) : await readBody(event);
24
- if (serverOptions.doGraphqlRequest) {
25
- return serverOptions.doGraphqlRequest({
26
- event,
27
- operation,
28
- operationName,
29
- operationDocument,
30
- variables,
31
- context
32
- });
33
- }
34
- const runtimeConfig = useRuntimeConfig().graphqlMiddleware;
35
- const endpoint = await getEndpoint(
36
- runtimeConfig,
37
- serverOptions,
38
- event,
39
- operation,
40
- operationName,
41
- context
42
- );
43
- const fetchOptions = await getFetchOptions(
44
- serverOptions,
45
- event,
46
- operation,
47
- operationName,
48
- context
49
- );
50
- return $fetch.raw(endpoint, {
51
- // @todo: Remove any once https://github.com/unjs/nitro/pull/883 is released.
52
- method: "POST",
53
- body: {
54
- query: operationDocument,
55
- variables,
56
- operationName
57
- },
58
- ...fetchOptions
59
- }).then((response) => {
60
- return onServerResponse(
61
- serverOptions,
62
- event,
63
- response,
64
- operation,
65
- operationName,
66
- context
67
- );
68
- }).catch((error) => {
69
- return onServerError(
70
- serverOptions,
71
- event,
72
- error,
73
- operation,
74
- operationName,
75
- context
76
- );
77
- });
78
- });
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "../../../.nuxt/tsconfig.server.json"
3
- }