Skip to content

Commit

Permalink
chore(nuxt): disable schema check
Browse files Browse the repository at this point in the history
  • Loading branch information
Teages committed Aug 14, 2024
1 parent fb02d54 commit fd7c8bc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
22 changes: 11 additions & 11 deletions packages/nuxt/src/runtime/composables/schema.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { useSchema } from '@gqfn/core'
import type { DollarEnum, Endpoints, ExactEndpoints, LoadGQFn, LoadGQP } from '../internal/utils/schema'
import type { UseGQFnSchema, UseGQFnSchemaWithWarning } from '../internal/types/composables/schema'
import type { ModuleRuntimeConfig } from '../../module'
import { useRuntimeConfig } from '#imports'
// import type { ModuleRuntimeConfig } from '../../module'
// import { useRuntimeConfig } from '#imports'

export function useGQFnSchema(): UseGQFnSchema<string>
export function useGQFnSchema<T extends ExactEndpoints>(endpoint: T): UseGQFnSchema<T>
export function useGQFnSchema(endpoint: string): UseGQFnSchemaWithWarning
export function useGQFnSchema<T extends Endpoints>(endpoint?: T): UseGQFnSchema<T> {
if (import.meta.dev && endpoint) {
// Check if the schema is defined in the config
(async () => {
const { clientList } = (useRuntimeConfig() as unknown as ModuleRuntimeConfig).public.gqfn
if (clientList && !clientList.includes(endpoint)) {
console.warn(`useGQFnSchema: "${endpoint}" is not typed, please add it to gqfn.clients in your nuxt config`)
}
})()
}
// if (import.meta.dev && endpoint) {
// // Check if the schema is defined in the config
// (async () => {
// const { clientList } = (useRuntimeConfig() as unknown as ModuleRuntimeConfig).public.gqfn
// if (clientList && !clientList.includes(endpoint)) {
// console.warn(`useGQFnSchema: "${endpoint}" is not typed, please add it to gqfn.clients in your nuxt config`)
// }
// })()
// }

const schema = useSchema(endpoint) as {
gqfn: LoadGQFn<T>
Expand Down
22 changes: 11 additions & 11 deletions packages/nuxt/src/runtime/server/utils/schema.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { $enum } from '@gqfn/core'
import { useSchema } from '@gqfn/core'
import type { DollarEnum, Endpoints, ExactEndpoints, LoadGQFn, LoadGQP } from '../../internal/utils/schema'
import type { ModuleRuntimeConfig } from '../../../module'
import { useRuntimeConfig } from '#build/types/nitro-imports'
// import type { ModuleRuntimeConfig } from '../../../module'
// import { useRuntimeConfig } from '#build/types/nitro-imports'

export interface ServerUseSchema<
TEndpoint extends Endpoints,
Expand Down Expand Up @@ -33,15 +33,15 @@ export function useGQFnSchema<T extends ExactEndpoints>(endpoint: T): ServerUseS
*/
export function useGQFnSchema(endpoint: string): ServerUseSchemaWithWarning
export function useGQFnSchema<T extends Endpoints>(endpoint?: T): ServerUseSchema<T> {
if (import.meta.dev && endpoint) {
// Check if the schema is defined in the config
(async () => {
const { clientList } = (useRuntimeConfig() as unknown as ModuleRuntimeConfig).public.gqfn
if (clientList && !clientList.includes(endpoint)) {
console.warn(`useGQFnSchema: "${endpoint}" is not typed, please add it to gqfn.clients in your nuxt config`)
}
})()
}
// if (import.meta.dev && endpoint) {
// // Check if the schema is defined in the config
// (async () => {
// const { clientList } = (useRuntimeConfig() as unknown as ModuleRuntimeConfig).public.gqfn
// if (clientList && !clientList.includes(endpoint)) {
// console.warn(`useGQFnSchema: "${endpoint}" is not typed, please add it to gqfn.clients in your nuxt config`)
// }
// })()
// }

const schema = useSchema(endpoint) as {
gqfn: LoadGQFn<T>
Expand Down

0 comments on commit fd7c8bc

Please sign in to comment.