nitro-graphql 0.0.18 → 0.0.22

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.
@@ -1,7 +1,7 @@
1
- import * as _nuxt_schema5 from "@nuxt/schema";
1
+ import * as _nuxt_schema2 from "@nuxt/schema";
2
2
 
3
3
  //#region src/ecosystem/nuxt.d.ts
4
4
  interface ModuleOptions {}
5
- declare const _default: _nuxt_schema5.NuxtModule<ModuleOptions, ModuleOptions, false>;
5
+ declare const _default: _nuxt_schema2.NuxtModule<ModuleOptions, ModuleOptions, false>;
6
6
  //#endregion
7
7
  export { ModuleOptions, _default as default };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { StandardSchemaV1 } from "./types/standard-schema.js";
2
2
  import { CodegenClientConfig, CodegenServerConfig, GenImport, NitroGraphQLOptions } from "./types/index.js";
3
- import * as nitropack4 from "nitropack";
3
+ import * as nitropack3 from "nitropack";
4
4
 
5
5
  //#region src/index.d.ts
6
6
  type GraphQLFramework = 'graphql-yoga';
7
- declare const _default: nitropack4.NitroModule;
7
+ declare const _default: nitropack3.NitroModule;
8
8
  //#endregion
9
9
  export { CodegenClientConfig, CodegenServerConfig, GenImport, GraphQLFramework, NitroGraphQLOptions, StandardSchemaV1, _default as default };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { relativeWithDot, scanDefs, scanResolvers } from "./utils/index.js";
2
2
  import { clientTypeGeneration, serverTypeGeneration } from "./utils/server-type-generation.js";
3
3
  import { rollupConfig } from "./rollup.js";
4
- import { writeFileSync } from "node:fs";
4
+ import { existsSync, writeFileSync } from "node:fs";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { watch } from "chokidar";
7
7
  import consola from "consola";
@@ -153,6 +153,28 @@ declare module 'nitro-graphql' {
153
153
  types.tsConfig.include = types.tsConfig.include || [];
154
154
  types.tsConfig.include.push(relativeWithDot(tsconfigDir, join(typesDir, "nitro-graphql-server.d.ts")), relativeWithDot(tsconfigDir, join(typesDir, "nitro-graphql-client.d.ts")), relativeWithDot(tsconfigDir, join(typesDir, "graphql.d.ts")));
155
155
  });
156
+ if (!existsSync(join(nitro.options.rootDir, "graphql.config.ts"))) {
157
+ const schemaPath = relativeWithDot(nitro.options.rootDir, resolve(nitro.graphql.buildDir, "schema.graphql"));
158
+ const documentsPath = relativeWithDot(nitro.options.rootDir, resolve(nitro.graphql.clientDir, "**/*.{graphql,js,ts,jsx,tsx}"));
159
+ writeFileSync(join(nitro.options.rootDir, "graphql.config.ts"), `
160
+ import type { IGraphQLConfig } from 'graphql-config'
161
+
162
+ export function createGraphQLConfig(config?: IGraphQLConfig): IGraphQLConfig {
163
+ const newConfig: IGraphQLConfig = {
164
+ projects: {
165
+ default: {
166
+ schema: [
167
+ '${schemaPath}',
168
+ ],
169
+ documents: [
170
+ '${documentsPath}',
171
+ ],
172
+ },
173
+ },
174
+ }
175
+ return newConfig;
176
+ }`, "utf-8");
177
+ }
156
178
  }
157
179
  });
158
180
 
@@ -1,6 +1,6 @@
1
- import * as h36 from "h3";
1
+ import * as h30 from "h3";
2
2
 
3
3
  //#region src/routes/apollo-server.d.ts
4
- declare const _default: h36.EventHandler<h36.EventHandlerRequest, any>;
4
+ declare const _default: h30.EventHandler<h30.EventHandlerRequest, any>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,6 +1,6 @@
1
- import * as h32 from "h3";
1
+ import * as h34 from "h3";
2
2
 
3
3
  //#region src/routes/graphql-yoga.d.ts
4
- declare const _default: h32.EventHandler<h32.EventHandlerRequest, Promise<Response>>;
4
+ declare const _default: h34.EventHandler<h34.EventHandlerRequest, Promise<Response>>;
5
5
  //#endregion
6
6
  export { _default as default };
@@ -1,7 +1,7 @@
1
- import * as h30 from "h3";
1
+ import * as h36 from "h3";
2
2
 
3
3
  //#region src/routes/health.d.ts
4
- declare const _default: h30.EventHandler<h30.EventHandlerRequest, Promise<{
4
+ declare const _default: h36.EventHandler<h36.EventHandlerRequest, Promise<{
5
5
  status: string;
6
6
  message: string;
7
7
  timestamp: string;
@@ -5,7 +5,6 @@ import { printSchemaWithDirectives } from "@graphql-tools/utils";
5
5
  import { codegen } from "@graphql-codegen/core";
6
6
  import * as typescriptPlugin from "@graphql-codegen/typescript";
7
7
  import * as typescriptResolversPlugin from "@graphql-codegen/typescript-resolvers";
8
- import { CurrencyResolver, DateTimeResolver, JSONResolver, NonEmptyStringResolver, UUIDResolver } from "graphql-scalars";
9
8
 
10
9
  //#region src/utils/server-codegen.ts
11
10
  function pluginContent(_schema, _documents, _config, _info) {
@@ -23,17 +22,6 @@ function pluginContent(_schema, _documents, _config, _info) {
23
22
  async function generateTypes(schema, config = {}, outputPath) {
24
23
  const defaultConfig = {
25
24
  scalars: {
26
- Boolean: {
27
- input: "boolean",
28
- output: "boolean"
29
- },
30
- DateTime: DateTimeResolver.extensions.codegenScalarType,
31
- DateTimeISO: DateTimeResolver.extensions.codegenScalarType,
32
- UUID: UUIDResolver.extensions.codegenScalarType,
33
- JSON: JSONResolver.extensions.codegenScalarType,
34
- JSONObject: JSONResolver.extensions.codegenScalarType,
35
- NonEmptyString: NonEmptyStringResolver.extensions.codegenScalarType,
36
- Currency: CurrencyResolver.extensions.codegenScalarType,
37
25
  File: {
38
26
  input: "File",
39
27
  output: "File"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nitro-graphql",
3
3
  "type": "module",
4
- "version": "0.0.18",
4
+ "version": "0.0.22",
5
5
  "description": "GraphQL integration for Nitro",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
@@ -75,6 +75,7 @@
75
75
  "chokidar": "^4.0.3",
76
76
  "consola": "^3.4.2",
77
77
  "defu": "^6.1.4",
78
+ "graphql-config": "^5.1.5",
78
79
  "graphql-scalars": "^1.24.2",
79
80
  "knitwork": "^1.2.0",
80
81
  "ohash": "^2.0.11",