@lewebsimple/nuxt-graphql 0.5.7 → 0.5.9

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/README.md CHANGED
@@ -93,7 +93,7 @@ export default defineNuxtConfig({
93
93
 
94
94
  ### Define schema(s) (local and/or remote)
95
95
 
96
- **Local schemas** must live under `server/` and export a `GraphQLSchema` as `schema`. You can use the auto-imported `defineGraphQLSchema` helper for type-safety.
96
+ **Local schemas** must live under `server/` and export a `GraphQLSchema` as `schema`.
97
97
 
98
98
  For the example configuration above, create [server/graphql/schema.ts](server/graphql/schema.ts):
99
99
 
@@ -101,7 +101,7 @@ For the example configuration above, create [server/graphql/schema.ts](server/gr
101
101
  import { createSchema } from "graphql-yoga";
102
102
  import type { GraphQLContext } from "#graphql/context";
103
103
 
104
- const schema = createSchema<GraphQLContext>({
104
+ export const schema = createSchema<GraphQLContext>({
105
105
  typeDefs: /* GraphQL */ `
106
106
  type Query {
107
107
  hello: String!
@@ -132,8 +132,6 @@ const schema = createSchema<GraphQLContext>({
132
132
  },
133
133
  },
134
134
  });
135
-
136
- export default defineGraphQLSchema({ schema });
137
135
  ```
138
136
 
139
137
  **Remote schemas** are introspected at build time from the required endpoint URL and executed via an HTTP executor at runtime. Subscriptions are stripped from remote schemas.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-graphql",
3
3
  "configKey": "graphql",
4
- "version": "0.5.7",
4
+ "version": "0.5.9",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -18,7 +18,7 @@ const cyan = "\x1B[36m";
18
18
  const reset = "\x1B[0m";
19
19
 
20
20
  function renderContextTemplate({ contextModules }) {
21
- const contextImports = contextModules.map((contextModule, index) => `import { createContext as createContext${index} } from '${contextModule}';`);
21
+ const contextImports = contextModules.map((contextModule, index) => `import createContext${index} from '${contextModule}';`);
22
22
  const contexts = contextModules.map((_, index) => `createContext${index}(event)`);
23
23
  return `
24
24
  ${contextImports.join("\n")}
@@ -1,7 +1,4 @@
1
1
  /**
2
- * Export the default schema definition wrapper.
2
+ * Default hello-world schema for development scaffolding.
3
3
  */
4
- declare const _default: {
5
- schema: import("graphql").GraphQLSchema | import("@graphql-tools/delegate").SubschemaConfig<any, any, any, Record<string, any>>;
6
- };
7
- export default _default;
4
+ export declare const schema: import("graphql-yoga").GraphQLSchemaWithContext<import("graphql-yoga").YogaInitialContext>;
@@ -1,6 +1,5 @@
1
1
  import { createSchema } from "graphql-yoga";
2
- import { defineGraphQLSchema } from "../utils/defineGraphQLSchema.js";
3
- const schema = createSchema({
2
+ export const schema = createSchema({
4
3
  typeDefs: (
5
4
  /* GraphQL */
6
5
  `
@@ -15,4 +14,3 @@ const schema = createSchema({
15
14
  }
16
15
  }
17
16
  });
18
- export default defineGraphQLSchema({ schema });
@@ -1,12 +1,6 @@
1
1
  import type { H3Event } from "h3";
2
- type GraphQLContextFactory<TContext extends Record<string, unknown>> = (event: H3Event) => TContext | Promise<TContext>;
2
+ export type GraphQLContextFactory<TContext extends Record<string, unknown>> = (event: H3Event) => TContext | Promise<TContext>;
3
3
  /**
4
4
  * Define a GraphQL context factory with proper typing.
5
- *
6
- * @param createContext Context factory function.
7
- * @returns The same factory, typed for inference.
8
5
  */
9
- export declare function defineGraphQLContext<TContext extends Record<string, unknown>>(createContext: GraphQLContextFactory<TContext>): {
10
- createContext: GraphQLContextFactory<TContext>;
11
- };
12
- export {};
6
+ export declare function defineGraphQLContext<TContext extends Record<string, unknown>>(createContext: GraphQLContextFactory<TContext>): GraphQLContextFactory<TContext>;
@@ -1,3 +1,3 @@
1
1
  export function defineGraphQLContext(createContext) {
2
- return { createContext };
2
+ return createContext;
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lewebsimple/nuxt-graphql",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "description": "Opinionated Nuxt module for using GraphQL",
5
5
  "repository": "lewebsimple/nuxt-graphql",
6
6
  "license": "AGPL-3.0-only",
@@ -1,14 +0,0 @@
1
- import type { GraphQLSchema } from "graphql";
2
- import type { SubschemaConfig } from "@graphql-tools/delegate";
3
- /**
4
- * Wrap a GraphQL schema or subschema config for module consumption.
5
- *
6
- * @param {{ schema: GraphQLSchema | SubschemaConfig }} options Schema wrapper input.
7
- * @param options.schema Local schema or subschema config.
8
- * @returns Wrapper object containing the schema.
9
- */
10
- export declare function defineGraphQLSchema({ schema }: {
11
- schema: GraphQLSchema | SubschemaConfig;
12
- }): {
13
- schema: GraphQLSchema | SubschemaConfig<any, any, any, Record<string, any>>;
14
- };
@@ -1,3 +0,0 @@
1
- export function defineGraphQLSchema({ schema }) {
2
- return { schema };
3
- }