nuxt-graphql-middleware 5.0.0-alpha.0 → 5.0.0-alpha.10
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/client/200.html +11 -0
- package/dist/client/404.html +11 -0
- package/dist/client/_nuxt/BLvMh1Ga.js +1 -0
- package/dist/client/_nuxt/C9pb_2rp.js +2 -0
- package/dist/client/_nuxt/CBwfSTyQ.js +1 -0
- package/dist/client/_nuxt/CPyoLiCY.js +1 -0
- package/dist/client/_nuxt/VpkRx2_e.js +25 -0
- package/dist/client/_nuxt/builds/latest.json +1 -0
- package/dist/client/_nuxt/builds/meta/074548b5-7348-4637-940b-ab6e87b521a5.json +1 -0
- package/dist/client/_nuxt/entry.Cn9qfNGa.css +1 -0
- package/dist/client/_nuxt/error-404.BJkSn6RI.css +1 -0
- package/dist/client/_nuxt/error-500.TOCKLquH.css +1 -0
- package/dist/client/_nuxt/index.DGEN-H8t.css +1 -0
- package/dist/client/index.html +11 -0
- package/dist/module.d.mts +57 -205
- package/dist/module.d.ts +57 -205
- package/dist/module.json +2 -2
- package/dist/module.mjs +1132 -565
- package/dist/runtime/components/CodeFrame.vue +61 -0
- package/dist/runtime/components/DevModeOverlay.vue +60 -0
- package/dist/runtime/components/ErrorExtensions.vue +23 -0
- package/dist/runtime/components/ErrorGroup.vue +89 -0
- package/dist/runtime/composables/nuxtApp.d.ts +2 -2
- package/dist/runtime/composables/nuxtApp.js +21 -1
- package/dist/runtime/composables/useAsyncGraphqlQuery.d.ts +7 -7
- package/dist/runtime/composables/useAsyncGraphqlQuery.js +10 -2
- package/dist/runtime/composables/useGraphqlMutation.d.ts +4 -4
- package/dist/runtime/composables/useGraphqlMutation.js +1 -1
- package/dist/runtime/composables/useGraphqlQuery.d.ts +4 -4
- package/dist/runtime/composables/useGraphqlQuery.js +1 -1
- package/dist/runtime/composables/useGraphqlState.d.ts +1 -1
- package/dist/runtime/composables/useGraphqlState.js +1 -1
- package/dist/runtime/composables/useGraphqlUploadMutation.d.ts +4 -4
- package/dist/runtime/composables/useGraphqlUploadMutation.js +2 -2
- package/dist/runtime/css/output.css +1 -0
- package/dist/runtime/helpers/composables.d.ts +17 -20
- package/dist/runtime/helpers/composables.js +0 -5
- package/dist/runtime/plugins/devMode.d.ts +2 -0
- package/dist/runtime/plugins/devMode.js +23 -0
- package/dist/runtime/plugins/provideState.d.ts +1 -1
- package/dist/runtime/{serverHandler → server/api}/debug.js +3 -7
- package/dist/runtime/server/api/mutation.js +28 -0
- package/dist/runtime/server/api/query.js +29 -0
- package/dist/runtime/server/api/upload.d.ts +2 -0
- package/dist/runtime/{serverHandler → server/api}/upload.js +13 -11
- package/dist/runtime/{serverHandler → server}/helpers/index.d.ts +10 -12
- package/dist/runtime/{serverHandler → server}/helpers/index.js +9 -26
- package/dist/runtime/server/utils/doGraphqlRequest.d.ts +18 -0
- package/dist/runtime/server/utils/doGraphqlRequest.js +67 -0
- package/dist/runtime/server/utils/index.d.ts +1 -1
- package/dist/runtime/server/utils/index.js +1 -1
- package/dist/runtime/server/utils/useGraphqlMutation.d.ts +4 -4
- package/dist/runtime/server/utils/useGraphqlQuery.d.ts +4 -4
- package/dist/runtime/serverOptions/defineGraphqlServerOptions.d.ts +4 -3
- package/dist/runtime/settings/index.d.ts +0 -14
- package/dist/runtime/settings/index.js +0 -6
- package/dist/runtime/types.d.ts +204 -3
- package/dist/types.d.mts +5 -5
- package/dist/types.d.ts +5 -5
- package/package.json +39 -36
- package/dist/runtime/serverHandler/index.js +0 -78
- package/dist/runtime/serverHandler/tsconfig.json +0 -3
- /package/dist/runtime/{serverHandler → server/api}/debug.d.ts +0 -0
- /package/dist/runtime/{serverHandler/index.d.ts → server/api/mutation.d.ts} +0 -0
- /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.
|
|
3
|
+
"version": "5.0.0-alpha.10",
|
|
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
|
|
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-
|
|
69
|
-
"@
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
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.8",
|
|
73
|
+
"minisearch": "^7.1.2",
|
|
74
|
+
"picocolors": "^1.1.1"
|
|
78
75
|
},
|
|
79
76
|
"devDependencies": {
|
|
80
|
-
"@iconify-json/carbon": "^1.
|
|
81
|
-
"@nuxt/devtools": "^
|
|
82
|
-
"@nuxt/devtools-ui-kit": "
|
|
83
|
-
"@nuxt/eslint": "^
|
|
84
|
-
"@nuxt/kit": "^3.
|
|
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.1",
|
|
85
82
|
"@nuxt/module-builder": "^0.8.4",
|
|
86
|
-
"@nuxt/schema": "^3.
|
|
87
|
-
"@types/
|
|
88
|
-
"@types/cli-table": "^0.3.4",
|
|
89
|
-
"@types/inquirer": "^9.0.7",
|
|
83
|
+
"@nuxt/schema": "^3.16.1",
|
|
84
|
+
"@types/micromatch": "^4.0.9",
|
|
90
85
|
"cypress": "^13.12.0",
|
|
91
|
-
"eslint": "^
|
|
92
|
-
"eslint-config-prettier": "^
|
|
93
|
-
"eslint-plugin-prettier": "^5.
|
|
94
|
-
"
|
|
95
|
-
"nuxt": "^3.
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
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.1",
|
|
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.
|
|
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
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|