@okam/directus-query 0.0.1 → 1.1.0

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/.eslintrc.js ADDED
@@ -0,0 +1,21 @@
1
+ const { getDefaultIgnorePatterns } = require("../../../linter/helpers");
2
+
3
+ module.exports = {
4
+ extends: ['plugin:@nx/react', '../../../.eslintrc.js', '../../../linter/bases/typescript', '../../../linter/bases/regexp', '../../../linter/bases/jest', '../../../linter/bases/rtl', '../../../linter/bases/storybook', '../../../linter/bases/react', '../../../linter/bases/prettier', 'plugin:storybook/recommended'],
5
+ ignorePatterns: ['!**/*', ...getDefaultIgnorePatterns()],
6
+ overrides: [
7
+ {
8
+ files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
9
+ // We set parserOptions.project for the project to allow TypeScript to create the type-checker behind the scenes when we run linting
10
+ parserOptions: {
11
+ project: `${__dirname}/tsconfig.*?.json`,
12
+ },
13
+ rules: {
14
+ "@nx/dependency-checks": "error"
15
+ }
16
+ },
17
+ ],
18
+ rules: {
19
+ 'react/react-in-jsx-scope': 'off',
20
+ },
21
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ ## 1.1.0 (2024-06-28)
2
+
3
+
4
+ ### 🚀 Features
5
+
6
+ - add new libs ([#71](https://github.com/OKAMca/stack/pull/71))
7
+
8
+ - add gql query ([#73](https://github.com/OKAMca/stack/pull/73))
9
+
10
+
11
+ ### 🩹 Fixes
12
+
13
+ - publishing for new libs ([#125](https://github.com/OKAMca/stack/pull/125))
14
+
15
+ - **directus-query:** fix initDirectusQuery name ([#129](https://github.com/OKAMca/stack/pull/129))
16
+
17
+
18
+ ### ❤️ Thank You
19
+
20
+ - Marie-Maxime Tanguay @marie-maxime
21
+ - yanmorinokamca @yanmorinokamca
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # directus-query
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ # Usage with NextJS AppRouter
6
+
7
+ To create a new client, first create a new file with the following content:
8
+
9
+ ```ts
10
+ import { initDirectusQuery } from '@okam/directus-query'
11
+
12
+ const queryClient = initDirectusQuery('https://example.com/api', {
13
+ credentials: 'include',
14
+ mode: 'cors',
15
+ fetch,ù
16
+ headers: {
17
+ Authorization: `Bearer ${process.env.AUTH_TOKEN}`,
18
+ },
19
+ })
20
+
21
+ export default queryClient
22
+ ```
23
+
24
+ Then, you can use the client to query data from Directus:
25
+
26
+ ```ts
27
+ const variables = {id: 1}
28
+ const data = await queryClient.queryGql(DOCUMENT, variables)
29
+ ```
30
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okam/directus-query",
3
- "version": "0.0.1",
3
+ "version": "1.1.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
package/project.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "directus-query",
3
+ "$schema": "../../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "libs/directus/directus-query/src",
5
+ "projectType": "library",
6
+ "tags": [],
7
+ "targets": {
8
+ "lint": {
9
+ "executor": "@nx/linter:eslint",
10
+ "outputs": ["{options.outputFile}"],
11
+ "options": {
12
+ "lintFilePatterns": ["libs/directus/directus-query/**/*.{ts,tsx,js,jsx}"]
13
+ }
14
+ },
15
+ "build": {
16
+ "executor": "@nx/vite:build",
17
+ "outputs": ["{options.outputPath}"],
18
+ "defaultConfiguration": "production",
19
+ "options": {
20
+ "outputPath": "dist/libs/directus/directus-query"
21
+ },
22
+ "configurations": {
23
+ "development": {
24
+ "mode": "development"
25
+ },
26
+ "production": {
27
+ "mode": "production"
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './lib/hooks'
2
+ export * from './lib/query'
3
+ export { default as initDirectusQuery } from './lib/init'
@@ -0,0 +1,14 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ import type { RequestConfig } from 'graphql-request/build/esm/types'
3
+
4
+ export const GRAPHQL_ENDPOINT = process.env.NEXT_PUBLIC_GRAPHQL_URL as string
5
+ export const AUTH_TOKEN = process.env.NEXT_PUBLIC_API_TOKEN as string
6
+
7
+ export const defaultConfig = {
8
+ credentials: 'include',
9
+ mode: 'cors',
10
+ fetch,
11
+ headers: {
12
+ Authorization: `Bearer ${AUTH_TOKEN}`,
13
+ },
14
+ } as RequestConfig
@@ -0,0 +1,2 @@
1
+ export * from './use-graphql'
2
+ export * from './use-suspense-graphql'
@@ -0,0 +1,24 @@
1
+ 'use client'
2
+
3
+ import { type TypedDocumentNode } from '@graphql-typed-document-node/core'
4
+ import { useQuery } from '@tanstack/react-query'
5
+ import type { QueryOptions, UseQueryResult } from '@tanstack/react-query'
6
+ import type { GraphQLClient, Variables } from 'graphql-request'
7
+ import { getQueryValues, queryGql } from '../query'
8
+
9
+ export function useGqlQuery<TResult, TVariables extends Variables>(
10
+ document: TypedDocumentNode<TResult, TVariables>,
11
+ variables?: TVariables,
12
+ options?: QueryOptions & { enabled: boolean; useErrorBoundary: boolean },
13
+ client?: GraphQLClient,
14
+ ): UseQueryResult<TResult> {
15
+ const values = getQueryValues<TResult, TVariables>(document, variables)
16
+
17
+ return useQuery({
18
+ queryKey: values,
19
+ queryFn: async ({ queryKey }) => queryGql(document, queryKey[1] as TVariables, client),
20
+ ...options,
21
+ })
22
+ }
23
+
24
+ export default useGqlQuery
@@ -0,0 +1,35 @@
1
+ 'use client'
2
+
3
+ import { type TypedDocumentNode } from '@graphql-typed-document-node/core'
4
+ import { useSuspenseQuery } from '@tanstack/react-query'
5
+ import type { QueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query'
6
+ import type { Variables } from 'graphql-request'
7
+ import { getQueryValues, queryGql } from '../query'
8
+ import { graphqlRequestAdmin } from '../request'
9
+
10
+ export function useSuspenseGqlQuery<TResult, TVariables extends Variables>(
11
+ document: TypedDocumentNode<TResult, TVariables>,
12
+ variables?: TVariables,
13
+ options?: QueryOptions & { enabled: boolean; useErrorBoundary: boolean },
14
+ ): UseSuspenseQueryResult<TResult> {
15
+ const values = getQueryValues<TResult, TVariables>(document, variables)
16
+
17
+ return useSuspenseQuery({
18
+ queryKey: values,
19
+ queryFn: async ({ queryKey }) => queryGql(document, queryKey[1] as TVariables),
20
+ ...options,
21
+ })
22
+ }
23
+
24
+ export function useSuspenseGqlQueryAdmin<TResult, TVariables extends Variables>(
25
+ document: TypedDocumentNode<TResult, TVariables>,
26
+ variables?: TVariables,
27
+ options?: QueryOptions,
28
+ ): UseSuspenseQueryResult<TResult> {
29
+ const values = getQueryValues<TResult, TVariables>(document, variables)
30
+ return useSuspenseQuery({
31
+ queryKey: values,
32
+ queryFn: async ({ queryKey }) => queryGql(document, queryKey[1] as TVariables, graphqlRequestAdmin),
33
+ ...options,
34
+ })
35
+ }
@@ -0,0 +1,24 @@
1
+ import { type TypedDocumentNode } from '@graphql-typed-document-node/core'
2
+ import { GraphQLClient } from 'graphql-request'
3
+ import type { Variables } from 'graphql-request'
4
+ import type { RequestConfig } from 'graphql-request/build/esm/types'
5
+ import { GRAPHQL_ENDPOINT, defaultConfig } from './config'
6
+ import { queryGql } from './query'
7
+
8
+ const initDirectusQuery = (graphqlEndPoint = GRAPHQL_ENDPOINT, requestConfig: RequestConfig = defaultConfig) => {
9
+ const client = new GraphQLClient(graphqlEndPoint, requestConfig)
10
+
11
+ function internalQueryGql<TResult, TVariables extends Variables>(
12
+ document: TypedDocumentNode<TResult, TVariables>,
13
+ queryKey?: TVariables,
14
+ ) {
15
+ return queryGql(document, queryKey, client)
16
+ }
17
+
18
+ return {
19
+ queryGql: internalQueryGql,
20
+ client,
21
+ }
22
+ }
23
+
24
+ export default initDirectusQuery
@@ -0,0 +1,30 @@
1
+ 'use client'
2
+
3
+ import { type TypedDocumentNode } from '@graphql-typed-document-node/core'
4
+ import { createCtx } from '@okam/core-lib'
5
+ import type { QueryOptions } from '@tanstack/react-query'
6
+ import type { Variables } from 'graphql-request'
7
+ import { useCallback, useMemo } from 'react'
8
+ import { useGqlQuery } from '../hooks'
9
+ import type { TGQLQueryContextProps, TGQLQueryProviderProps } from './interface'
10
+
11
+ const [useGql, GqlProvider] = createCtx<TGQLQueryContextProps>()
12
+
13
+ export { useGql }
14
+
15
+ export function GqlQueryContextProvider({ children, client }: Readonly<TGQLQueryProviderProps>) {
16
+ const gqlFn = useCallback(
17
+ function useInternalGqlQuery<TResult, TVariables extends Variables>(
18
+ document: TypedDocumentNode<TResult, TVariables>,
19
+ variables?: TVariables,
20
+ options?: QueryOptions & { enabled: boolean; useErrorBoundary: boolean },
21
+ ) {
22
+ return useGqlQuery<TResult, TVariables>(document, variables, options, client)
23
+ },
24
+ [client],
25
+ )
26
+
27
+ const value = useMemo<TGQLQueryContextProps>(() => ({ useGqlQuery: gqlFn }), [gqlFn])
28
+
29
+ return <GqlProvider value={value}>{children}</GqlProvider>
30
+ }
@@ -0,0 +1,16 @@
1
+ import { type TypedDocumentNode } from '@graphql-typed-document-node/core'
2
+ import type { UseQueryResult } from '@tanstack/react-query'
3
+ import type { GraphQLClient, Variables } from 'graphql-request'
4
+ import type React from 'react'
5
+
6
+ export type TGQLQueryProviderProps = {
7
+ children: React.ReactNode
8
+ client: GraphQLClient
9
+ }
10
+
11
+ export type TGQLQueryContextProps = {
12
+ useGqlQuery: <TResult, TVariables extends Variables>(
13
+ document: TypedDocumentNode<TResult, TVariables>,
14
+ queryKey?: TVariables,
15
+ ) => UseQueryResult
16
+ }
@@ -0,0 +1,22 @@
1
+ import { type TypedDocumentNode } from '@graphql-typed-document-node/core'
2
+ import type { Variables } from 'graphql-request'
3
+ import { get } from 'radash'
4
+ import graphqlRequestClient from './request'
5
+
6
+ export function queryGql<TResult, TVariables extends Variables>(
7
+ document: TypedDocumentNode<TResult, TVariables>,
8
+ queryKey?: TVariables,
9
+ client = graphqlRequestClient,
10
+ ) {
11
+ return client.request<TResult>(document, {
12
+ ...queryKey,
13
+ })
14
+ }
15
+
16
+ export function getQueryValues<TResult, TVariables extends Variables>(
17
+ document: TypedDocumentNode<TResult, TVariables>,
18
+ variables?: TVariables,
19
+ ) {
20
+ const value = get<string>(document, 'definitions.0.name.value')
21
+ return [value, variables] as const
22
+ }
@@ -0,0 +1,42 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ /* eslint-disable no-console */
3
+ import { QueryCache, QueryClient } from '@tanstack/react-query'
4
+ import { GraphQLClient } from 'graphql-request'
5
+
6
+ const GRAPHQL_ENDPOINT = process.env.NEXT_PUBLIC_GRAPHQL_URL as string
7
+ const GRAPHQL_ENDPOINT_ADMIN = process.env.NEXT_GRAPHQL_URL_ADMIN as string
8
+ const AUTH_TOKEN = process.env.NEXT_PUBLIC_API_TOKEN as string
9
+ const AUTH_TOKEN_ADMIN = process.env.NEXT_PUBLIC_API_TOKEN as string
10
+
11
+ export const graphqlRequestClient = new GraphQLClient(GRAPHQL_ENDPOINT, {
12
+ credentials: 'include',
13
+ mode: 'cors',
14
+ fetch,
15
+ headers: {
16
+ Authorization: `Bearer ${AUTH_TOKEN}`,
17
+ },
18
+ })
19
+
20
+ export const graphqlRequestAdmin = new GraphQLClient(GRAPHQL_ENDPOINT_ADMIN, {
21
+ credentials: 'include',
22
+ mode: 'cors',
23
+ fetch,
24
+ headers: {
25
+ Authorization: `Bearer ${AUTH_TOKEN_ADMIN}`,
26
+ },
27
+ })
28
+
29
+ export const queryClient = new QueryClient({
30
+ queryCache: new QueryCache({
31
+ onError: (error) => {
32
+ console.error(error)
33
+ },
34
+ }),
35
+ defaultOptions: {
36
+ queries: {
37
+ staleTime: 5 * 1000,
38
+ },
39
+ },
40
+ })
41
+
42
+ export default graphqlRequestClient
package/src/server.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './lib/query'
2
+ export { default as initDirectusQuery } from './lib/init'
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "react-jsx",
4
+ "allowJs": false,
5
+ "esModuleInterop": false,
6
+ "allowSyntheticDefaultImports": true,
7
+ "strict": true,
8
+ "types": ["vite/client"]
9
+ },
10
+ "files": [],
11
+ "include": [],
12
+ "references": [
13
+ {
14
+ "path": "./tsconfig.lib.json"
15
+ }
16
+ ],
17
+ "extends": "../../../tsconfig.base.json"
18
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../../dist/out-tsc",
5
+ "types": ["node", "vite/client"]
6
+ },
7
+ "files": [
8
+ "../../../node_modules/@nx/react/typings/cssmodule.d.ts",
9
+ "../../../node_modules/@nx/react/typings/image.d.ts"
10
+ ],
11
+ "exclude": [
12
+ "**/*.spec.ts",
13
+ "**/*.test.ts",
14
+ "**/*.spec.tsx",
15
+ "**/*.test.tsx",
16
+ "**/*.spec.js",
17
+ "**/*.test.js",
18
+ "**/*.spec.jsx",
19
+ "**/*.test.jsx"
20
+ ],
21
+ "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
22
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,51 @@
1
+ /* eslint-disable import/no-relative-packages */
2
+ /// <reference types="vitest" />
3
+ import * as path from 'path'
4
+ import react from '@vitejs/plugin-react'
5
+ import { defineConfig } from 'vite'
6
+ import dts from 'vite-plugin-dts'
7
+ import viteTsConfigPaths from 'vite-tsconfig-paths'
8
+ import externalDeps from '../../../config/external-deps'
9
+
10
+ export default defineConfig({
11
+ cacheDir: '../../../node_modules/.vite/directus-query',
12
+
13
+ plugins: [
14
+ dts({
15
+ entryRoot: 'src',
16
+ tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
17
+ skipDiagnostics: true,
18
+ }),
19
+ react(),
20
+ viteTsConfigPaths({
21
+ root: '../../../',
22
+ }),
23
+ ],
24
+
25
+ // Uncomment this if you are using workers.
26
+ // worker: {
27
+ // plugins: [
28
+ // viteTsConfigPaths({
29
+ // root: '../../../',
30
+ // }),
31
+ // ],
32
+ // },
33
+
34
+ // Configuration for building your library.
35
+ // See: https://vitejs.dev/guide/build.html#library-mode
36
+ build: {
37
+ lib: {
38
+ // Could also be a dictionary or array of multiple entry points.
39
+ entry: 'src/index.ts',
40
+ name: 'directus-query',
41
+ fileName: 'index',
42
+ // Change this to the formats you want to support.
43
+ // Don't forget to update your package.json as well.
44
+ formats: ['es', 'cjs'],
45
+ },
46
+ rollupOptions: {
47
+ // External packages that should not be bundled into your library.
48
+ external: externalDeps,
49
+ },
50
+ },
51
+ })
package/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './lib/hooks';
2
- export * from './lib/query';
3
- export { default as initDiretusQuery } from './lib/init';
package/index.js DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@tanstack/react-query"),l=require("radash"),a=require("graphql-request"),y=process.env.NEXT_PUBLIC_GRAPHQL_URL,q=process.env.NEXT_GRAPHQL_URL_ADMIN,Q=process.env.NEXT_PUBLIC_API_TOKEN,_=process.env.NEXT_PUBLIC_API_TOKEN,A=new a.GraphQLClient(y,{credentials:"include",mode:"cors",fetch,headers:{Authorization:`Bearer ${Q}`}}),N=new a.GraphQLClient(q,{credentials:"include",mode:"cors",fetch,headers:{Authorization:`Bearer ${_}`}});new t.QueryClient({queryCache:new t.QueryCache({onError:e=>{console.error(e)}}),defaultOptions:{queries:{staleTime:5*1e3}}});function o(e,r,n=A){return n.request(e,{...r})}function c(e,r){return[l.get(e,"definitions.0.name.value"),r]}function p(e,r,n,s){const u=c(e,r);return t.useQuery({queryKey:u,queryFn:async({queryKey:i})=>o(e,i[1],s),...n})}function T(e,r,n){const s=c(e,r);return t.useSuspenseQuery({queryKey:s,queryFn:async({queryKey:u})=>o(e,u[1]),...n})}function G(e,r,n){const s=c(e,r);return t.useSuspenseQuery({queryKey:s,queryFn:async({queryKey:u})=>o(e,u[1],N),...n})}const d=process.env.NEXT_PUBLIC_GRAPHQL_URL,h=process.env.NEXT_PUBLIC_API_TOKEN,P={credentials:"include",mode:"cors",fetch,headers:{Authorization:`Bearer ${h}`}},L=(e=d,r=P)=>{const n=new a.GraphQLClient(e,r);function s(u,i){return o(u,i,n)}return{queryGql:s,client:n}};exports.getQueryValues=c;exports.initDiretusQuery=L;exports.queryGql=o;exports.useGqlQuery=p;exports.useSuspenseGqlQuery=T;exports.useSuspenseGqlQueryAdmin=G;
package/index.mjs DELETED
@@ -1,87 +0,0 @@
1
- import { QueryClient as l, QueryCache as _, useQuery as y, useSuspenseQuery as a } from "@tanstack/react-query";
2
- import { get as q } from "radash";
3
- import { GraphQLClient as c } from "graphql-request";
4
- const N = process.env.NEXT_PUBLIC_GRAPHQL_URL, A = process.env.NEXT_GRAPHQL_URL_ADMIN, T = process.env.NEXT_PUBLIC_API_TOKEN, p = process.env.NEXT_PUBLIC_API_TOKEN, P = new c(N, {
5
- credentials: "include",
6
- mode: "cors",
7
- fetch,
8
- headers: {
9
- Authorization: `Bearer ${T}`
10
- }
11
- }), Q = new c(A, {
12
- credentials: "include",
13
- mode: "cors",
14
- fetch,
15
- headers: {
16
- Authorization: `Bearer ${p}`
17
- }
18
- });
19
- new l({
20
- queryCache: new _({
21
- onError: (e) => {
22
- console.error(e);
23
- }
24
- }),
25
- defaultOptions: {
26
- queries: {
27
- staleTime: 5 * 1e3
28
- }
29
- }
30
- });
31
- function u(e, r, n = P) {
32
- return n.request(e, {
33
- ...r
34
- });
35
- }
36
- function i(e, r) {
37
- return [q(e, "definitions.0.name.value"), r];
38
- }
39
- function G(e, r, n, s) {
40
- const t = i(e, r);
41
- return y({
42
- queryKey: t,
43
- queryFn: async ({ queryKey: o }) => u(e, o[1], s),
44
- ...n
45
- });
46
- }
47
- function v(e, r, n) {
48
- const s = i(e, r);
49
- return a({
50
- queryKey: s,
51
- queryFn: async ({ queryKey: t }) => u(e, t[1]),
52
- ...n
53
- });
54
- }
55
- function C(e, r, n) {
56
- const s = i(e, r);
57
- return a({
58
- queryKey: s,
59
- queryFn: async ({ queryKey: t }) => u(e, t[1], Q),
60
- ...n
61
- });
62
- }
63
- const f = process.env.NEXT_PUBLIC_GRAPHQL_URL, E = process.env.NEXT_PUBLIC_API_TOKEN, L = {
64
- credentials: "include",
65
- mode: "cors",
66
- fetch,
67
- headers: {
68
- Authorization: `Bearer ${E}`
69
- }
70
- }, R = (e = f, r = L) => {
71
- const n = new c(e, r);
72
- function s(t, o) {
73
- return u(t, o, n);
74
- }
75
- return {
76
- queryGql: s,
77
- client: n
78
- };
79
- };
80
- export {
81
- i as getQueryValues,
82
- R as initDiretusQuery,
83
- u as queryGql,
84
- G as useGqlQuery,
85
- v as useSuspenseGqlQuery,
86
- C as useSuspenseGqlQueryAdmin
87
- };
package/lib/config.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { RequestConfig } from 'graphql-request/build/esm/types';
2
- export declare const GRAPHQL_ENDPOINT: string;
3
- export declare const AUTH_TOKEN: string;
4
- export declare const defaultConfig: RequestConfig;
@@ -1,2 +0,0 @@
1
- export * from './use-graphql';
2
- export * from './use-suspense-graphql';
@@ -1,8 +0,0 @@
1
- import { type TypedDocumentNode } from '@graphql-typed-document-node/core';
2
- import type { QueryOptions, UseQueryResult } from '@tanstack/react-query';
3
- import type { GraphQLClient, Variables } from 'graphql-request';
4
- export declare function useGqlQuery<TResult, TVariables extends Variables>(document: TypedDocumentNode<TResult, TVariables>, variables?: TVariables, options?: QueryOptions & {
5
- enabled: boolean;
6
- useErrorBoundary: boolean;
7
- }, client?: GraphQLClient): UseQueryResult<TResult>;
8
- export default useGqlQuery;
@@ -1,8 +0,0 @@
1
- import { type TypedDocumentNode } from '@graphql-typed-document-node/core';
2
- import type { QueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query';
3
- import type { Variables } from 'graphql-request';
4
- export declare function useSuspenseGqlQuery<TResult, TVariables extends Variables>(document: TypedDocumentNode<TResult, TVariables>, variables?: TVariables, options?: QueryOptions & {
5
- enabled: boolean;
6
- useErrorBoundary: boolean;
7
- }): UseSuspenseQueryResult<TResult>;
8
- export declare function useSuspenseGqlQueryAdmin<TResult, TVariables extends Variables>(document: TypedDocumentNode<TResult, TVariables>, variables?: TVariables, options?: QueryOptions): UseSuspenseQueryResult<TResult>;
package/lib/init.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { type TypedDocumentNode } from '@graphql-typed-document-node/core';
2
- import { GraphQLClient } from 'graphql-request';
3
- import type { Variables } from 'graphql-request';
4
- import type { RequestConfig } from 'graphql-request/build/esm/types';
5
- declare const initDiretusQuery: (graphqlEndPoint?: string, requestConfig?: RequestConfig) => {
6
- queryGql: <TResult, TVariables extends Variables>(document: TypedDocumentNode<TResult, TVariables>, queryKey?: TVariables | undefined) => Promise<TResult>;
7
- client: GraphQLClient;
8
- };
9
- export default initDiretusQuery;
package/lib/query.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { type TypedDocumentNode } from '@graphql-typed-document-node/core';
2
- import type { Variables } from 'graphql-request';
3
- export declare function queryGql<TResult, TVariables extends Variables>(document: TypedDocumentNode<TResult, TVariables>, queryKey?: TVariables, client?: import("graphql-request").GraphQLClient): Promise<TResult>;
4
- export declare function getQueryValues<TResult, TVariables extends Variables>(document: TypedDocumentNode<TResult, TVariables>, variables?: TVariables): readonly [string, TVariables | undefined];
package/lib/request.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
- import { GraphQLClient } from 'graphql-request';
3
- export declare const graphqlRequestClient: GraphQLClient;
4
- export declare const graphqlRequestAdmin: GraphQLClient;
5
- export declare const queryClient: QueryClient;
6
- export default graphqlRequestClient;