@zonos/amino 5.4.28 → 5.4.30

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,31 +0,0 @@
1
- import type { DocumentNode, ExecutionResult } from 'graphql';
2
- import { type HandleFetchReturn, type RequestOptions } from "./handleFetch";
3
- type FetcherParams = {
4
- operationName?: string | null;
5
- query: string;
6
- variables?: Record<string, unknown>;
7
- };
8
- export type ExecutionResultType = Record<string, unknown> | Record<string, unknown>[];
9
- type FetcherOpts = {
10
- documentAST?: DocumentNode;
11
- headers?: {
12
- [key: string]: unknown;
13
- };
14
- };
15
- export type GraphiqlExecutionResult<T extends ExecutionResultType = ExecutionResultType> = {
16
- data: ExecutionResult<T, ExecutionResultType>['data'];
17
- };
18
- export type GraphiqlFetcher = (graphQLParams: FetcherParams, opts?: FetcherOpts) => Promise<GraphiqlExecutionResult>;
19
- export type HandleFetchFetcher = <ResponseBody extends unknown, RequestBody = unknown>(url: string, _opts?: RequestOptions<ResponseBody, RequestBody> & {
20
- logRequestIfError?: boolean;
21
- }) => Promise<HandleFetchReturn<ResponseBody>>;
22
- type Fetcher = (props: {
23
- customFetcher: HandleFetchFetcher | null;
24
- url: string | null;
25
- }) => GraphiqlFetcher;
26
- /**
27
- * Graphiql fetcher to send a GraphQl request
28
- * @param url url to fetch
29
- */
30
- export declare const graphiqlFetcher: Fetcher;
31
- export {};
@@ -1 +0,0 @@
1
- "use strict";var e=require("../_tslib-bd4862e8.js"),t=require("./handleFetch.js");exports.graphiqlFetcher=function(n){var r=n.customFetcher,a=n.url;return function(n,s){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(i){switch(i.label){case 0:return a&&n.query?[4,(r||t.handleFetch)(a,e.__assign(e.__assign({method:"POST"},s),{body:n,headers:e.__assign({"content-type":"application/json"},null==s?void 0:s.headers)}))]:[2,{data:null}];case 1:return[2,i.sent().json||{data:null}]}}))}))}};
@@ -1,17 +0,0 @@
1
- type GraphiQlColors = {
2
- atom: string;
3
- attribute: string;
4
- builtin: string;
5
- def: string;
6
- keyword: string;
7
- number: string;
8
- property: string;
9
- qualifier: string;
10
- string: string;
11
- string2: string;
12
- variable: string;
13
- };
14
- export declare const useGraphiqlExplorer: ({ overrideColor, }: {
15
- overrideColor?: GraphiQlColors;
16
- }) => import("@graphiql/react").GraphiQLPlugin;
17
- export {};
@@ -1 +0,0 @@
1
- "use strict";var e=require("../../_tslib-bd4862e8.js"),r=require("@graphiql/plugin-explorer"),t=require("../../styles/constants/theme.js");exports.useGraphiqlExplorer=function(l){var u=l.overrideColor,i={colors:e.__assign({atom:t.theme.blue300,attribute:t.theme.blue700,builtin:t.theme.blue300,def:t.theme.blue700,keyword:t.theme.red500,number:t.theme.blue700,property:t.theme.blue700,qualifier:t.theme.blue700,string:t.theme.blue500,string2:t.theme.blue500,variable:t.theme.red400},u),showAttribution:!0};return r.explorerPlugin(i)};
@@ -1,16 +0,0 @@
1
- import { type ExecutionResultType, type GraphiqlExecutionResult, type GraphiqlFetcher, type HandleFetchFetcher } from "../_graphiqlFetcher";
2
- type Props = {
3
- cachingKey: string;
4
- customFetcher: HandleFetchFetcher | null;
5
- headers?: Record<string, string>;
6
- operationName?: string;
7
- query: string;
8
- url: string;
9
- variables?: string;
10
- };
11
- export declare const useGraphiqlFetcher: ({ cachingKey, customFetcher, operationName, query, url, variables, }: Props) => {
12
- graphiqlFetcher: GraphiqlFetcher;
13
- isLoading: boolean;
14
- resultData: GraphiqlExecutionResult<ExecutionResultType> | null;
15
- };
16
- export {};
@@ -1 +0,0 @@
1
- "use strict";var e=require("../../_tslib-bd4862e8.js"),r=require("react"),t=require("swr"),i=require("../_graphiqlFetcher.js"),n=require("./useSwr.js");require("../handleFetch.js");exports.useGraphiqlFetcher=function(u){var a=u.cachingKey,o=u.customFetcher,s=u.operationName,c=u.query,l=u.url,h=u.variables,d=e.__read(r.useState(null),2),v=d[0],_=d[1],f=i.graphiqlFetcher({customFetcher:o,url:l}),q=n.useSwr(a,(function(){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){switch(e.label){case 0:return[4,f({operationName:s,query:c,variables:h?JSON.parse(h):void 0})];case 1:return[2,{json:e.sent()}]}}))}))}),{keepPreviousData:!0}),g=q.data,p=q.isLoading,w=r.useMemo((function(){return function(r,i){return e.__awaiter(void 0,void 0,void 0,(function(){var n;return e.__generator(this,(function(u){switch(u.label){case 0:return[4,t.mutate(l,(function(){return e.__awaiter(void 0,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,f(r,i)]}))}))}),!1)];case 1:return(n=u.sent())&&_(n),[2,n||{data:null}]}}))}))}}),[f,l]);return r.useEffect((function(){g&&_(g.json)}),[g]),{graphiqlFetcher:w,isLoading:p,resultData:v}};
@@ -1,5 +0,0 @@
1
- import type { Storage } from '@graphiql/toolkit';
2
- /** Suffixes localStorage keys with the current schema name */
3
- export declare const useGraphiqlStorage: ({ defaultSchema, }: {
4
- defaultSchema: string;
5
- }) => Storage;
@@ -1 +0,0 @@
1
- "use strict";var e=require("react"),r=require("lodash/kebabCase"),t=require("./useCurrentShema.js");function a(e){return e&&e.__esModule?e:{default:e}}require("zod"),require("./useStorage.js"),require("../storage.js"),require("dayjs");var u=a(r),o=["graphiql:theme","graphiql:shouldPersistHeaders"];exports.useGraphiqlStorage=function(r){var a=r.defaultSchema,l=u.default(a),n=t.useCurrentSchema(l).value;e.useEffect((function(){window.localStorage.setItem("graphiql:theme","light")}),[]);var c=function(e){return o.includes(e)?e:"".concat(e,"-schema:").concat(n)};return{clear:localStorage.clear,getItem:function(e){return localStorage.getItem(c(e))},length:localStorage.length,removeItem:function(e){return localStorage.removeItem(c(e))},setItem:function(e,r){return localStorage.setItem(c(e),r)}}};
@@ -1,4 +0,0 @@
1
- export declare const useCurrentSchema: <TValue extends string>(defaultSchema: TValue) => {
2
- setValue: (value: string) => void;
3
- value: string;
4
- };
@@ -1 +0,0 @@
1
- "use strict";var e=require("zod"),r=require("./useStorage.js");require("react"),require("../storage.js"),require("dayjs");exports.useCurrentSchema=function(s){return r.useStorage({defaultValue:s,key:"amino:current-schema",schema:e.z.string(),type:"session"})};